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
|
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', 'J', ":m '>+1<CR>gv=gv")
|
||||||
map('v', 'K', ":m '<-2<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>H', { silent = true })
|
||||||
map('n', '<leader>]', '<c-w>K', { 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-h>', ':NvimTmuxNavigateLeft<CR>', { silent = true })
|
||||||
map('n', '<C-j>', ':NvimTmuxNavigateDown<CR>', { silent = true })
|
map('n', '<C-j>', ':NvimTmuxNavigateDown<CR>', { silent = true })
|
||||||
map('n', '<C-k>', ':NvimTmuxNavigateUp<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><leader>', ':Pick files<CR>', { silent = true })
|
||||||
map('n', '<leader>fh', ':Pick help<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()
|
map('n', '<leader>uu', function()
|
||||||
require('undotree').open({
|
require('undotree').open({
|
||||||
command = 'topleft 45vnew',
|
command = 'topleft 45vnew',
|
||||||
@@ -38,28 +36,12 @@ map('n', '<leader>uu', function()
|
|||||||
})
|
})
|
||||||
end, { desc = 'native undotree', silent = true })
|
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()
|
map('n', '<leader>xx', function()
|
||||||
if qf_is_open() then
|
if vim.fn.getqflist({ win = 0 }).winid == 0 then
|
||||||
vim.cmd('cclose')
|
vim.cmd('cclose')
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local items = diagnostic_items()
|
local items = vim.diagnostic.toqflist(vim.diagnostic.get())
|
||||||
if #items == 0 then
|
if #items == 0 then
|
||||||
vim.notify('No diagnostics found', vim.log.levels.WARN)
|
vim.notify('No diagnostics found', vim.log.levels.WARN)
|
||||||
return
|
return
|
||||||
@@ -73,10 +55,10 @@ local qf_group = vim.api.nvim_create_augroup('DiagnosticsQuickfix', { clear = tr
|
|||||||
vim.api.nvim_create_autocmd('DiagnosticChanged', {
|
vim.api.nvim_create_autocmd('DiagnosticChanged', {
|
||||||
group = qf_group,
|
group = qf_group,
|
||||||
callback = function()
|
callback = function()
|
||||||
if not qf_is_open() then
|
if vim.fn.getqflist({ win = 0 }).winid == 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
local items = diagnostic_items()
|
local items = vim.diagnostic.toqflist(vim.diagnostic.get())
|
||||||
vim.fn.setqflist(items, 'r')
|
vim.fn.setqflist(items, 'r')
|
||||||
if #items == 0 then
|
if #items == 0 then
|
||||||
vim.cmd('cclose')
|
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', {
|
vim.lsp.config('lua_ls', {
|
||||||
settings = {
|
settings = {
|
||||||
Lua = {
|
Lua = {
|
||||||
@@ -23,9 +28,6 @@ vim.lsp.config('lua_ls', {
|
|||||||
'/Users/andrew/personal/Projects/Lua/vern-nvim/lua',
|
'/Users/andrew/personal/Projects/Lua/vern-nvim/lua',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
didChangeWatchedFiles = {
|
|
||||||
dynamicRegistration = false,
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -45,44 +47,12 @@ vim.lsp.config('vtsls', {
|
|||||||
maxTsServerMemory = 8192,
|
maxTsServerMemory = 8192,
|
||||||
},
|
},
|
||||||
updateImportsOnFileMove = { enabled = 'always' },
|
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 = {
|
preferences = {
|
||||||
importModuleSpecifier = 'non-relative',
|
importModuleSpecifier = 'non-relative',
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
javascript = {
|
javascript = {
|
||||||
updateImportsOnFileMove = { enabled = 'always' },
|
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({
|
vim.lsp.enable({
|
||||||
'lua_ls',
|
'lua_ls',
|
||||||
'clangd',
|
'clangd',
|
||||||
'pylsp',
|
|
||||||
'rust_analyzer',
|
|
||||||
'gopls',
|
'gopls',
|
||||||
|
|
||||||
--- Web
|
--- Web
|
||||||
'vtsls',
|
'vtsls',
|
||||||
'superhtml',
|
'html',
|
||||||
})
|
})
|
||||||
@@ -8,7 +8,8 @@ vim.opt.swapfile = false
|
|||||||
vim.opt.termguicolors = true
|
vim.opt.termguicolors = true
|
||||||
vim.opt.signcolumn = 'yes'
|
vim.opt.signcolumn = 'yes'
|
||||||
vim.opt.wrap = false
|
vim.opt.wrap = false
|
||||||
vim.opt.showmode = false
|
vim.opt.confirm = true
|
||||||
|
-- vim.opt.showmode = false
|
||||||
vim.o.winborder = 'rounded'
|
vim.o.winborder = 'rounded'
|
||||||
|
|
||||||
vim.opt.scrolloff = 15
|
vim.opt.scrolloff = 15
|
||||||
@@ -17,29 +18,11 @@ vim.opt.smoothscroll = true
|
|||||||
vim.opt.updatetime = 50
|
vim.opt.updatetime = 50
|
||||||
|
|
||||||
vim.opt.smartindent = true
|
vim.opt.smartindent = true
|
||||||
vim.o.formatexpr = "v:lua.require'conform'.formatexpr()"
|
|
||||||
|
|
||||||
local shifts = {
|
vim.opt.tabstop = 2
|
||||||
lua = 4,
|
vim.opt.shiftwidth = 2
|
||||||
python = 4,
|
vim.opt.softtabstop = -1
|
||||||
rust = 4,
|
vim.opt.expandtab = true
|
||||||
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.diagnostic.config({
|
vim.diagnostic.config({
|
||||||
virtual_text = true,
|
virtual_text = true,
|
||||||
|
|||||||
@@ -1,20 +1,30 @@
|
|||||||
require('conform').setup({
|
local conform = require('conform')
|
||||||
|
conform.setup({
|
||||||
formatters_by_ft = {
|
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 },
|
javascript = { 'prettier', stop_after_first = true },
|
||||||
typescript = { 'prettier', stop_after_first = true },
|
typescript = { 'prettier', stop_after_first = true },
|
||||||
json = { 'prettier' },
|
json = { 'prettier' },
|
||||||
html = { 'prettier' },
|
html = { 'prettier' },
|
||||||
c = { 'clang-format' },
|
css = { 'prettier' },
|
||||||
-- go = { 'goimports', 'crlfmt' },
|
markdown = { 'prettier' },
|
||||||
go = { 'goimports' },
|
yaml = { 'prettier' },
|
||||||
cpp = { 'clang-format' },
|
|
||||||
python = { 'ruff_fix', 'ruff_format' },
|
|
||||||
rust = { 'rustfmt' },
|
|
||||||
['_'] = { 'trim_whitespace' },
|
['_'] = { 'trim_whitespace' },
|
||||||
},
|
},
|
||||||
format_on_save = {
|
format_on_save = {
|
||||||
timeout_ms = 500,
|
timeout_ms = 2000,
|
||||||
lsp_format = 'fallback',
|
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').setup()
|
||||||
require('mason-lspconfig').setup({
|
require('mason-lspconfig').setup({
|
||||||
ensure_installed = {
|
ensure_installed = {
|
||||||
'vtsls',
|
|
||||||
'lua_ls',
|
|
||||||
'pylsp',
|
|
||||||
'cssls',
|
|
||||||
'superhtml',
|
|
||||||
'gopls',
|
'gopls',
|
||||||
|
'lua_ls',
|
||||||
|
'vtsls', -- typescript, javascript
|
||||||
|
'html',
|
||||||
},
|
},
|
||||||
automatic_enable = false,
|
automatic_enable = false,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -31,12 +31,16 @@ require('mini.input').setup()
|
|||||||
|
|
||||||
require('mini.pick').setup({
|
require('mini.pick').setup({
|
||||||
window = {
|
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',
|
anchor = 'NW',
|
||||||
row = math.floor(0.5 * (vim.o.lines - math.floor(0.618 * vim.o.lines))),
|
row = math.floor(0.5 * (vim.o.lines - height)),
|
||||||
col = math.floor(0.5 * (vim.o.columns - math.floor(0.618 * vim.o.columns))),
|
col = math.floor(0.5 * (vim.o.columns - width)),
|
||||||
height = math.floor(0.618 * vim.o.lines),
|
height = height,
|
||||||
width = math.floor(0.618 * vim.o.columns),
|
width = width,
|
||||||
},
|
}
|
||||||
|
end,
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
@@ -1,29 +1,53 @@
|
|||||||
local parsers = {
|
local parsers = {
|
||||||
'json',
|
'lua',
|
||||||
'rust',
|
'luadoc', -- highlights ---@ annotations, useful for your plugin work
|
||||||
|
'go',
|
||||||
|
'gomod',
|
||||||
'c',
|
'c',
|
||||||
'cpp',
|
'cpp',
|
||||||
'lua',
|
|
||||||
'html',
|
'vim',
|
||||||
'javascript',
|
'vimdoc',
|
||||||
'typescript',
|
'query',
|
||||||
'tsx',
|
'json',
|
||||||
'css',
|
|
||||||
'python',
|
|
||||||
'yaml',
|
'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 })
|
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', {
|
vim.api.nvim_create_autocmd('FileType', {
|
||||||
group = group,
|
group = group,
|
||||||
desc = 'Start treesitter highlighting when a parser is installed',
|
desc = 'Start treesitter highlighting when a parser is installed',
|
||||||
|
pattern = '*',
|
||||||
callback = function(ev)
|
callback = function(ev)
|
||||||
local lang = vim.treesitter.language.get_lang(ev.match) or ev.match
|
if vim.bo.buftype ~= '' then
|
||||||
if not vim.treesitter.language.add(lang) then
|
|
||||||
return
|
return
|
||||||
end
|
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,
|
end,
|
||||||
})
|
})
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
column_width = 100
|
column_width = 100
|
||||||
line_endings = "Unix"
|
line_endings = "Unix"
|
||||||
indent_type = "Tabs"
|
indent_type = "Spaces"
|
||||||
indent_width = 2
|
indent_width = 2
|
||||||
quote_style = "AutoPreferSingle"
|
quote_style = "AutoPreferSingle"
|
||||||
Reference in new issue
Block a user