final settings
parent
e5843d4ca4
commit
6fae3ec8ac
4
init.lua
4
init.lua
|
@ -40,6 +40,7 @@ P.S. You can delete this when you're done too. It's your config now :)
|
||||||
-- Set <space> as the leader key
|
-- Set <space> as the leader key
|
||||||
-- See `:help mapleader`
|
-- See `:help mapleader`
|
||||||
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
|
||||||
|
vim.cmd([[source ~/repos/nvim-kickstart/lua/custom/vimrc]])
|
||||||
vim.g.mapleader = ' '
|
vim.g.mapleader = ' '
|
||||||
vim.g.maplocalleader = ' '
|
vim.g.maplocalleader = ' '
|
||||||
|
|
||||||
|
@ -494,4 +495,5 @@ require('custom.startup')
|
||||||
require('custom.lua-line')
|
require('custom.lua-line')
|
||||||
require('custom.telescope')
|
require('custom.telescope')
|
||||||
require('custom.lspconfig')
|
require('custom.lspconfig')
|
||||||
vim.cmd([[source ~/repos/nvim-kickstart/lua/custom/vimrc]])
|
require('custom.lspsaga')
|
||||||
|
require('custom.nvim-cmp')
|
||||||
|
|
|
@ -47,8 +47,7 @@ keymap.set('n', '<leader>1', ':diffget LOCAL<CR>')
|
||||||
keymap.set('n', '<leader>2', ':diffget REMOTE<CR>')
|
keymap.set('n', '<leader>2', ':diffget REMOTE<CR>')
|
||||||
|
|
||||||
-- toggleterm
|
-- toggleterm
|
||||||
keymap.set('n', '<M-1>', '<cmd>ToggleTerm direction=horizontal<cr>', { silent = true })
|
keymap.set('n', '<M-3>', '<cmd>terminal<cr>', { silent = true })
|
||||||
keymap.set('n', '<M-2>', '<cmd>ToggleTerm direction=vertical<cr>', { silent = true })
|
|
||||||
|
|
||||||
-- vim-sneak
|
-- vim-sneak
|
||||||
keymap.set('n', 'f', '<Plug>Sneak_s', { silent = true })
|
keymap.set('n', 'f', '<Plug>Sneak_s', { silent = true })
|
||||||
|
|
|
@ -34,6 +34,19 @@ local on_attach = function(_, bufnr)
|
||||||
)
|
)
|
||||||
|
|
||||||
keymap.set("n", "<leader>o", "<cmd>LSoutlineToggle<CR>", opts) -- see outline on right hand side
|
keymap.set("n", "<leader>o", "<cmd>LSoutlineToggle<CR>", opts) -- see outline on right hand side
|
||||||
|
keymap.set("n", "K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts) -- show documentation for what is under cursor
|
||||||
|
|
||||||
|
|
||||||
|
-- LSP Saga
|
||||||
|
keymap.set("n", "gsd", "<cmd>Lspsaga peek_definition<CR>", opts) -- see definition and make edits in window
|
||||||
|
keymap.set("n", "<leader>rn", "<cmd>Lspsaga rename<CR>", opts) -- smart rename
|
||||||
|
keymap.set("n", "<leader>ca", "<cmd>Lspsaga code_action<CR>", opts) -- see available code actions
|
||||||
|
keymap.set("n", "<leader>en", "<cmd>Lspsaga diagnostic_jump_next<CR>") -- jump to next diagnostic in buffer
|
||||||
|
keymap.set("n", "K", "<cmd>Lspsaga hover_doc<CR>", opts) -- show documentation for what is under cursor
|
||||||
|
keymap.set("n", "<leader>eb", "<cmd>Lspsaga diagnostic_jump_prev<CR>") -- jump to previous diagnostic in buffer
|
||||||
|
keymap.set("n", "ge", "<cmd>Lspsaga show_line_diagnostics<CR>", opts) -- show diagnostics for line
|
||||||
|
keymap.set("n", "<leader>d", "<cmd>Lspsaga show_buf_diagnostics<CR>")
|
||||||
|
keymap.set("n", "<a-cr>", "<cmd>Lspsaga code_action<CR>", opts)
|
||||||
end
|
end
|
||||||
|
|
||||||
-- used to enable autocompletion (assign to every lsp server config)
|
-- used to enable autocompletion (assign to every lsp server config)
|
||||||
|
|
|
@ -0,0 +1,24 @@
|
||||||
|
-- import lspsaga safely
|
||||||
|
-- local saga_status, saga = pcall(require, "lspsaga")
|
||||||
|
-- if not saga_status then
|
||||||
|
-- return
|
||||||
|
-- end
|
||||||
|
require("lazy").setup({
|
||||||
|
"glepnir/lspsaga.nvim",
|
||||||
|
event = "BufRead",
|
||||||
|
config = function()
|
||||||
|
require("lspsaga").setup({})
|
||||||
|
end,
|
||||||
|
dependencies = { { "nvim-tree/nvim-web-devicons" } },
|
||||||
|
-- keybinds for navigation in lspsaga window
|
||||||
|
move_in_saga = { prev = "<C-k>", next = "<C-j>" },
|
||||||
|
-- use enter to open file with finder
|
||||||
|
finder_action_keys = {
|
||||||
|
open = "<CR>",
|
||||||
|
},
|
||||||
|
-- use enter to open file with definition preview
|
||||||
|
definition_action_keys = {
|
||||||
|
edit = "<CR>",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
-- import nvim-cmp plugin safely
|
||||||
|
local cmp_status, cmp = pcall(require, "cmp")
|
||||||
|
if not cmp_status then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- import luasnip plugin safely
|
||||||
|
local luasnip_status, luasnip = pcall(require, "luasnip")
|
||||||
|
if not luasnip_status then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- import lspkind plugin safely
|
||||||
|
local lspkind_status, lspkind = pcall(require, "lspkind")
|
||||||
|
if not lspkind_status then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
|
-- load vs-code like snippets from plugins (e.g. friendly-snippets)
|
||||||
|
require("luasnip/loaders/from_vscode").lazy_load()
|
||||||
|
|
||||||
|
vim.opt.completeopt = "menu,menuone,noselect"
|
||||||
|
|
||||||
|
cmp.setup({
|
||||||
|
snippet = {
|
||||||
|
expand = function(args)
|
||||||
|
luasnip.lsp_expand(args.body)
|
||||||
|
end,
|
||||||
|
},
|
||||||
|
|
||||||
|
window = {
|
||||||
|
completion = cmp.config.window.bordered(),
|
||||||
|
documentation = cmp.config.window.bordered(),
|
||||||
|
},
|
||||||
|
|
||||||
|
mapping = cmp.mapping.preset.insert({
|
||||||
|
["<C-k>"] = cmp.mapping.select_prev_item(), -- previous suggestion
|
||||||
|
["<C-j>"] = cmp.mapping.select_next_item(), -- next suggestion
|
||||||
|
["<C-b>"] = cmp.mapping.scroll_docs(-4),
|
||||||
|
["<C-f>"] = cmp.mapping.scroll_docs(4),
|
||||||
|
["<C-Space>"] = cmp.mapping.complete(), -- show completion suggestions
|
||||||
|
["<C-e>"] = cmp.mapping.abort(), -- close completion window
|
||||||
|
["<CR>"] = cmp.mapping.confirm({ select = true }),
|
||||||
|
}),
|
||||||
|
-- sources for autocompletion
|
||||||
|
sources = cmp.config.sources({
|
||||||
|
{ name = "nvim_lsp" }, -- lsp
|
||||||
|
{ name = "luasnip" }, -- snippets
|
||||||
|
{ name = "buffer", keyword_length = 5 }, -- text within current buffer
|
||||||
|
{ name = "path" }, -- file system paths
|
||||||
|
}),
|
||||||
|
-- configure lspkind for vs-code like icons
|
||||||
|
formatting = {
|
||||||
|
format = lspkind.cmp_format({
|
||||||
|
maxwidth = 150,
|
||||||
|
ellipsis_char = "...",
|
||||||
|
menu = {
|
||||||
|
buffer = "[buf]",
|
||||||
|
luasnip = "[lua]",
|
||||||
|
nvim_lsp = "[LSP]",
|
||||||
|
path = "[path]",
|
||||||
|
gh_issues = "[issues]",
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
},
|
||||||
|
|
||||||
|
experimental = {
|
||||||
|
ghost_text = true,
|
||||||
|
},
|
||||||
|
})
|
|
@ -8,10 +8,43 @@ return {
|
||||||
-- -- commenting with gc
|
-- -- commenting with gc
|
||||||
"numToStr/Comment.nvim",
|
"numToStr/Comment.nvim",
|
||||||
|
|
||||||
|
"justinmk/vim-sneak",
|
||||||
"arkav/lualine-lsp-progress",
|
"arkav/lualine-lsp-progress",
|
||||||
"christoomey/vim-tmux-navigator", -- tmux & split window navigation
|
|
||||||
|
-- tmux & split window navigation
|
||||||
|
"christoomey/vim-tmux-navigator",
|
||||||
|
|
||||||
|
|
||||||
"nvim-telescope/telescope-project.nvim",
|
"nvim-telescope/telescope-project.nvim",
|
||||||
|
|
||||||
|
-- vs-code like icons for autocompletion
|
||||||
|
"onsails/lspkind.nvim",
|
||||||
"catppuccin/nvim",
|
"catppuccin/nvim",
|
||||||
as = "catppuccin",
|
as = "catppuccin",
|
||||||
{ "startup-nvim/startup.nvim", dependencies = "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" },
|
{ "startup-nvim/startup.nvim", dependencies = "nvim-telescope/telescope.nvim", "nvim-lua/plenary.nvim" },
|
||||||
|
|
||||||
|
{
|
||||||
|
"glepnir/lspsaga.nvim",
|
||||||
|
event = "BufRead",
|
||||||
|
config = function()
|
||||||
|
require("lspsaga").setup({})
|
||||||
|
end,
|
||||||
|
dependencies = {
|
||||||
|
{ "nvim-tree/nvim-web-devicons" },
|
||||||
|
--Please make sure you install markdown and markdown_inline parser
|
||||||
|
{ "nvim-treesitter/nvim-treesitter" },
|
||||||
|
},
|
||||||
|
},
|
||||||
|
|
||||||
|
-- Debugger
|
||||||
|
"mfussenegger/nvim-dap",
|
||||||
|
{
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
dependencies = "mfussenegger/nvim-dap",
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"theHamsta/nvim-dap-virtual-text",
|
||||||
|
dependencies = "mfussenegger/nvim-dap",
|
||||||
|
},
|
||||||
|
"nvim-telescope/telescope-dap.nvim",
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ nnoremap <C-H> <C-W><C-H>
|
||||||
|
|
||||||
nnoremap <C-d> <C-d>zz
|
nnoremap <C-d> <C-d>zz
|
||||||
nnoremap <C-u> <C-u>zz
|
nnoremap <C-u> <C-u>zz
|
||||||
|
tnoremap <Esc> <C-\><C-n>
|
||||||
|
|
||||||
" nnoremap <C-F> :Rg<CR>
|
" nnoremap <C-F> :Rg<CR>
|
||||||
" nnoremap <C-p> :Files<CR>
|
" nnoremap <C-p> :Files<CR>
|
||||||
|
|
Loading…
Reference in New Issue