summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--init.lua8
-rw-r--r--lazy-lock.json1
-rw-r--r--lua/config/lazy.lua3
-rw-r--r--lua/plugins/keybindings.lua40
-rw-r--r--lua/plugins/lspconfig.lua28
5 files changed, 72 insertions, 8 deletions
diff --git a/init.lua b/init.lua
index 5f2496e..aed4c35 100644
--- a/init.lua
+++ b/init.lua
@@ -1,6 +1,14 @@
require("config.lazy")
require("plugins.keybindings")
+require("plugins.lspconfig")
vim.cmd([[colorscheme gruvbox]])
+vim.cmd([[
+ augroup LSP_SignatureHelp
+ autocmd!
+ autocmd InsertCharPre,TextChanged * lua vim.lsp.buf.signature_help()
+ augroup end
+]])
+
vim.wo.relativenumber = true
vim.opt.clipboard = "unnamedplus"
diff --git a/lazy-lock.json b/lazy-lock.json
index ba149fd..245f528 100644
--- a/lazy-lock.json
+++ b/lazy-lock.json
@@ -1,5 +1,6 @@
{
"gruvbox.nvim": { "branch": "main", "commit": "00e38a379bab3389e187b3953566d67d494dfddd" },
"lazy.nvim": { "branch": "main", "commit": "6c3bda4aca61a13a9c63f1c1d1b16b9d3be90d7a" },
+ "nvim-lspconfig": { "branch": "master", "commit": "ac1dfbe3b60e5e23a2cff90e3bd6a3bc88031a57" },
"nvim-treesitter": { "branch": "master", "commit": "066fd6505377e3fd4aa219e61ce94c2b8bdb0b79" }
}
diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua
index d3c4443..e839f8f 100644
--- a/lua/config/lazy.lua
+++ b/lua/config/lazy.lua
@@ -42,6 +42,9 @@ require("lazy").setup({
end
},
{
+ "neovim/nvim-lspconfig"
+ },
+ {
"ellisonleao/gruvbox.nvim"
},
},
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')