FIxing all of my problems with the simplest native fix possible
This commit is contained in:
1 parent
e80f5c03da
commit
707fa47d9d
11 files changed
+103
-122
No files matched your search
@@ -0,0 +1,4 @@
|
||||
vim.opt_local.tabstop = 8
|
||||
vim.opt_local.shiftwidth = 8
|
||||
vim.opt_local.softtabstop = 0
|
||||
vim.opt_local.expandtab = false
|
||||
@@ -0,0 +1,4 @@
|
||||
vim.opt_local.tabstop = 8
|
||||
vim.opt_local.shiftwidth = 8
|
||||
vim.opt_local.softtabstop = 0
|
||||
vim.opt_local.expandtab = false
|
||||
@@ -0,0 +1,4 @@
|
||||
vim.opt_local.expandtab = false
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.shiftwidth = 0 -- fall back to tabstop
|
||||
vim.opt_local.softtabstop = 0
|
||||
@@ -1,5 +1,8 @@
|
||||
local map = vim.keymap.set
|
||||
|
||||
--- grr for references, gra for actions, grn for rename as you removed the old keybinds to use defaults
|
||||
map('n', 'gd', vim.lsp.buf.definition)
|
||||
|
||||
map('v', 'J', ":m '>+1<CR>gv=gv")
|
||||
map('v', 'K', ":m '<-2<CR>gv=gv")
|
||||
|
||||
@@ -15,11 +18,6 @@ map('n', '<leader>ss', ':split<CR>')
|
||||
map('n', '<leader>[', '<c-w>H', { silent = true })
|
||||
map('n', '<leader>]', '<c-w>K', { silent = true })
|
||||
|
||||
map('n', '<C-h>', '<C-w>h', { silent = true })
|
||||
map('n', '<C-j>', '<C-w>j', { silent = true })
|
||||
map('n', '<C-k>', '<C-w>k', { silent = true })
|
||||
map('n', '<C-l>', '<C-w>l', { silent = true })
|
||||
|
||||
map('n', '<C-h>', ':NvimTmuxNavigateLeft<CR>', { silent = true })
|
||||
map('n', '<C-j>', ':NvimTmuxNavigateDown<CR>', { silent = true })
|
||||
map('n', '<C-k>', ':NvimTmuxNavigateUp<CR>', { silent = true })
|
||||
@@ -30,7 +28,7 @@ map('n', '<leader>lp', '<cmd>LivePreview pick<cr>')
|
||||
|
||||
map('n', '<leader><leader>', ':Pick files<CR>', { silent = true })
|
||||
map('n', '<leader>fh', ':Pick help<CR>', { silent = true })
|
||||
map('n', '<leader>fg', ':Pick grep<CR>', { silent = true })
|
||||
map('n', '<leader>fg', ':Pick grep_live<CR>', { silent = true })
|
||||
map('n', '<leader>uu', function()
|
||||
require('undotree').open({
|
||||
command = 'topleft 45vnew',
|
||||
@@ -38,28 +36,12 @@ map('n', '<leader>uu', function()
|
||||
})
|
||||
end, { desc = 'native undotree', silent = true })
|
||||
|
||||
map('n', '<leader>ff', vim.lsp.buf.format)
|
||||
|
||||
map('n', '<leader>fs', vim.lsp.buf.document_symbol)
|
||||
map('n', '<leader>gd', vim.lsp.buf.definition)
|
||||
map('n', '<leader>gr', vim.lsp.buf.references)
|
||||
map('n', '<leader>gR', vim.lsp.buf.rename)
|
||||
map('n', '<leader>gc', vim.lsp.buf.code_action)
|
||||
|
||||
local function qf_is_open()
|
||||
return vim.fn.getqflist({ winid = 0 }).winid ~= 0
|
||||
end
|
||||
|
||||
local function diagnostic_items()
|
||||
return vim.diagnostic.toqflist(vim.diagnostic.get())
|
||||
end
|
||||
|
||||
map('n', '<leader>xx', function()
|
||||
if qf_is_open() then
|
||||
if vim.fn.getqflist({ win = 0 }).winid == 0 then
|
||||
vim.cmd('cclose')
|
||||
return
|
||||
end
|
||||
local items = diagnostic_items()
|
||||
local items = vim.diagnostic.toqflist(vim.diagnostic.get())
|
||||
if #items == 0 then
|
||||
vim.notify('No diagnostics found', vim.log.levels.WARN)
|
||||
return
|
||||
@@ -73,10 +55,10 @@ local qf_group = vim.api.nvim_create_augroup('DiagnosticsQuickfix', { clear = tr
|
||||
vim.api.nvim_create_autocmd('DiagnosticChanged', {
|
||||
group = qf_group,
|
||||
callback = function()
|
||||
if not qf_is_open() then
|
||||
if vim.fn.getqflist({ win = 0 }).winid == 0 then
|
||||
return
|
||||
end
|
||||
local items = diagnostic_items()
|
||||
local items = vim.diagnostic.toqflist(vim.diagnostic.get())
|
||||
vim.fn.setqflist(items, 'r')
|
||||
if #items == 0 then
|
||||
vim.cmd('cclose')
|
||||
|
||||
@@ -1,4 +1,9 @@
|
||||
vim.lsp.config('*', { capabilities = require('blink.cmp').get_lsp_capabilities() })
|
||||
vim.lsp.config('*', {
|
||||
capabilities = require('blink.cmp').get_lsp_capabilities({
|
||||
workspace = { didChangeWatchedFiles = { dynamicRegistration = false } },
|
||||
}, true),
|
||||
})
|
||||
|
||||
vim.lsp.config('lua_ls', {
|
||||
settings = {
|
||||
Lua = {
|
||||
@@ -23,9 +28,6 @@ vim.lsp.config('lua_ls', {
|
||||
'/Users/andrew/personal/Projects/Lua/vern-nvim/lua',
|
||||
},
|
||||
},
|
||||
didChangeWatchedFiles = {
|
||||
dynamicRegistration = false,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -45,44 +47,12 @@ vim.lsp.config('vtsls', {
|
||||
maxTsServerMemory = 8192,
|
||||
},
|
||||
updateImportsOnFileMove = { enabled = 'always' },
|
||||
inlayHints = {
|
||||
parameterNames = { enabled = 'all', suppressWhenArgumentMatchesName = true },
|
||||
parameterTypes = { enabled = true },
|
||||
variableTypes = { enabled = true },
|
||||
propertyDeclarationTypes = { enabled = true },
|
||||
functionLikeReturnTypes = { enabled = true },
|
||||
enumMemberValues = { enabled = true },
|
||||
},
|
||||
preferences = {
|
||||
importModuleSpecifier = 'non-relative',
|
||||
},
|
||||
},
|
||||
javascript = {
|
||||
updateImportsOnFileMove = { enabled = 'always' },
|
||||
inlayHints = {
|
||||
parameterNames = { enabled = 'all', suppressWhenArgumentMatchesName = true },
|
||||
parameterTypes = { enabled = true },
|
||||
variableTypes = { enabled = true },
|
||||
propertyDeclarationTypes = { enabled = true },
|
||||
functionLikeReturnTypes = { enabled = true },
|
||||
enumMemberValues = { enabled = true },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
vim.lsp.config('rust_analyzer', {
|
||||
settings = {
|
||||
['rust-analyzer'] = {
|
||||
cargo = {
|
||||
allFeatures = true, -- Enable all cargo features
|
||||
},
|
||||
check = {
|
||||
command = 'clippy', -- Use clippy for errors/warnings on save
|
||||
},
|
||||
diagnostics = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
@@ -90,11 +60,9 @@ vim.lsp.config('rust_analyzer', {
|
||||
vim.lsp.enable({
|
||||
'lua_ls',
|
||||
'clangd',
|
||||
'pylsp',
|
||||
'rust_analyzer',
|
||||
'gopls',
|
||||
|
||||
--- Web
|
||||
'vtsls',
|
||||
'superhtml',
|
||||
'html',
|
||||
})
|
||||
@@ -8,7 +8,8 @@ vim.opt.swapfile = false
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.signcolumn = 'yes'
|
||||
vim.opt.wrap = false
|
||||
vim.opt.showmode = false
|
||||
vim.opt.confirm = true
|
||||
-- vim.opt.showmode = false
|
||||
vim.o.winborder = 'rounded'
|
||||
|
||||
vim.opt.scrolloff = 15
|
||||
@@ -17,29 +18,11 @@ vim.opt.smoothscroll = true
|
||||
vim.opt.updatetime = 50
|
||||
|
||||
vim.opt.smartindent = true
|
||||
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
||||
|
||||
local shifts = {
|
||||
lua = 4,
|
||||
python = 4,
|
||||
rust = 4,
|
||||
html = 2,
|
||||
go = 4,
|
||||
javascript = 2,
|
||||
typescript = 2,
|
||||
}
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
group = vim.api.nvim_create_augroup('IndentSettings', { clear = true }),
|
||||
pattern = vim.tbl_keys(shifts),
|
||||
callback = function(ev)
|
||||
local size = shifts[ev.match]
|
||||
local bo = vim.bo[ev.buf]
|
||||
bo.tabstop = size
|
||||
bo.shiftwidth = size
|
||||
bo.softtabstop = size
|
||||
bo.expandtab = true
|
||||
end,
|
||||
})
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.softtabstop = -1
|
||||
vim.opt.expandtab = true
|
||||
|
||||
vim.diagnostic.config({
|
||||
virtual_text = true,
|
||||
|
||||
@@ -1,20 +1,30 @@
|
||||
require('conform').setup({
|
||||
local conform = require('conform')
|
||||
conform.setup({
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua', lsp_format = 'fallback' },
|
||||
lua = { 'stylua' },
|
||||
c = { 'clang-format' },
|
||||
cpp = { 'clang-format' },
|
||||
go = { 'goimports' },
|
||||
|
||||
--- Web
|
||||
javascript = { 'prettier', stop_after_first = true },
|
||||
typescript = { 'prettier', stop_after_first = true },
|
||||
json = { 'prettier' },
|
||||
html = { 'prettier' },
|
||||
c = { 'clang-format' },
|
||||
-- go = { 'goimports', 'crlfmt' },
|
||||
go = { 'goimports' },
|
||||
cpp = { 'clang-format' },
|
||||
python = { 'ruff_fix', 'ruff_format' },
|
||||
rust = { 'rustfmt' },
|
||||
css = { 'prettier' },
|
||||
markdown = { 'prettier' },
|
||||
yaml = { 'prettier' },
|
||||
|
||||
['_'] = { 'trim_whitespace' },
|
||||
},
|
||||
format_on_save = {
|
||||
timeout_ms = 500,
|
||||
timeout_ms = 2000,
|
||||
lsp_format = 'fallback',
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set('n', '<leader>ff', function()
|
||||
conform.format({ async = true, lsp_format = 'fallback' })
|
||||
end)
|
||||
|
||||
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
||||
@@ -1,12 +1,10 @@
|
||||
require('mason').setup()
|
||||
require('mason-lspconfig').setup({
|
||||
ensure_installed = {
|
||||
'vtsls',
|
||||
'lua_ls',
|
||||
'pylsp',
|
||||
'cssls',
|
||||
'superhtml',
|
||||
'gopls',
|
||||
'lua_ls',
|
||||
'vtsls', -- typescript, javascript
|
||||
'html',
|
||||
},
|
||||
automatic_enable = false,
|
||||
})
|
||||
|
||||
@@ -31,12 +31,16 @@ require('mini.input').setup()
|
||||
|
||||
require('mini.pick').setup({
|
||||
window = {
|
||||
config = {
|
||||
config = function()
|
||||
local height = math.floor(0.618 * vim.o.lines)
|
||||
local width = math.floor(0.618 * vim.o.columns)
|
||||
return {
|
||||
anchor = 'NW',
|
||||
row = math.floor(0.5 * (vim.o.lines - math.floor(0.618 * vim.o.lines))),
|
||||
col = math.floor(0.5 * (vim.o.columns - math.floor(0.618 * vim.o.columns))),
|
||||
height = math.floor(0.618 * vim.o.lines),
|
||||
width = math.floor(0.618 * vim.o.columns),
|
||||
},
|
||||
row = math.floor(0.5 * (vim.o.lines - height)),
|
||||
col = math.floor(0.5 * (vim.o.columns - width)),
|
||||
height = height,
|
||||
width = width,
|
||||
}
|
||||
end,
|
||||
},
|
||||
})
|
||||
@@ -1,29 +1,53 @@
|
||||
local parsers = {
|
||||
'json',
|
||||
'rust',
|
||||
'lua',
|
||||
'luadoc', -- highlights ---@ annotations, useful for your plugin work
|
||||
'go',
|
||||
'gomod',
|
||||
'c',
|
||||
'cpp',
|
||||
'lua',
|
||||
'html',
|
||||
'javascript',
|
||||
'typescript',
|
||||
'tsx',
|
||||
'css',
|
||||
'python',
|
||||
|
||||
'vim',
|
||||
'vimdoc',
|
||||
'query',
|
||||
'json',
|
||||
'yaml',
|
||||
'toml',
|
||||
'bash',
|
||||
'markdown',
|
||||
'markdown_inline',
|
||||
'gitcommit',
|
||||
'gitignore',
|
||||
'diff',
|
||||
|
||||
-- web: keep the installed parsers, but don't auto-install for now
|
||||
-- 'javascript',
|
||||
-- 'typescript',
|
||||
-- 'tsx',
|
||||
-- 'html',
|
||||
-- 'css',
|
||||
}
|
||||
require('nvim-treesitter').install(parsers)
|
||||
|
||||
local group = vim.api.nvim_create_augroup('UserTreesitter', { clear = true })
|
||||
|
||||
vim.api.nvim_create_autocmd('VimEnter', {
|
||||
group = group,
|
||||
once = true,
|
||||
callback = function()
|
||||
require('nvim-treesitter').install(parsers)
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('FileType', {
|
||||
group = group,
|
||||
desc = 'Start treesitter highlighting when a parser is installed',
|
||||
pattern = '*',
|
||||
callback = function(ev)
|
||||
local lang = vim.treesitter.language.get_lang(ev.match) or ev.match
|
||||
if not vim.treesitter.language.add(lang) then
|
||||
if vim.bo.buftype ~= '' then
|
||||
return
|
||||
end
|
||||
vim.treesitter.start(ev.buf, lang)
|
||||
local ok = pcall(vim.treesitter.start, ev.buf)
|
||||
if ok then
|
||||
vim.bo[ev.buf].indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
end
|
||||
end,
|
||||
})
|
||||
@@ -1,5 +1,5 @@
|
||||
column_width = 100
|
||||
line_endings = "Unix"
|
||||
indent_type = "Tabs"
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
quote_style = "AutoPreferSingle"
|
||||
Reference in new issue
Block a user