Navic, projectconfig, term shift-esc, zoom notif fix, diagnostic display
This commit is contained in:
parent
caa187ca9c
commit
443d2b8b94
49
init.lua
49
init.lua
|
@ -54,6 +54,7 @@ o.tabstop = 4 -- A physical tab is 4 characters wide
|
|||
o.shiftwidth = 4 -- A unit of indentention is 4 levels wide
|
||||
o.wrapmargin = 0 -- Disable hard line wrapping
|
||||
o.textwidth = 0 -- Comments lines should wrap at 100 chars
|
||||
o.laststatus = 3
|
||||
-- Set <Leader> key
|
||||
g.mapleader = ' '
|
||||
vim.cmd 'filetype plugin indent on'
|
||||
|
@ -91,7 +92,7 @@ local function zoom(delta)
|
|||
hide_from_history = true,
|
||||
}
|
||||
if zoom_notification ~= nil then
|
||||
properties.replace = zoom_notification
|
||||
properties.replace = zoom_notification.id
|
||||
end
|
||||
zoom_notification = vim.notify('Changing font size to ' .. size, vim.log.levels.INFO, properties)
|
||||
end
|
||||
|
@ -123,6 +124,7 @@ do
|
|||
if ok then
|
||||
notify.dismiss{}
|
||||
end
|
||||
vim.lsp.buf.clear_references()
|
||||
vim.cmd('nohlsearch|diffupdate|normal! <C-l>')
|
||||
end, 'Clear'} }
|
||||
|
||||
|
@ -140,6 +142,9 @@ do
|
|||
end
|
||||
end
|
||||
end
|
||||
vim.cmd [[
|
||||
tnoremap <S-Esc> <C-\><C-n>'
|
||||
]]
|
||||
|
||||
-- Commands
|
||||
vim.cmd [[
|
||||
|
@ -187,7 +192,7 @@ vim.diagnostic.config {
|
|||
-- Configure underlining diagnostics
|
||||
underline = {
|
||||
-- Only underline warnings and up
|
||||
severity = vim.diagnostic.severity.WARN
|
||||
severity = { min = vim.diagnostic.severity.WARN }
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -257,6 +262,12 @@ require'packer'.startup(function(use)
|
|||
require'which-key'.register{['<Leader>s'] = {'<Cmd>ISwapWith<CR>','Swap'}}
|
||||
end}
|
||||
use 'bfredl/nvim-luadev' -- lua scratchpad
|
||||
use {'windwp/nvim-projectconfig', config = function ()
|
||||
require'nvim-projectconfig'.setup {
|
||||
-- Load project configuration when changing directory
|
||||
autocmd = true,
|
||||
}
|
||||
end}
|
||||
use 'tpope/vim-repeat'
|
||||
use 'tpope/vim-sleuth'
|
||||
-- spellsitter: syntax aware spellchecking
|
||||
|
@ -288,12 +299,17 @@ require'packer'.startup(function(use)
|
|||
}
|
||||
}
|
||||
end}
|
||||
use 'SmiteshP/nvim-navic'
|
||||
use {'utilyre/barbecue.nvim', config = function ()
|
||||
require'barbecue'.setup()
|
||||
end}
|
||||
|
||||
-- UI elements --
|
||||
use 'vim-airline/vim-airline'
|
||||
use 'vim-airline/vim-airline-themes'
|
||||
use 'romgrk/barbar.nvim'
|
||||
use {'MattesGroeger/vim-bookmarks', config = function()
|
||||
vim.g.bookmark_no_default_key_mappings = 1
|
||||
vim.g.bookmark_save_per_working_dir = 1
|
||||
end}
|
||||
use {'mfussenegger/nvim-dap', config = function()
|
||||
|
@ -444,7 +460,14 @@ require'packer'.startup(function(use)
|
|||
use 'kosayoda/nvim-lightbulb'
|
||||
use {'https://git.sr.ht/~whynothugo/lsp_lines.nvim', config = function()
|
||||
require'lsp_lines'.setup()
|
||||
vim.diagnostic.config { virtual_text = false }
|
||||
vim.diagnostic.config {
|
||||
virtual_text = {
|
||||
severity = { min = vim.diagnostic.severity.WARN },
|
||||
},
|
||||
virtual_lines = {
|
||||
only_current_line = true,
|
||||
}
|
||||
}
|
||||
end}
|
||||
use {'williamboman/mason.nvim', config = function()
|
||||
require'mason'.setup()
|
||||
|
@ -645,6 +668,7 @@ require'gitsigns'.setup {
|
|||
S = {gitsigns.stage_buffer, 'Stage buffer'},
|
||||
u = {gitsigns.unstage_hunk, 'Unstage hunk'},
|
||||
U = {gitsigns.unstage_buffer, 'Unstage buffer'},
|
||||
r = {gitsigns.reset_hunk, 'Reset hunk'},
|
||||
v = {gitsigns.select_hunk, 'Visual select hunk'},
|
||||
d = {gitsigns.toggle_deleted, 'Toggle deleted lines'},
|
||||
w = {gitsigns.toggle_word_diff, 'Toggle word diffs'},
|
||||
|
@ -732,7 +756,7 @@ local capabilities = require'cmp_nvim_lsp'.default_capabilities()
|
|||
--- Performs keymaps and other setup specific to buffers with LSP enabled
|
||||
--- @param bufnr number
|
||||
--- @diagnostic disable-next-line: unused-local
|
||||
local function on_attach(_client, bufnr)
|
||||
local function on_attach(client, bufnr)
|
||||
|
||||
require'which-key'.register({
|
||||
g = {
|
||||
|
@ -752,8 +776,8 @@ local function on_attach(_client, bufnr)
|
|||
g = {vim.diagnostic.goto_prev, 'Previous diagnostic'},
|
||||
e = {function() vim.diagnostic.goto_prev { severity = vim.diagnostic.severity.ERROR } end, 'Previous error'},
|
||||
w = {function() vim.diagnostic.goto_prev { severity = vim.diagnostic.severity.WARN } end, 'Previous warning'},
|
||||
}
|
||||
|
||||
},
|
||||
['<C-h>'] = {vim.lsp.buf.document_highlight, 'Highlight object under cursor'},
|
||||
}, {buffer = bufnr})
|
||||
-- Hover
|
||||
require'which-key'.register({
|
||||
|
@ -765,6 +789,10 @@ local function on_attach(_client, bufnr)
|
|||
}, {buffer = bufnr, mode = 'i'})
|
||||
|
||||
vim.bo.tagfunc = 'v:lua.vim.lsp.tagfunc'
|
||||
|
||||
require'nvim-navic'.attach(client, bufnr)
|
||||
|
||||
au('CursorMoved', { callback = vim.lsp.buf.clear_references, buffer = bufnr, })
|
||||
end
|
||||
|
||||
-- Enable language servers
|
||||
|
@ -773,9 +801,6 @@ local default = {
|
|||
on_attach = on_attach,
|
||||
}
|
||||
|
||||
local runtime_path = vim.split(package.path, ';')
|
||||
table.insert(runtime_path, 'lua/?.lua')
|
||||
table.insert(runtime_path, 'lua/?/init.lua')
|
||||
require'lspconfig'.lua_ls.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
|
@ -783,13 +808,13 @@ require'lspconfig'.lua_ls.setup {
|
|||
Lua = {
|
||||
runtime = {
|
||||
version = 'LuaJIT',
|
||||
path = runtime_path,
|
||||
},
|
||||
diagnostics = {
|
||||
globals = {'vim'},
|
||||
},
|
||||
workspace = {
|
||||
library = vim.api.nvim_get_runtime_file('', true),
|
||||
checkThirdParty = false,
|
||||
},
|
||||
telemetry = {
|
||||
enable = false,
|
||||
|
@ -952,6 +977,8 @@ require('nvim-tree').setup {
|
|||
highlight_opened_files = 'name',
|
||||
-- Don't hightlight files as spceial
|
||||
special_files = {},
|
||||
-- Combine nested folders with only one child
|
||||
group_empty = true,
|
||||
-- Icon settings
|
||||
icons = {
|
||||
-- Hide git attribute icons
|
||||
|
@ -986,7 +1013,7 @@ require'nvim-treesitter.configs'.setup {
|
|||
autotag = {
|
||||
enable = true,
|
||||
},
|
||||
ensure_installed = {'lua', 'html', 'c', 'cpp', 'nix', 'vim', 'rust'},
|
||||
ensure_installed = {'lua', 'html', 'c', 'cpp', 'nix', 'vim', 'rust', 'bash', 'markdown', 'java', 'markdown_inline'},
|
||||
highlight = { enable = true, disable = 'rust' },
|
||||
incremental_selection = { enable = true },
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue