Improved neovim config
This commit is contained in:
parent
d07a82fff2
commit
2ad93d9338
@ -5,11 +5,15 @@
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "749267aaa863c30d721c9913699c5d94e0c07dd3" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" },
|
||||
"noice.nvim": { "branch": "main", "commit": "894db25ec726d32047799d4d0a982b701bec453b" },
|
||||
"nui.nvim": { "branch": "main", "commit": "9e3916e784660f55f47daa6f26053ad044db5d6a" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "51f1e11a89ec701221877532ee1a23557d291dd5" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "67f151e84daddc86cc65f5d935e592f76b9f4496" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "dea82ae2071a8d6412ca31e8fc48da5accad1a1d" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "8fa7ce35afe88b8294e6ced757aa14ec98414568" },
|
||||
"nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
|
||||
"nvim-tree.lua": { "branch": "master", "commit": "920868dba13466586897a8f40220eca6b2caac41" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "a185f8ebae9006b181e83f6569df68e7ff8aeb80" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" },
|
||||
"nvterm": { "branch": "main", "commit": "5ae78fb332e92447121d2af58a6313189a7799fb" },
|
||||
"onedark.nvim": { "branch": "master", "commit": "09b71d84bd2524438e48c0aa5b54d855cc72af32" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "2d92125620417fbea82ec30303823e3cd69e90e8" }
|
||||
|
@ -18,7 +18,7 @@ require("lazy").setup("plugins", {
|
||||
lazy = true,
|
||||
},
|
||||
change_detection = {
|
||||
notify = false,
|
||||
notify = false
|
||||
},
|
||||
performance = {
|
||||
rtp = {
|
||||
|
@ -5,3 +5,16 @@ on("VimEnter", {
|
||||
require("nvim-tree.api").tree.toggle({ focus = false })
|
||||
end,
|
||||
})
|
||||
|
||||
on({ "TermOpen", "TermEnter" }, {
|
||||
callback = function()
|
||||
vim.wo.signcolumn = "no"
|
||||
end,
|
||||
})
|
||||
|
||||
on({ "BufNewFile", "BufRead" }, {
|
||||
pattern = { "*.txt", "*.md" },
|
||||
callback = function()
|
||||
vim.lo.wrap = true
|
||||
end,
|
||||
})
|
||||
|
@ -1,25 +1,29 @@
|
||||
local map = vim.keymap.set
|
||||
local map = function(mode, lhs, rhs, info)
|
||||
vim.keymap.set(mode, lhs, rhs, { desc = info })
|
||||
end
|
||||
|
||||
-- Normal mode
|
||||
map("n", "<C-n>", "<cmd>enew<cr>", { desc = "New File" })
|
||||
map("n", "<C-b>", "<cmd>NvimTreeToggle<cr>", { desc = "Toggle file explorer" })
|
||||
map("n", "<C-q>", "<cmd>qa<cr>", { desc = "Quit all" })
|
||||
map("n", "<leader>l", "<cmd>Lazy<cr>", { desc = "Lazy" })
|
||||
map("n", "<leader>f", "<cmd>Telescope find_files<cr>", { desc = "Find files" })
|
||||
map("n", "<leader>r", "<cmd>Telescope oldfiles<cr>", { desc = "Recent files" })
|
||||
map("n", "<leader>s", "<cmd>Telescope symbols<cr>", { desc = "Symbols" })
|
||||
map("n", "<leader>cf", vim.lsp.buf.format, { desc = "Format" })
|
||||
map("n", "gd", vim.lsp.buf.definition, { desc = "Go to definition" })
|
||||
map("n", "gr", vim.lsp.buf.references, { desc = "Go to references" })
|
||||
-- Basics
|
||||
map("n", "<C-n>", "<cmd>enew<cr>", "New File")
|
||||
map({ "i", "n", "s", "v" }, "<C-s>", "<cmd>w<cr><esc>", "Save file")
|
||||
map("n", "<C-q>", "<cmd>qa<cr>", "Quit all")
|
||||
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", "Clear search")
|
||||
|
||||
-- Visual mode
|
||||
-- Indenting
|
||||
map("v", "<", "<gv")
|
||||
map("v", ">", ">gv")
|
||||
|
||||
-- Mixed modes
|
||||
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", { desc = "Clear search" })
|
||||
map({ "i", "v", "n", "s" }, "<C-s>", "<cmd>w<cr><esc>", { desc = "Save file" })
|
||||
-- LSP
|
||||
map("n", "gd", vim.lsp.buf.definition, "Go to definition")
|
||||
map("n", "gr", vim.lsp.buf.references, "Go to references")
|
||||
map("n", "<leader>cf", vim.lsp.buf.format, "Format")
|
||||
|
||||
-- Toggle comment
|
||||
map("n", "<leader>/", "<cmd>lua require('Comment.api').toggle.linewise.current()<cr>", { desc = "Toggle comment" })
|
||||
map("v", "<leader>/", "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", { desc = "Toggle comment" })
|
||||
map("n", "<C-_>", "<cmd>lua require('Comment.api').toggle.linewise.current()<cr>", "Toggle comment")
|
||||
map("v", "<C-_>", "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", "Toggle comment")
|
||||
|
||||
-- Normal mode
|
||||
map("n", "<C-b>", "<cmd>NvimTreeToggle<cr>", "Toggle tree")
|
||||
map("n", "<leader>l", "<cmd>Lazy<cr>", "Lazy")
|
||||
map("n", "<leader>f", "<cmd>Telescope find_files<cr>", "Find files")
|
||||
map("n", "<leader>r", "<cmd>Telescope oldfiles<cr>", "Recent files")
|
||||
map({ "n", "t" }, "<A-i>", "<cmd>lua require('nvterm.terminal').toggle('float')<cr>", "Toggle terminal")
|
||||
|
@ -4,22 +4,34 @@ g.loaded_netrw = 1
|
||||
g.loaded_netrwPlugin = 1
|
||||
|
||||
local opt = vim.opt
|
||||
opt.autowrite = false
|
||||
opt.expandtab = false
|
||||
opt.shiftwidth = 4
|
||||
opt.tabstop = 4
|
||||
opt.softtabstop = 4
|
||||
opt.autoindent = true
|
||||
opt.smartindent = true
|
||||
opt.spell = false
|
||||
opt.autowrite = false
|
||||
opt.clipboard = "unnamedplus"
|
||||
opt.conceallevel = 0
|
||||
opt.ignorecase = false
|
||||
opt.number = true
|
||||
opt.relativenumber = false
|
||||
opt.cursorline = true
|
||||
opt.cursorlineopt = "both"
|
||||
opt.termguicolors = true
|
||||
opt.signcolumn = "yes"
|
||||
opt.expandtab = false
|
||||
opt.grepformat = "%f:%l:%c:%m"
|
||||
opt.grepprg = "rg --vimgrep"
|
||||
opt.ignorecase = false
|
||||
opt.laststatus = 0
|
||||
opt.showmode = false
|
||||
opt.mouse = "a"
|
||||
opt.number = true
|
||||
opt.relativenumber = false
|
||||
opt.ruler = false
|
||||
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
|
||||
opt.shiftwidth = 4
|
||||
opt.showmode = false
|
||||
opt.signcolumn = "yes"
|
||||
opt.smartindent = true
|
||||
opt.softtabstop = 4
|
||||
opt.spell = false
|
||||
opt.splitbelow = true
|
||||
opt.splitright = true
|
||||
opt.tabstop = 4
|
||||
opt.termguicolors = true
|
||||
opt.undofile = true
|
||||
opt.undolevels = 10000
|
||||
opt.updatetime = 250
|
||||
opt.wildmode = "longest:full,full"
|
||||
opt.wrap = false
|
||||
|
@ -1,9 +0,0 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
},
|
||||
}
|
24
.config/nvim/lua/plugins/cmp.lua
Normal file
24
.config/nvim/lua/plugins/cmp.lua
Normal file
@ -0,0 +1,24 @@
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
event = "InsertEnter",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
mapping = {
|
||||
["<C-space>"] = cmp.mapping.complete(),
|
||||
["<cr>"] = cmp.mapping.confirm({ select = true }),
|
||||
},
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
@ -1,13 +1,11 @@
|
||||
return {
|
||||
"numToStr/Comment.nvim",
|
||||
event = "VeryLazy",
|
||||
config = true,
|
||||
opts = {
|
||||
mappings = {
|
||||
basic = false,
|
||||
extra = false,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require("Comment").setup(opts)
|
||||
end,
|
||||
}
|
||||
|
@ -1,7 +1,5 @@
|
||||
return {
|
||||
"lewis6991/gitsigns.nvim",
|
||||
event = "BufReadPre",
|
||||
config = function()
|
||||
require("gitsigns").setup()
|
||||
end,
|
||||
config = true,
|
||||
}
|
||||
|
18
.config/nvim/lua/plugins/noice.lua
Normal file
18
.config/nvim/lua/plugins/noice.lua
Normal file
@ -0,0 +1,18 @@
|
||||
return {
|
||||
"folke/noice.nvim",
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"MunifTanjim/nui.nvim",
|
||||
"rcarriga/nvim-notify",
|
||||
},
|
||||
opts = {
|
||||
lsp = {
|
||||
override = {
|
||||
["vim.lsp.util.convert_input_to_markdown_lines"] = true,
|
||||
["vim.lsp.util.stylize_markdown"] = true,
|
||||
["cmp.entry.get_documentation"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
config = true,
|
||||
}
|
13
.config/nvim/lua/plugins/telescope-browser.lua
Normal file
13
.config/nvim/lua/plugins/telescope-browser.lua
Normal file
@ -0,0 +1,13 @@
|
||||
return {
|
||||
"nvim-telescope/telescope-file-browser.nvim",
|
||||
enabled = false,
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
"nvim-lua/plenary.nvim"
|
||||
},
|
||||
config = function()
|
||||
require("telescope").load_extension("file_browser")
|
||||
vim.keymap.set("n", "<leader>fb", "<cmd>Telescope file_browser<cr>", "File browser")
|
||||
end,
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
event = "VeryLazy",
|
||||
config = true,
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim"
|
||||
},
|
||||
|
5
.config/nvim/lua/plugins/term.lua
Normal file
5
.config/nvim/lua/plugins/term.lua
Normal file
@ -0,0 +1,5 @@
|
||||
return {
|
||||
"NvChad/nvterm",
|
||||
event = "VeryLazy",
|
||||
config = true,
|
||||
}
|
@ -1,7 +1,14 @@
|
||||
return {
|
||||
"navarasu/onedark.nvim",
|
||||
event = "VeryLazy",
|
||||
config = function()
|
||||
require('onedark').load()
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
opts = {
|
||||
style = "dark",
|
||||
transparent = false,
|
||||
},
|
||||
config = function(_, opts)
|
||||
local theme = require("onedark")
|
||||
theme.setup(opts)
|
||||
theme.load()
|
||||
end,
|
||||
}
|
||||
|
@ -3,7 +3,6 @@ return {
|
||||
event = "VeryLazy",
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
"navarasu/onedark.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("nvim-tree").setup({
|
||||
|
Loading…
Reference in New Issue
Block a user