diff options
author | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-16 13:27:06 -0400 |
---|---|---|
committer | bpc2003 <wpesfriendnva@gmail.com> | 2025-05-16 13:27:06 -0400 |
commit | 88f276a65baec6e3f586a05a7922e9c44892e68e (patch) | |
tree | 4d89e7072d80b779b8d84f59c340fa2e820a577e /lua/plugins | |
parent | 2a3d18deff31e75273945d61a1785d386a310479 (diff) |
Add LSP support
Diffstat (limited to 'lua/plugins')
-rw-r--r-- | lua/plugins/keybindings.lua | 40 | ||||
-rw-r--r-- | lua/plugins/lspconfig.lua | 28 |
2 files changed, 60 insertions, 8 deletions
diff --git a/lua/plugins/keybindings.lua b/lua/plugins/keybindings.lua index 4665e69..cb40552 100644 --- a/lua/plugins/keybindings.lua +++ b/lua/plugins/keybindings.lua @@ -1,13 +1,31 @@ --- buffer commands -vim.keymap.set('n', '<Leader>t', ':tabnew<CR>', { noremap = true, silent = true }) +-- ============help menu============= +-- open help menu +vim.keymap.set('n', '<Leader>', + ':!less '.. + '~/.config/nvim/lua/plugins/keybindings.lua<CR>', + { noremap = true, silent = true }) + +-- ==============tabs================ +-- open a new tab +vim.keymap.set('n', '<Leader>t', ':tabnew<CR>', + { noremap = true, silent = true }) + +-- go to next tab vim.keymap.set('n', '<Leader>n', 'gt') + +-- go to previous tab vim.keymap.set('n', '<Leader>p', 'gT') --- terminal -vim.keymap.set('n', '<Leader>v', ':vertical term<CR>', { noremap = true, silent = true}) -vim.keymap.set('n', '<Leader>h', ':belowright term<CR>', { noremap = true, silent = true}) +-- =============terminals============ +-- create a vertically split terminal +vim.keymap.set('n', '<Leader>v', ':vertical term<CR>', + { noremap = true, silent = true}) --- lazy +-- create a horizontally split terminal +vim.keymap.set('n', '<Leader>h', ':belowright term<CR>', + { noremap = true, silent = true}) + +-- ===============Lazy=============== vim.keymap.set('n', '<Leader>l', ':Lazy<CR>', { noremap = true }) vim.keymap.set('n', '<Leader>lu', ':Lazy update<CR>', { noremap = true }) vim.keymap.set('n', '<Leader>ls', ':Lazy sync<CR>', { noremap = true }) @@ -18,10 +36,16 @@ vim.keymap.set('n', '<Leader>lr', ':Lazy restore<CR>', { noremap = true }) vim.keymap.set('n', '<Leader>lp', ':Lazy profile<CR>', { noremap = true }) vim.keymap.set('n', '<Leader>ld', ':Lazy debug<CR>', { noremap = true }) --- write commands +-- ============file commands========= +-- write vim.keymap.set('n', '<Leader>s', ':w<CR>', { noremap = true }) + +-- write and quit vim.keymap.set('n', '<Leader>sq', ':wq<CR>', { noremap = true }) --- quit +-- ===========quitting=============== +-- safe quit vim.keymap.set('n', '<Leader>q', ':q<CR>', { silent = true }) + +-- unsafe quit vim.keymap.set('n', '<Leader>Q', ':q!<CR>', { silent = true}) diff --git a/lua/plugins/lspconfig.lua b/lua/plugins/lspconfig.lua new file mode 100644 index 0000000..526c164 --- /dev/null +++ b/lua/plugins/lspconfig.lua @@ -0,0 +1,28 @@ +vim.diagnostic.config({ + virtual_text = true, + signs = true, + underline = true, + severity_sort = true, +}) + +vim.lsp.config['ccls'] = { + cmd = { 'ccls' }, + root_markers = { '.ccls-cache', '.ccls' }, + filetypes = { 'c', 'cpp', 'cc', 'h' }, +} + +vim.lsp.config['gopls'] = { + cmd = { 'gopls' }, + root_markers = { 'go.mod', 'go.work' }, + filetypes = { 'go' }, +} + +vim.lsp.config['rust_analyzer'] = { + cmd = { 'rust-analyzer' }, + root_markers = { 'Cargo.toml' }, + filetypes = { 'rs' }, +} + +vim.lsp.enable('ccls') +vim.lsp.enable('gopls') +vim.lsp.enable('rust_analyzer') |