moved config to personal forge
This commit is contained in:
commit
99280dd226
23 changed files with 323 additions and 0 deletions
3
after/ftplugin/go.lua
Normal file
3
after/ftplugin/go.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
vim.opt_local.shiftwidth = 4
|
||||
vim.opt_local.tabstop = 4
|
||||
vim.opt_local.expandtab = false
|
3
after/ftplugin/html.lua
Normal file
3
after/ftplugin/html.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.expandtab = true
|
3
after/ftplugin/lua.lua
Normal file
3
after/ftplugin/lua.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.expandtab = true
|
2
after/ftplugin/markdown.lua
Normal file
2
after/ftplugin/markdown.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
vim.opt_local.spell = true
|
||||
vim.opt_local.textwidth = 79
|
3
after/ftplugin/nix.lua
Normal file
3
after/ftplugin/nix.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.expandtab = true
|
3
after/ftplugin/sh.lua
Normal file
3
after/ftplugin/sh.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
vim.opt_local.shiftwidth = 2
|
||||
vim.opt_local.tabstop = 2
|
||||
vim.opt_local.expandtab = true
|
2
after/ftplugin/text.lua
Normal file
2
after/ftplugin/text.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
vim.opt_local.spell = true
|
||||
vim.opt_local.textwidth = 79
|
1
init.lua
Normal file
1
init.lua
Normal file
|
@ -0,0 +1 @@
|
|||
require("custom.lazy")
|
20
lazy-lock.json
Normal file
20
lazy-lock.json
Normal file
|
@ -0,0 +1,20 @@
|
|||
{
|
||||
"LuaSnip": { "branch": "master", "commit": "787dee55ca364cc9119787165418fe93b74c1842" },
|
||||
"cmp-buffer": { "branch": "main", "commit": "3022dbc9166796b644a841a02de8dd1cc1d311fa" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
|
||||
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "cf8ecc2c5e4332760431a33534240b0cbc6680ab" },
|
||||
"mini.nvim": { "branch": "main", "commit": "77533e69cc4fadb7f4c25f23255ae0890a058818" },
|
||||
"neovim": { "branch": "main", "commit": "07a887a7bef4aacea8c7caebaf8cbf808cdc7a8e" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "29fb4854573355792df9e156cb779f0d31308796" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "28b205ebe73a18f401e040585106f9bafd8ff21f" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "48fc5d1dfe3dded8028826dfee7526e26212c73b" },
|
||||
"nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" },
|
||||
"oil.nvim": { "branch": "master", "commit": "cca1631d5ea450c09ba72f3951a9e28105a3632c" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
|
||||
"undotree": { "branch": "master", "commit": "78b5241191852ffa9bb5da5ff2ee033160798c3b" },
|
||||
"zen-mode.nvim": { "branch": "main", "commit": "29b292bdc58b76a6c8f294c961a8bf92c5a6ebd6" }
|
||||
}
|
20
lua/custom/lazy.lua
Normal file
20
lua/custom/lazy.lua
Normal file
|
@ -0,0 +1,20 @@
|
|||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = " "
|
||||
|
||||
local lazypath = vim.fn.stdpath "data" .. "/lazy/lazy.nvim"
|
||||
if not vim.uv.fs_stat(lazypath) then
|
||||
vim.fn.system {
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"--branch=stable",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
lazypath,
|
||||
}
|
||||
end
|
||||
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({ import = "custom/plugins" }, {
|
||||
change_detection = { notify = false },
|
||||
})
|
46
lua/custom/plugins/cmp.lua
Normal file
46
lua/custom/plugins/cmp.lua
Normal file
|
@ -0,0 +1,46 @@
|
|||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
},
|
||||
lazy = false,
|
||||
config = function()
|
||||
vim.opt.completeopt = { "menu", "menuone", "noselect" }
|
||||
vim.opt.shortmess:append("c")
|
||||
|
||||
local cmp = require("cmp")
|
||||
|
||||
cmp.setup({
|
||||
preselect = cmp.PreselectMode.Item,
|
||||
|
||||
sources = {
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "path" },
|
||||
{ name = "buffer" },
|
||||
},
|
||||
|
||||
mapping = {
|
||||
["<C-n>"] = cmp.mapping.select_next_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-p>"] = cmp.mapping.select_prev_item({ behavior = cmp.SelectBehavior.Insert }),
|
||||
["<C-y>"] = cmp.mapping.confirm({
|
||||
behavior = cmp.SelectBehavior.Insert,
|
||||
select = true,
|
||||
}),
|
||||
["<Tab>"] = nil,
|
||||
["<S-Tab>"] = nil,
|
||||
["<CR>"] = nil,
|
||||
},
|
||||
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
vim.snippet.expand(args.body)
|
||||
end,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
15
lua/custom/plugins/colorscheme.lua
Normal file
15
lua/custom/plugins/colorscheme.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
"rose-pine/neovim",
|
||||
config = function()
|
||||
require("rose-pine").setup({
|
||||
dim_inactive_windows = true,
|
||||
styles = {
|
||||
bold = true,
|
||||
italic = false,
|
||||
transparency = true,
|
||||
},
|
||||
})
|
||||
|
||||
vim.cmd("colorscheme rose-pine")
|
||||
end,
|
||||
}
|
34
lua/custom/plugins/lsp.lua
Normal file
34
lua/custom/plugins/lsp.lua
Normal file
|
@ -0,0 +1,34 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
config = function()
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities(vim.lsp.protocol.make_client_capabilities())
|
||||
|
||||
local on_attach = function(client, bufnr)
|
||||
local opts = { buffer = bufnr, noremap = true, silent = true }
|
||||
|
||||
if client.server_capabilities.inlayHintProvider then
|
||||
vim.lsp.inlay_hint.enable(true)
|
||||
end
|
||||
|
||||
vim.diagnostic.config({ virtual_text = true })
|
||||
|
||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
|
||||
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
|
||||
end
|
||||
|
||||
local lspc = require("lspconfig")
|
||||
local servers = {
|
||||
"nixd",
|
||||
"pylsp",
|
||||
"clangd",
|
||||
"gopls",
|
||||
"rust_analyzer",
|
||||
"ocamllsp",
|
||||
}
|
||||
|
||||
for _, s in ipairs(servers) do
|
||||
lspc[s].setup({ on_attach = on_attach, capabilities = capabilities })
|
||||
end
|
||||
end,
|
||||
}
|
7
lua/custom/plugins/mini.lua
Normal file
7
lua/custom/plugins/mini.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
"echasnovski/mini.nvim",
|
||||
config = function()
|
||||
require("mini.ai").setup()
|
||||
require("mini.surround").setup()
|
||||
end,
|
||||
}
|
15
lua/custom/plugins/oil.lua
Normal file
15
lua/custom/plugins/oil.lua
Normal file
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
'stevearc/oil.nvim',
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
require("oil").setup({
|
||||
default_file_explorer = true,
|
||||
skip_confirm_for_simple_edits = true,
|
||||
view_options = {
|
||||
show_hidden = true,
|
||||
},
|
||||
})
|
||||
|
||||
vim.keymap.set("n", "-", "<CMD>Oil<CR>", { desc = "Open parent directory" })
|
||||
end,
|
||||
}
|
7
lua/custom/plugins/pairs.lua
Normal file
7
lua/custom/plugins/pairs.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
return {
|
||||
"windwp/nvim-autopairs",
|
||||
event = "InsertEnter",
|
||||
config = function()
|
||||
require("nvim-autopairs").setup({ map_c_h = true })
|
||||
end,
|
||||
}
|
17
lua/custom/plugins/telescope.lua
Normal file
17
lua/custom/plugins/telescope.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
tag = "0.1.8",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
config = function()
|
||||
require("telescope").setup({})
|
||||
|
||||
local builtin = require("telescope.builtin")
|
||||
vim.keymap.set("n", "<leader>sf", builtin.find_files, { desc = "[s]earch [f]iles" })
|
||||
vim.keymap.set("n", "<leader>sg", builtin.live_grep, { desc = "[s]earch by [g]rep" })
|
||||
vim.keymap.set("n", "<leader>sw", builtin.grep_string, { desc = "[s]earch current [w]ord" })
|
||||
vim.keymap.set("n", "<leader>sb", builtin.buffers, { desc = "[s]earch [b]uffers" })
|
||||
vim.keymap.set("n", "<leader>sh", builtin.help_tags, { desc = "[s]earch [h]elp" })
|
||||
end,
|
||||
}
|
17
lua/custom/plugins/treesitter.lua
Normal file
17
lua/custom/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
build = ":TSUpdate",
|
||||
lazy = false,
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = { "nix", "lua", "bash" },
|
||||
auto_install = true,
|
||||
sync_install = false,
|
||||
indent = { enable = true },
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
6
lua/custom/plugins/undotree.lua
Normal file
6
lua/custom/plugins/undotree.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
"mbbill/undotree",
|
||||
config = function()
|
||||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||||
end,
|
||||
}
|
30
lua/custom/plugins/zenmode.lua
Normal file
30
lua/custom/plugins/zenmode.lua
Normal file
|
@ -0,0 +1,30 @@
|
|||
return {
|
||||
"folke/zen-mode.nvim",
|
||||
config = function()
|
||||
vim.keymap.set("n", "<leader>zz", function()
|
||||
require("zen-mode").setup({
|
||||
window = {
|
||||
width = 80,
|
||||
options = {
|
||||
signcolumn = "no",
|
||||
number = false,
|
||||
relativenumber = false,
|
||||
wrap = true,
|
||||
linebreak = true,
|
||||
cursorline = false,
|
||||
colorcolumn = "0",
|
||||
},
|
||||
},
|
||||
plugins = {
|
||||
gitsigns = { enabled = false },
|
||||
options = {
|
||||
enabled = true,
|
||||
ruler = false,
|
||||
showcmd = false,
|
||||
},
|
||||
},
|
||||
})
|
||||
require("zen-mode").toggle()
|
||||
end)
|
||||
end,
|
||||
}
|
13
plugin/autocmd.lua
Normal file
13
plugin/autocmd.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
local autocmd = vim.api.nvim_create_autocmd
|
||||
|
||||
autocmd({ "TextYankPost" }, {
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.highlight.on_yank({
|
||||
higroup = "IncSearch",
|
||||
timeout = 50,
|
||||
})
|
||||
end,
|
||||
})
|
||||
|
||||
autocmd({ "BufWritePre" }, { pattern = "*", command = [[%s/\s\+$//e]] })
|
19
plugin/keymaps.lua
Normal file
19
plugin/keymaps.lua
Normal file
|
@ -0,0 +1,19 @@
|
|||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
vim.keymap.set("n", "J", "mzJ`z")
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "K", ":m '>-2<CR>gv=gv")
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
vim.keymap.set({ "n", "v" }, "<leader>d", [["_d]])
|
||||
vim.keymap.set("n", "<leader>f", vim.lsp.buf.format)
|
||||
vim.keymap.set("x", "<leader>p", [["_dP]])
|
||||
vim.keymap.set("n", "<leader>hh", ":help<Space>")
|
||||
vim.keymap.set("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])
|
||||
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
|
||||
vim.keymap.set({ "n", "v" }, "<leader>y", [["+y]])
|
||||
vim.keymap.set("n", "<leader>Y", [["+Y]])
|
||||
vim.keymap.set("n", "<up>", "<C-w><up>")
|
||||
vim.keymap.set("n", "<down>", "<C-w><down>")
|
||||
vim.keymap.set("n", "<left>", "<C-w><left>")
|
||||
vim.keymap.set("n", "<right>", "<C-w><right>")
|
37
plugin/options.lua
Normal file
37
plugin/options.lua
Normal file
|
@ -0,0 +1,37 @@
|
|||
vim.opt.showcmd = true
|
||||
vim.opt.scrolloff = 8
|
||||
vim.opt.updatetime = 50
|
||||
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.smartindent = true
|
||||
|
||||
vim.opt.wrap = false
|
||||
vim.opt.linebreak = false
|
||||
|
||||
vim.opt.smartcase = true
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.incsearch = true
|
||||
|
||||
vim.opt.foldmethod = "syntax"
|
||||
vim.opt.foldlevel = 99
|
||||
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.opt.colorcolumn = "80"
|
||||
vim.opt.cursorline = true
|
||||
vim.opt.cursorlineopt = "number"
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.isfname:append("@-@")
|
||||
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.backup = false
|
||||
vim.opt.undofile = true
|
||||
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||
|
||||
vim.opt.mouse = "va"
|
Loading…
Reference in a new issue