Improved neovim config
This commit is contained in:
parent
2ad93d9338
commit
ce110d730e
@ -1,4 +1,4 @@
|
|||||||
require("config.settings")
|
require("config.settings")
|
||||||
require("config.keys")
|
|
||||||
require("boot")
|
require("boot")
|
||||||
|
require("config.keys")
|
||||||
require("config.autocmds")
|
require("config.autocmds")
|
||||||
|
@ -3,18 +3,22 @@
|
|||||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||||
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
"cmp-nvim-lsp": { "branch": "main", "commit": "44b16d11215dce86f253ce0c30949813c0a90765" },
|
||||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||||
|
"flash.nvim": { "branch": "main", "commit": "967117690bd677cb7b6a87f0bc0077d2c0be3a27" },
|
||||||
"gitsigns.nvim": { "branch": "main", "commit": "749267aaa863c30d721c9913699c5d94e0c07dd3" },
|
"gitsigns.nvim": { "branch": "main", "commit": "749267aaa863c30d721c9913699c5d94e0c07dd3" },
|
||||||
"lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" },
|
"lazy.nvim": { "branch": "main", "commit": "dac844ed617dda4f9ec85eb88e9629ad2add5e05" },
|
||||||
|
"neodev.nvim": { "branch": "main", "commit": "e9bc652e22f9cd1892630bf019db363ac403ee39" },
|
||||||
"noice.nvim": { "branch": "main", "commit": "894db25ec726d32047799d4d0a982b701bec453b" },
|
"noice.nvim": { "branch": "main", "commit": "894db25ec726d32047799d4d0a982b701bec453b" },
|
||||||
"nui.nvim": { "branch": "main", "commit": "9e3916e784660f55f47daa6f26053ad044db5d6a" },
|
"nui.nvim": { "branch": "main", "commit": "9e3916e784660f55f47daa6f26053ad044db5d6a" },
|
||||||
"nvim-cmp": { "branch": "main", "commit": "51f1e11a89ec701221877532ee1a23557d291dd5" },
|
"nvim-cmp": { "branch": "main", "commit": "51f1e11a89ec701221877532ee1a23557d291dd5" },
|
||||||
"nvim-lspconfig": { "branch": "master", "commit": "67f151e84daddc86cc65f5d935e592f76b9f4496" },
|
"nvim-lspconfig": { "branch": "master", "commit": "67f151e84daddc86cc65f5d935e592f76b9f4496" },
|
||||||
"nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
|
"nvim-notify": { "branch": "master", "commit": "ea9c8ce7a37f2238f934e087c255758659948e0f" },
|
||||||
|
"nvim-spectre": { "branch": "master", "commit": "eb17a856a6f17e03d8d610cbc00cd9f2f39e3fd7" },
|
||||||
"nvim-tree.lua": { "branch": "master", "commit": "920868dba13466586897a8f40220eca6b2caac41" },
|
"nvim-tree.lua": { "branch": "master", "commit": "920868dba13466586897a8f40220eca6b2caac41" },
|
||||||
"nvim-treesitter": { "branch": "master", "commit": "a185f8ebae9006b181e83f6569df68e7ff8aeb80" },
|
"nvim-treesitter": { "branch": "master", "commit": "7c935d6bd5ecb36e7c6cf6678e1eaa38b85111f3" },
|
||||||
"nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" },
|
"nvim-web-devicons": { "branch": "master", "commit": "cfc8824cc1db316a276b36517f093baccb8e799a" },
|
||||||
"nvterm": { "branch": "main", "commit": "5ae78fb332e92447121d2af58a6313189a7799fb" },
|
"nvterm": { "branch": "main", "commit": "5ae78fb332e92447121d2af58a6313189a7799fb" },
|
||||||
"onedark.nvim": { "branch": "master", "commit": "09b71d84bd2524438e48c0aa5b54d855cc72af32" },
|
"onedark.nvim": { "branch": "master", "commit": "09b71d84bd2524438e48c0aa5b54d855cc72af32" },
|
||||||
"plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" },
|
"plenary.nvim": { "branch": "master", "commit": "267282a9ce242bbb0c5dc31445b6d353bed978bb" },
|
||||||
|
"telescope-project.nvim": { "branch": "master", "commit": "7c64b181dd4e72deddcf6f319e3bf1e95b2a2f30" },
|
||||||
"telescope.nvim": { "branch": "master", "commit": "2d92125620417fbea82ec30303823e3cd69e90e8" }
|
"telescope.nvim": { "branch": "master", "commit": "2d92125620417fbea82ec30303823e3cd69e90e8" }
|
||||||
}
|
}
|
@ -1,4 +1,3 @@
|
|||||||
-- Bootstrap lazy.nvim
|
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
vim.fn.system({
|
vim.fn.system({
|
||||||
@ -12,7 +11,6 @@ if not vim.loop.fs_stat(lazypath) then
|
|||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
-- Setup package manager
|
|
||||||
require("lazy").setup("plugins", {
|
require("lazy").setup("plugins", {
|
||||||
defaults = {
|
defaults = {
|
||||||
lazy = true,
|
lazy = true,
|
||||||
@ -23,12 +21,33 @@ require("lazy").setup("plugins", {
|
|||||||
performance = {
|
performance = {
|
||||||
rtp = {
|
rtp = {
|
||||||
disabled_plugins = {
|
disabled_plugins = {
|
||||||
"gzip",
|
"2html_plugin",
|
||||||
"netrwPlugin",
|
|
||||||
"tarPlugin",
|
|
||||||
"tohtml",
|
"tohtml",
|
||||||
"tutor",
|
"getscript",
|
||||||
|
"getscriptPlugin",
|
||||||
|
"gzip",
|
||||||
|
"logipat",
|
||||||
|
"netrw",
|
||||||
|
"netrwPlugin",
|
||||||
|
"netrwSettings",
|
||||||
|
"netrwFileHandlers",
|
||||||
|
"matchit",
|
||||||
|
"tar",
|
||||||
|
"tarPlugin",
|
||||||
|
"rrhelper",
|
||||||
|
"spellfile_plugin",
|
||||||
|
"vimball",
|
||||||
|
"vimballPlugin",
|
||||||
|
"zip",
|
||||||
"zipPlugin",
|
"zipPlugin",
|
||||||
|
"tutor",
|
||||||
|
"rplugin",
|
||||||
|
"syntax",
|
||||||
|
"synmenu",
|
||||||
|
"optwin",
|
||||||
|
"compiler",
|
||||||
|
"bugreport",
|
||||||
|
"ftplugin",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -3,10 +3,16 @@ local map = function(mode, lhs, rhs, info)
|
|||||||
end
|
end
|
||||||
|
|
||||||
-- Basics
|
-- Basics
|
||||||
map("n", "<C-n>", "<cmd>enew<cr>", "New File")
|
map("n", ";", ":", "Command mode")
|
||||||
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")
|
map({ "i", "n" }, "<esc>", "<cmd>noh<cr><esc>", "Clear search")
|
||||||
|
map({ "i", "n", "s", "v" }, "<C-s>", "<cmd>w<cr><esc>", "Save file")
|
||||||
|
map("n", "U", "<cmd>redo<cr>", "Redo")
|
||||||
|
map("n", "<C-n>", "<cmd>enew<cr>", "New File")
|
||||||
|
map("n", "<C-r>", ":%s/<C-R><C-W>//g<Left><Left>", "Replace word under cursor")
|
||||||
|
map("n", "<C-q>", "<cmd>qa<cr>", "Quit all")
|
||||||
|
map({"n", "v"}, "<C-b>", "^", "Beginning of line")
|
||||||
|
map("i", "<C-b>", "<esc>^i", "Beginning of line")
|
||||||
|
map({"i", "n", "v"}, "<C-e>", "<end>", "End of line")
|
||||||
|
|
||||||
-- Indenting
|
-- Indenting
|
||||||
map("v", "<", "<gv")
|
map("v", "<", "<gv")
|
||||||
@ -17,13 +23,6 @@ map("n", "gd", vim.lsp.buf.definition, "Go to definition")
|
|||||||
map("n", "gr", vim.lsp.buf.references, "Go to references")
|
map("n", "gr", vim.lsp.buf.references, "Go to references")
|
||||||
map("n", "<leader>cf", vim.lsp.buf.format, "Format")
|
map("n", "<leader>cf", vim.lsp.buf.format, "Format")
|
||||||
|
|
||||||
-- Toggle comment
|
-- Plugins
|
||||||
map("n", "<C-_>", "<cmd>lua require('Comment.api').toggle.linewise.current()<cr>", "Toggle comment")
|
map("n", "<leader>t", "<cmd>NvimTreeToggle<cr>", "Toggle tree")
|
||||||
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>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")
|
|
||||||
|
@ -1,8 +1,12 @@
|
|||||||
|
-- Globals
|
||||||
local g = vim.g
|
local g = vim.g
|
||||||
g.mapleader = " "
|
g.mapleader = " "
|
||||||
g.loaded_netrw = 1
|
|
||||||
g.loaded_netrwPlugin = 1
|
|
||||||
|
|
||||||
|
for _, provider in ipairs { "node", "perl", "python3", "ruby" } do
|
||||||
|
g["loaded_" .. provider .. "_provider"] = 0
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Options
|
||||||
local opt = vim.opt
|
local opt = vim.opt
|
||||||
opt.autoindent = true
|
opt.autoindent = true
|
||||||
opt.autowrite = false
|
opt.autowrite = false
|
||||||
@ -16,13 +20,11 @@ opt.grepprg = "rg --vimgrep"
|
|||||||
opt.ignorecase = false
|
opt.ignorecase = false
|
||||||
opt.laststatus = 0
|
opt.laststatus = 0
|
||||||
opt.mouse = "a"
|
opt.mouse = "a"
|
||||||
opt.number = true
|
|
||||||
opt.relativenumber = false
|
|
||||||
opt.ruler = false
|
opt.ruler = false
|
||||||
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
|
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize" }
|
||||||
opt.shiftwidth = 4
|
opt.shiftwidth = 4
|
||||||
|
opt.shortmess:append "sI"
|
||||||
opt.showmode = false
|
opt.showmode = false
|
||||||
opt.signcolumn = "yes"
|
|
||||||
opt.smartindent = true
|
opt.smartindent = true
|
||||||
opt.softtabstop = 4
|
opt.softtabstop = 4
|
||||||
opt.spell = false
|
opt.spell = false
|
||||||
@ -35,3 +37,9 @@ opt.undolevels = 10000
|
|||||||
opt.updatetime = 250
|
opt.updatetime = 250
|
||||||
opt.wildmode = "longest:full,full"
|
opt.wildmode = "longest:full,full"
|
||||||
opt.wrap = false
|
opt.wrap = false
|
||||||
|
|
||||||
|
-- UI
|
||||||
|
opt.fillchars = { eob = " ", vert = " " }
|
||||||
|
opt.number = true
|
||||||
|
opt.relativenumber = false
|
||||||
|
opt.signcolumn = "yes:1"
|
||||||
|
@ -1,6 +1,9 @@
|
|||||||
return {
|
return {
|
||||||
"numToStr/Comment.nvim",
|
"numToStr/Comment.nvim",
|
||||||
event = "VeryLazy",
|
keys = {
|
||||||
|
{"<C-_>", "<cmd>lua require('Comment.api').toggle.linewise.current()<cr>", desc = "Toggle comment"},
|
||||||
|
{"<C-_>", "<esc><cmd>lua require('Comment.api').toggle.linewise(vim.fn.visualmode())<cr>", mode = "v", desc = "Toggle comment"},
|
||||||
|
},
|
||||||
config = true,
|
config = true,
|
||||||
opts = {
|
opts = {
|
||||||
mappings = {
|
mappings = {
|
||||||
|
7
.config/nvim/lua/plugins/flash.lua
Normal file
7
.config/nvim/lua/plugins/flash.lua
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
return {
|
||||||
|
"folke/flash.nvim",
|
||||||
|
keys = {
|
||||||
|
{ "s", function() require("flash").jump() end, mode = { "n", "x", "o" }, desc = "Flash" },
|
||||||
|
{ "S", function() require("flash").treesitter() end, mode = { "n", "o", "x" }, desc = "Flash Treesitter" },
|
||||||
|
},
|
||||||
|
}
|
@ -1,24 +1,49 @@
|
|||||||
return {
|
return {
|
||||||
"neovim/nvim-lspconfig",
|
"neovim/nvim-lspconfig",
|
||||||
event = { "BufReadPre", "BufNewFile" },
|
event = { "BufReadPre", "BufNewFile" },
|
||||||
opts = {
|
dependencies = {
|
||||||
servers = {
|
"folke/neodev.nvim",
|
||||||
lua_ls = {},
|
},
|
||||||
gopls = {},
|
opts = {
|
||||||
|
servers = {
|
||||||
-- web dev
|
gopls = {},
|
||||||
--cssls = {},
|
lua_ls = {
|
||||||
--html = {},
|
settings = {
|
||||||
--jsonls = {},
|
Lua = {
|
||||||
--tsserver = {},
|
workspace = {
|
||||||
--svelte = {},
|
checkThirdParty = false,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
--cssls = {},
|
||||||
|
--html = {},
|
||||||
|
--jsonls = {},
|
||||||
|
--tsserver = {},
|
||||||
|
--svelte = {},
|
||||||
},
|
},
|
||||||
config = function(_, opts)
|
},
|
||||||
local servers = opts.servers
|
config = function(_, opts)
|
||||||
|
require("neodev").setup()
|
||||||
|
|
||||||
for server, server_opts in pairs(servers) do
|
-- Servers
|
||||||
require("lspconfig")[server].setup(server_opts)
|
local servers = opts.servers
|
||||||
end
|
|
||||||
end,
|
for server, server_opts in pairs(servers) do
|
||||||
}
|
require("lspconfig")[server].setup(server_opts)
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Icons
|
||||||
|
local icons = {
|
||||||
|
Error = " ",
|
||||||
|
Warn = " ",
|
||||||
|
Hint = " ",
|
||||||
|
Info = " ",
|
||||||
|
}
|
||||||
|
|
||||||
|
for name, icon in pairs(icons) do
|
||||||
|
name = "DiagnosticSign" .. name
|
||||||
|
vim.fn.sign_define(name, { text = icon, texthl = name, numhl = "" })
|
||||||
|
end
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
7
.config/nvim/lua/plugins/nvterm.lua
Normal file
7
.config/nvim/lua/plugins/nvterm.lua
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
return {
|
||||||
|
"NvChad/nvterm",
|
||||||
|
keys = {
|
||||||
|
{ "<A-i>", "<cmd>lua require('nvterm.terminal').toggle('float')<cr>", mode = { "n", "t" }, desc = "Toggle terminal" },
|
||||||
|
},
|
||||||
|
config = true,
|
||||||
|
}
|
7
.config/nvim/lua/plugins/spectre.lua
Normal file
7
.config/nvim/lua/plugins/spectre.lua
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
return {
|
||||||
|
"nvim-pack/nvim-spectre",
|
||||||
|
keys = {
|
||||||
|
{ "<leader>sr", function() require("spectre").open() end, desc = "Replace in files (Spectre)" },
|
||||||
|
},
|
||||||
|
config = true,
|
||||||
|
}
|
@ -1,13 +0,0 @@
|
|||||||
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,8 +1,27 @@
|
|||||||
return {
|
return {
|
||||||
"nvim-telescope/telescope.nvim",
|
"nvim-telescope/telescope.nvim",
|
||||||
event = "VeryLazy",
|
|
||||||
config = true,
|
|
||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-lua/plenary.nvim"
|
"nvim-lua/plenary.nvim",
|
||||||
|
"nvim-telescope/telescope-project.nvim",
|
||||||
},
|
},
|
||||||
|
keys = {
|
||||||
|
{"<leader>f", "<cmd>Telescope find_files<cr>", desc = "Find files"},
|
||||||
|
{"<leader>r", "<cmd>Telescope oldfiles<cr>", desc = "Recent files"},
|
||||||
|
{"<leader>p", "<cmd>Telescope project<cr>", desc = "Projects"},
|
||||||
|
},
|
||||||
|
config = function()
|
||||||
|
require("telescope").setup({
|
||||||
|
extensions = {
|
||||||
|
project = {
|
||||||
|
base_dirs = {
|
||||||
|
{ path = "~/projects", max_depth = 2 },
|
||||||
|
},
|
||||||
|
order_by = "desc",
|
||||||
|
sync_with_nvim_tree = true,
|
||||||
|
theme = "dropdown",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
|
require("telescope").load_extension("project")
|
||||||
|
end,
|
||||||
}
|
}
|
||||||
|
@ -1,5 +0,0 @@
|
|||||||
return {
|
|
||||||
"NvChad/nvterm",
|
|
||||||
event = "VeryLazy",
|
|
||||||
config = true,
|
|
||||||
}
|
|
@ -5,6 +5,7 @@ return {
|
|||||||
opts = {
|
opts = {
|
||||||
style = "dark",
|
style = "dark",
|
||||||
transparent = false,
|
transparent = false,
|
||||||
|
term_colors = true,
|
||||||
},
|
},
|
||||||
config = function(_, opts)
|
config = function(_, opts)
|
||||||
local theme = require("onedark")
|
local theme = require("onedark")
|
||||||
|
@ -4,14 +4,26 @@ return {
|
|||||||
dependencies = {
|
dependencies = {
|
||||||
"nvim-tree/nvim-web-devicons",
|
"nvim-tree/nvim-web-devicons",
|
||||||
},
|
},
|
||||||
config = function()
|
opts = {
|
||||||
require("nvim-tree").setup({
|
filesystem_watchers = {
|
||||||
view = {
|
enable = true,
|
||||||
width = 35,
|
},
|
||||||
},
|
filters = {
|
||||||
renderer = {
|
dotfiles = false,
|
||||||
root_folder_label = false
|
},
|
||||||
},
|
renderer = {
|
||||||
})
|
root_folder_label = false
|
||||||
|
},
|
||||||
|
sync_root_with_cwd = true,
|
||||||
|
update_focused_file = {
|
||||||
|
enable = true,
|
||||||
|
update_root = false,
|
||||||
|
},
|
||||||
|
view = {
|
||||||
|
width = 35,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
config = function(_, opts)
|
||||||
|
require("nvim-tree").setup(opts)
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user