vim: update and cleanup
This commit is contained in:
parent
4d52dcadc7
commit
e7e79986ad
@ -19,19 +19,7 @@ vim.wo.number = true
|
|||||||
|
|
||||||
vim.cmd([[colorscheme gruvbox]])
|
vim.cmd([[colorscheme gruvbox]])
|
||||||
|
|
||||||
-- Defines a read-write directory for treesitters in nvim's cache dir
|
|
||||||
local parser_install_dir = vim.fn.stdpath("cache") .. "/treesitters"
|
|
||||||
if vim.fn.isdirectory(parser_install_dir) == 0 then
|
|
||||||
vim.fn.mkdir(parser_install_dir, "p")
|
|
||||||
end
|
|
||||||
-- Adding runtime needed for Nix setup on non NixOS
|
|
||||||
vim.o.runtimepath = vim.o.runtimepath .. "," .. parser_install_dir
|
|
||||||
|
|
||||||
require 'nvim-treesitter.install'.compilers = { 'gcc' }
|
|
||||||
|
|
||||||
require 'nvim-treesitter.configs'.setup {
|
require 'nvim-treesitter.configs'.setup {
|
||||||
ensure_installed = { "c", "cpp", "zig", "python", "verilog", "nix", "lua", "latex" },
|
|
||||||
parser_install_dir = parser_install_dir,
|
|
||||||
highlight = { enable = true, disable = {} },
|
highlight = { enable = true, disable = {} },
|
||||||
indent = { enable = false, disable = {} },
|
indent = { enable = false, disable = {} },
|
||||||
rainbow = {
|
rainbow = {
|
||||||
@ -60,6 +48,7 @@ vim.api.nvim_set_keymap('n', '<C-J>', '<C-W><C-J>', opts)
|
|||||||
vim.api.nvim_set_keymap('n', '<C-K>', '<C-W><C-K>', opts)
|
vim.api.nvim_set_keymap('n', '<C-K>', '<C-W><C-K>', opts)
|
||||||
vim.api.nvim_set_keymap('n', '<C-L>', '<C-W><C-L>', opts)
|
vim.api.nvim_set_keymap('n', '<C-L>', '<C-W><C-L>', opts)
|
||||||
vim.api.nvim_set_keymap('n', '<C-H>', '<C-W><C-H>', opts)
|
vim.api.nvim_set_keymap('n', '<C-H>', '<C-W><C-H>', opts)
|
||||||
|
vim.api.nvim_set_keymap('n', "<C-P>", "<cmd>lua require('fzf-lua').files()<CR>", opts)
|
||||||
|
|
||||||
vim.api.nvim_create_autocmd('LspAttach', {
|
vim.api.nvim_create_autocmd('LspAttach', {
|
||||||
desc = 'LSP actions',
|
desc = 'LSP actions',
|
||||||
@ -110,6 +99,27 @@ vim.api.nvim_create_autocmd('LspAttach', {
|
|||||||
end
|
end
|
||||||
})
|
})
|
||||||
|
|
||||||
|
vim.diagnostic.config({
|
||||||
|
virtual_text = false, -- Turn off inline diagnostics
|
||||||
|
})
|
||||||
|
-- Show all diagnostics on current line in floating window
|
||||||
|
vim.api.nvim_set_keymap(
|
||||||
|
'n', '<Leader>d', ':lua vim.diagnostic.open_float()<CR>',
|
||||||
|
{ noremap = true, silent = true }
|
||||||
|
)
|
||||||
|
-- Go to next diagnostic (if there are multiple on the same line, only shows
|
||||||
|
-- one at a time in the floating window)
|
||||||
|
vim.api.nvim_set_keymap(
|
||||||
|
'n', '<Leader>n', ':lua vim.diagnostic.goto_next()<CR>',
|
||||||
|
{ noremap = true, silent = true }
|
||||||
|
)
|
||||||
|
-- Go to prev diagnostic (if there are multiple on the same line, only shows
|
||||||
|
-- one at a time in the floating window)
|
||||||
|
vim.api.nvim_set_keymap(
|
||||||
|
'n', '<Leader>p', ':lua vim.diagnostic.goto_prev()<CR>',
|
||||||
|
{ noremap = true, silent = true }
|
||||||
|
)
|
||||||
|
|
||||||
-- Use a loop to conveniently call 'setup' on multiple servers and
|
-- Use a loop to conveniently call 'setup' on multiple servers and
|
||||||
-- map buffer local keybindings when the language server attaches
|
-- map buffer local keybindings when the language server attaches
|
||||||
local cmp = require 'cmp'
|
local cmp = require 'cmp'
|
||||||
|
@ -19,6 +19,20 @@
|
|||||||
];
|
];
|
||||||
|
|
||||||
plugins = with pkgs.vimPlugins; [
|
plugins = with pkgs.vimPlugins; [
|
||||||
|
(nvim-treesitter.withPlugins (parsers: [
|
||||||
|
parsers.c
|
||||||
|
parsers.cpp
|
||||||
|
parsers.json
|
||||||
|
parsers.latex
|
||||||
|
parsers.lua
|
||||||
|
parsers.nix
|
||||||
|
parsers.python
|
||||||
|
parsers.query
|
||||||
|
parsers.rust
|
||||||
|
parsers.verilog
|
||||||
|
parsers.vimdoc
|
||||||
|
parsers.zig
|
||||||
|
]))
|
||||||
cmp-buffer
|
cmp-buffer
|
||||||
cmp-cmdline
|
cmp-cmdline
|
||||||
cmp-nvim-lsp
|
cmp-nvim-lsp
|
||||||
@ -26,11 +40,10 @@
|
|||||||
cmp-path
|
cmp-path
|
||||||
colorizer
|
colorizer
|
||||||
fugitive
|
fugitive
|
||||||
fzf-vim
|
fzf-lua
|
||||||
gruvbox
|
gruvbox
|
||||||
nvim-cmp
|
nvim-cmp
|
||||||
nvim-lspconfig
|
nvim-lspconfig
|
||||||
nvim-treesitter
|
|
||||||
nvim-ts-rainbow
|
nvim-ts-rainbow
|
||||||
repeat
|
repeat
|
||||||
targets-vim
|
targets-vim
|
||||||
|
Loading…
Reference in New Issue
Block a user