36 files changed,
906 insertions(+),
0 deletions(-)
Author:
neoteny
ss2316544@gmail.com
Committed at:
2021-11-28 22:27:34 +0200
jump to
A
config/nvim/lua/disabled.lua
··· 1 +local disabled_built_ins = { 2 + "netrw", 3 + "netrwPlugin", 4 + "netrwSettings", 5 + "netrwFileHandlers", 6 + "gzip", 7 + "zip", 8 + "tohtml", 9 + "man", 10 + "zipPlugin", 11 + "tar", 12 + "tarPlugin", 13 + "getscript", 14 + "getscriptPlugin", 15 + "vimball", 16 + "vimballPlugin", 17 + "2html_plugin", 18 + "logipat", 19 + "rrhelper", 20 + "spellfile_plugin", 21 + "matchit", 22 +} 23 + 24 +for _, plugin in pairs(disabled_built_ins) do 25 + vim.g["loaded_" .. plugin] = 1 26 +end
A
config/nvim/lua/globals.lua
··· 1 +function _G.term_cmd(cmd) 2 + require("toggleterm.terminal").Terminal:new({ cmd = cmd, hidden = true }):toggle() 3 +end 4 + 5 +function _G.mkdir() 6 + local dir = vim.fn.expand "%:p:h" 7 + if vim.fn.isdirectory(dir) == 0 then 8 + vim.fn.mkdir(dir, "p") 9 + end 10 +end
A
config/nvim/lua/keymapings.lua
··· 1 +local u = require "utils" 2 +local map, nmap, expr = u.map, u.nmap, u.expr 3 + 4 +nmap("<C-s>", "<cmd>write!<cr>") 5 +nmap("<leader>h", "<cmd>nohlsearch<cr>") 6 +nmap("<leader>q", "<cmd>quit!<cr>") 7 +nmap("<leader>w", "<cmd>write!<cr>") 8 +nmap("<leader>e", "<cmd>NvimTreeToggle<cr>") 9 +nmap("<leader>/", "<cmd>lua require[[Comment]].toggle()<cr>") 10 +map("v", "<leader>/", "gc") 11 +nmap("<leader>ps", "<cmd>PackerSync<cr>") 12 + 13 +-- Windows 14 +for _, k in ipairs { "h", "j", "k", "l" } do 15 + nmap(string.format("<C-%s>", k), string.format("<cmd>wincmd %s<cr>", k)) 16 + map("t", string.format("<C-%s>", k), string.format("<C-\\><C-N><C-w>%s", k)) 17 +end 18 + 19 +nmap("<C-Left>", "<cmd>vertical resize -2<cr>") 20 +nmap("<C-Up", "<cmd>resize -1<cr>") 21 +nmap("<C-Down>", "<cmd>resize +2<cr>") 22 +nmap("<C-Right>", "<cmd>vertical resize +2<CR>") 23 + 24 +-- Alternative up/down for arrows 25 +expr("i", "<C-j>", 'pumvisible() ? "\\<down>" : "\\<C-j>"') 26 +expr("i", "<C-k>", 'pumvisible() ? "\\<up>" : "\\<C-k>"') 27 +expr("c", "<C-j>", 'pumvisible() ? "\\<C-n>" : "\\<C-j>"') 28 +expr("c", "<C-k>", 'pumvisible() ? "\\<C-p>" : "\\<C-k>"') 29 + 30 +-- Move line 31 +map("i", "<A-j>", "<Esc>:m .+1<CR>==gi") 32 +map("i", "<A-k>", "<Esc>:m .-2<CR>==gi") 33 +map("v", "K", ":move '<-2<CR>gv-gv") 34 +map("v", "J", ":move '>+1<CR>gv-gv") 35 +nmap("<A-j>", ":m .+1<CR>==") 36 +nmap("<A-k>", ":m .-2<CR>==") 37 + 38 +-- Telescope 39 +nmap("<leader>f", "<cmd>Telescope find_files<cr>") 40 +nmap("<leader>b", "<cmd>Telescope buffers<cr>") 41 +nmap("<leader>st", "<cmd>Telescope live_grep<cr>") 42 +nmap("<leader>sT", "<cmd>Telescope grep_string<cr>") 43 +nmap("<leader>sp", "<cmd>Telescope projects<cr>") 44 +nmap("<leader>sr", "<cmd>Telescope oldfiles<cr>") 45 +nmap("<leader>sb", "<cmd>Telescope git_branches<cr>") 46 +nmap("<leader>sc", "<cmd>Telescope git_commits<cr>") 47 +nmap("<leader>sk", "<cmd>Telescope keymaps<cr>") 48 + 49 +-- Terminal 50 +nmap("<leader>gg", "<cmd>lua term_cmd('lazygit')<cr>") 51 +nmap("<leader>D", "<cmd> lua term_cmd('lazydocker')<cr>") 52 + 53 +-- DAP 54 +nmap("<leader>dt", "<cmd>lua require'dap'.toggle_breakpoint()<cr>") 55 +nmap("<leader>db", "<cmd>lua require'dap'.step_back()<cr>") 56 +nmap("<leader>dc", "<cmd>lua require'dap'.continue()<cr>") 57 +nmap("<leader>dd", "<cmd>lua require'dap'.disconnect()<cr>") 58 +nmap("<leader>di", "<cmd>lua require'dap'.step_into()<cr>") 59 +nmap("<leader>do", "<cmd>lua require'dap'.step_over()<cr>") 60 +nmap("<leader>du", "<cmd>lua require'dap'.step_out()<cr>") 61 +nmap("<leader>dr", "<cmd>lua require'dap'.repl.toggle()<cr>") 62 +nmap("<leader>dp", "<cmd>lua require'dap'.pause.toggle()<cr>") 63 +nmap("<leader>dq", "<cmd>lua require'dap'.close()<cr>") 64 + 65 +-- Ultest 66 +nmap("<leader>tt", "<cmd>Ultest<cr>") 67 +nmap("<leader>ts", "<cmd>UltestStop<cr>") 68 +nmap("<leader>tc", "<cmd>UltestClear<cr>") 69 +nmap("<leader>tn", "<cmd>UltestNearest<cr>") 70 +nmap("<leader>to", "<cmd>UltestOutput<cr>") 71 + 72 +-- Buffer 73 +nmap("<A-0>", "<cmd>BufferLast<cr>") 74 +nmap("<C-w>", "<cmd>BufferClose<cr>") 75 +nmap("<leader>c", "<cmd>BufferClose!<cr>") 76 +for i = 1, 9 do 77 + nmap(string.format("<A-%d>", i), string.format("<cmd>BufferGoto %d<cr>", i)) 78 +end
A
config/nvim/lua/lsp/attach.lua
··· 1 +return function(client, bufnr) 2 + vim.api.nvim_buf_set_option(bufnr, "omnifunc", "v:lua.vim.lsp.omnifunc") 3 + client.resolved_capabilities.document_formatting = false 4 + client.resolved_capabilities.document_range_formatting = false 5 + 6 + local function buf_map(...) 7 + vim.api.nvim_buf_set_keymap(bufnr, "n", ...) 8 + end 9 + 10 + local opts = { noremap = true, silent = true } 11 + buf_map("K", "<cmd>lua vim.lsp.buf.hover()<CR>", opts) 12 + buf_map("gd", "<cmd>lua vim.lsp.buf.definition()<CR>", opts) 13 + buf_map("gD", "<cmd>lua vim.lsp.buf.declaration()<CR>", opts) 14 + buf_map("gr", "<cmd>lua vim.lsp.buf.references()<CR>", opts) 15 + buf_map("gI", "<cmd>lua vim.lsp.buf.implementation()<CR>", opts) 16 + buf_map("gs", "<cmd>lua vim.lsp.buf.signature_help()<CR>", opts) 17 + buf_map("gl", "<cmd>lua vim.lsp.diagnostic.show_line_diagnostics()<CR>", opts) 18 + buf_map("<leader>la", "<cmd>Telescope lsp_code_actions<CR>", opts) 19 + buf_map("<leader>lA", "lua vim.lsp.buf.range_code_action()<CR>", opts) 20 + buf_map("<leader>ld", "<cmd>TroubleToggle<cr>", opts) 21 + buf_map("<leader>lr", "<cmd>lua vim.lsp.buf.rename()<CR>", opts) 22 + buf_map("<leader>lf", "<cmd>lua vim.lsp.buf.formatting()<CR>", opts) 23 + buf_map("<leader>ls", "<cmd>Telescope lsp_document_symbols<CR>", opts) 24 + buf_map("<leader>li", "<cmd>LspInfo<CR>", opts) 25 + buf_map("<leader>lR", "<cmd>LspRestart<CR>", opts) 26 +end
A
config/nvim/lua/lsp/init.lua
··· 1 +local on_attach = require "lsp.attach" 2 +local M = {} 3 + 4 +function M.setup() 5 + require("nvim-lsp-installer").on_server_ready(function(server) 6 + local opts = { on_attach = on_attach } 7 + 8 + local ok, server_opts = pcall(require, "lsp.providers." .. server.name) 9 + if ok then 10 + opts = vim.tbl_deep_extend("force", opts, server_opts or {}) 11 + end 12 + 13 + server:setup(opts) 14 + 15 + vim.cmd [[ do User LspAttachBuffers ]] 16 + 17 + require("lsp.null").setup() 18 + require("lspconfig")["null-ls"].setup {} 19 + end) 20 +end 21 + 22 +return M
A
config/nvim/lua/lsp/null.lua
··· 1 +local M = {} 2 + 3 +function M.setup() 4 + local null_ls = require "null-ls" 5 + 6 + local fmt = null_ls.builtins.formatting 7 + local lint = null_ls.builtins.diagnostics 8 + 9 + null_ls.config { 10 + sources = { 11 + -- Lua 12 + fmt.stylua, 13 + lint.selene, 14 + 15 + -- Golang 16 + fmt.gofumpt, 17 + fmt.goimports, 18 + 19 + -- JavaScirpt 20 + fmt.prettierd, 21 + lint.eslint_d, 22 + 23 + -- Shell 24 + fmt.shfmt, 25 + lint.shellcheck, 26 + 27 + -- Python 28 + fmt.black, 29 + fmt.isort, 30 + lint.flake8, 31 + 32 + -- Rust 33 + fmt.rustfmt, 34 + }, 35 + } 36 +end 37 + 38 +return M
A
config/nvim/lua/lsp/providers/jsonls.lua
··· 1 +return { 2 + settings = { 3 + schemaDownload = { 4 + enable = true, 5 + }, 6 + schemas = { 7 + { fileMatch = { "package.json" }, url = "https://json.schemastore.org/package.json" }, 8 + { url = "https://json.schemastore.org/tsconfig.json", fileMatch = { "tsconfig.json", "tsconfig.*.json" } }, 9 + { url = "https://json.schemastore.org/lerna.json", fileMatch = { "lerna.json" } }, 10 + { url = "https://json.schemastore.org/eslintrc.json", fileMatch = { ".eslintrc.json", ".eslintrc" } }, 11 + { url = "https://json.schemastore.org/prettierrc", fileMatch = { ".prettierrc", ".prettierrc.json", "prettier.config.json" } }, 12 + { fileMatch = { ".golangci.toml", ".golangci.json" }, url = "https://json.schemastore.org/golangci-lint.json" }, 13 + { fileMatch = { "package.json" }, url = "https://json.schemastore.org/package.json" }, 14 + }, 15 + }, 16 +}
A
config/nvim/lua/lsp/providers/sumneko_lua.lua
··· 1 +return { 2 + settings = { 3 + Lua = { 4 + diagnostics = { globals = { "vim" } }, 5 + workspace = { 6 + library = { 7 + [vim.fn.expand "$VIMRUNTIME/lua/vim/lsp"] = true, 8 + [vim.fn.expand "$VIMRUNTIME/lua"] = true, 9 + }, 10 + maxPreload = 100000, 11 + preloadFileSize = 10000, 12 + }, 13 + }, 14 + }, 15 +}
A
config/nvim/lua/lsp/providers/tsserver.lua
··· 1 +return { 2 + setup = { 3 + handlers = { 4 + ["textDocument/publishDiagnostics"] = function(_, _, p, id, _, cfg) 5 + if p.diagnostics ~= nil then 6 + local i = 1 7 + while i <= #p.diagnostics do 8 + if p.diagnostics[i].code == 80001 then 9 + table.remove(p.diagnostics, i) 10 + else 11 + i = i + 1 12 + end 13 + end 14 + end 15 + vim.lsp.diagnostic.on_publish_diagnostics(_, _, p, id, _, cfg) 16 + end, 17 + }, 18 + }, 19 +}
A
config/nvim/lua/lsp/providers/yamlls.lua
··· 1 +return { 2 + settings = { 3 + yaml = { 4 + hover = true, 5 + completion = true, 6 + validate = true, 7 + schemaStore = { 8 + enable = true, 9 + url = "https://www.schemastore.org/api/json/catalog.json", 10 + }, 11 + schemas = {}, 12 + }, 13 + }, 14 +}
A
config/nvim/lua/options.lua
··· 1 +local o = vim.opt 2 + 3 +vim.g.mapleader = " " 4 +vim.g.maplocalleader = "," 5 +vim.g.netrw_banner = false 6 + 7 +-- o.laststatus = 0 8 +o.backup = false 9 +o.clipboard = "unnamedplus" 10 +o.cmdheight = 1 11 +o.colorcolumn = "99999" 12 +o.completeopt = { "menuone", "noselect" } 13 +o.conceallevel = 0 14 +o.fileencoding = "utf-8" 15 +o.foldmethod = "manual" 16 +o.foldexpr = "" 17 +o.guifont = "JetBrains Mono Nerd Font:h17" 18 +o.hidden = true 19 +o.hlsearch = true 20 +o.ignorecase = true 21 +o.mouse = "a" 22 +o.pumheight = 10 23 +o.showmode = false 24 +o.smartcase = true 25 +o.smartindent = true 26 +o.splitbelow = true 27 +o.splitright = true 28 +o.swapfile = false 29 +o.termguicolors = true 30 +-- o.timeoutlen = 100 31 +o.title = true 32 +o.undofile = true 33 +o.updatetime = 300 34 +o.writebackup = false 35 +o.expandtab = true 36 +o.shiftwidth = 2 37 +o.tabstop = 2 38 +o.cursorline = true 39 +o.number = true 40 +o.relativenumber = true 41 +o.numberwidth = 4 42 +o.signcolumn = "yes" 43 +o.wrap = false 44 +o.spell = false 45 +o.spelllang = "en" 46 +o.scrolloff = 8 47 +o.sidescrolloff = 8
A
config/nvim/lua/plugin.lua
··· 1 +return require("packer").startup(function(use) 2 + use "wbthomason/packer.nvim" 3 + use "nvim-lua/plenary.nvim" 4 + use "Mofiqul/vscode.nvim" 5 + use "kyazdani42/nvim-web-devicons" 6 + use "romgrk/barbar.nvim" 7 + use { "dstein64/vim-startuptime", cmd = "StartupTime" } 8 + 9 + use { 10 + "pwntester/octo.nvim", 11 + cmd = "Octo", 12 + opt = true, 13 + config = function() 14 + require("octo").setup() 15 + end, 16 + } 17 + 18 + use { 19 + "numToStr/Comment.nvim", 20 + config = function() 21 + require("Comment").setup() 22 + end, 23 + } 24 + 25 + use { 26 + "windwp/nvim-autopairs", 27 + config = function() 28 + require("nvim-autopairs").setup() 29 + end, 30 + } 31 + 32 + use { 33 + "neovim/nvim-lspconfig", 34 + requires = { 35 + "williamboman/nvim-lsp-installer", 36 + { "jose-elias-alvarez/null-ls.nvim", after = "nvim-lspconfig" }, 37 + }, 38 + config = function() 39 + require("lsp").setup() 40 + end, 41 + } 42 + 43 + use { 44 + "ahmedkhalf/project.nvim", 45 + config = function() 46 + require("plugin.project").setup() 47 + end, 48 + } 49 + 50 + use { 51 + "mfussenegger/nvim-dap", 52 + module = "dap", 53 + requires = { 54 + { "Pocco81/DAPInstall.nvim", requires = "nvim-dap" }, 55 + { "theHamsta/nvim-dap-virtual-text", after = "nvim-dap", config = [[ require"nvim-dap-virtual-text".setup() ]] }, 56 + { "nvim-telescope/telescope-dap.nvim", after = "nvim-dap", config = [[ require("telescope").load_extension "dap" ]] }, 57 + }, 58 + config = function() 59 + require("plugin.dap").setup() 60 + end, 61 + } 62 + 63 + use { 64 + "ray-x/go.nvim", 65 + ft = "go", 66 + opt = true, 67 + config = function() 68 + require("go").setup { gofmt = "gofumpt" } 69 + end, 70 + } 71 + 72 + use { 73 + "lewis6991/gitsigns.nvim", 74 + config = function() 75 + require("plugin.gitsigns").setup() 76 + end, 77 + } 78 + 79 + use { 80 + "nvim-lualine/lualine.nvim", 81 + config = function() 82 + require("plugin.statusline").setup() 83 + end, 84 + } 85 + 86 + use { 87 + "rcarriga/vim-ultest", 88 + requires = { { "vim-test/vim-test", after = "vim-ultest" } }, 89 + cmd = { "Ultest", "UltestStop", "UltestClear", "UltestNearest", "UltestOutput" }, 90 + run = ":UpdateRemotePlugins", 91 + config = function() 92 + require("plugin.ultest").setup() 93 + end, 94 + } 95 + 96 + use { 97 + "hrsh7th/nvim-cmp", 98 + requires = { 99 + { "hrsh7th/cmp-nvim-lua", after = "nvim-cmp" }, 100 + { "hrsh7th/cmp-nvim-lsp", after = "nvim-cmp" }, 101 + { "hrsh7th/cmp-buffer", after = "nvim-cmp" }, 102 + { 103 + "saadparwaiz1/cmp_luasnip", 104 + requires = { 105 + { "L3MON4D3/LuaSnip", after = "cmp_luasnip" }, 106 + { "rafamadriz/friendly-snippets", after = "LuaSnip" }, 107 + }, 108 + }, 109 + }, 110 + config = function() 111 + require("plugin.cmp").setup() 112 + end, 113 + } 114 + 115 + use { 116 + "max397574/better-escape.nvim", 117 + config = function() 118 + require("better_escape").setup { mapping = { "jk" } } 119 + end, 120 + } 121 + 122 + use { 123 + "nvim-telescope/telescope.nvim", 124 + cmd = "Telescope", 125 + module = "telescope", 126 + config = function() 127 + require("plugin.telescope").setup() 128 + end, 129 + } 130 + 131 + use { 132 + "kyazdani42/nvim-tree.lua", 133 + cmd = "NvimTreeToggle", 134 + config = function() 135 + require("plugin.nvimtree").setup() 136 + end, 137 + } 138 + 139 + use { 140 + "nvim-treesitter/nvim-treesitter", 141 + branch = "0.5-compat", 142 + config = function() 143 + require("plugin.treesitter").setup() 144 + end, 145 + } 146 + 147 + use { 148 + "Smirnov-O/ts-unit.nvim", 149 + after = "nvim-treesitter", 150 + config = function() 151 + require("ts-unit").setup { keymaps = true } 152 + end, 153 + } 154 + 155 + use { 156 + "akinsho/toggleterm.nvim", 157 + module = "toggleterm", 158 + keys = "<C-t>", 159 + config = function() 160 + require("plugin.terminal").setup() 161 + end, 162 + } 163 +end)
A
config/nvim/lua/plugin/cmp.lua
··· 1 +local M = {} 2 + 3 +function M.setup() 4 + local cmp = require "cmp" 5 + 6 + require("luasnip/loaders/from_vscode").lazy_load { 7 + paths = { "~/.local/share/nvim/site/pack/packer/start/friendly-snippets" }, 8 + } 9 + 10 + cmp.event:on("confirm_done", require("nvim-autopairs.completion.cmp").on_confirm_done()) 11 + cmp.setup { 12 + snippet = { 13 + expand = function(args) 14 + require("luasnip").lsp_expand(args.body) 15 + end, 16 + }, 17 + formatting = { 18 + format = function(entry, vim_item) 19 + vim_item.menu = ({ 20 + nvim_lsp = "(L)", 21 + nvim_lua = "(N)", 22 + buffer = "(B)", 23 + luasnip = "(S)", 24 + })[entry.source.name] 25 + 26 + return vim_item 27 + end, 28 + }, 29 + mapping = { 30 + ["<C-j>"] = cmp.mapping.select_next_item(), 31 + ["<C-k>"] = cmp.mapping.select_prev_item(), 32 + ["<C-d>"] = cmp.mapping.scroll_docs(-4), 33 + ["<C-f>"] = cmp.mapping.scroll_docs(4), 34 + ["<C-Space>"] = cmp.mapping.complete(), 35 + ["<C-e>"] = cmp.mapping.close(), 36 + ["<CR>"] = cmp.mapping.confirm { behavior = cmp.ConfirmBehavior.Replace, select = false }, 37 + ["<Tab>"] = function(fallback) 38 + if cmp.visible() then 39 + cmp.select_next_item() 40 + elseif require("luasnip").expand_or_jumpable() then 41 + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-expand-or-jump", true, true, true), "") 42 + else 43 + fallback() 44 + end 45 + end, 46 + ["<S-Tab>"] = function(fallback) 47 + if cmp.visible() then 48 + cmp.select_prev_item() 49 + elseif require("luasnip").jumpable(-1) then 50 + vim.fn.feedkeys(vim.api.nvim_replace_termcodes("<Plug>luasnip-jump-prev", true, true, true), "") 51 + else 52 + fallback() 53 + end 54 + end, 55 + }, 56 + sources = { 57 + { name = "nvim_lua", max_item_count = 5 }, 58 + { name = "nvim_lsp", max_item_count = 8 }, 59 + { name = "buffer", keyword_length = 4, max_item_count = 5 }, 60 + { name = "luasnip", max_item_count = 4, keyword_length = 2 }, 61 + }, 62 + experimental = { 63 + ghost_text = true, 64 + }, 65 + } 66 +end 67 + 68 +return M
A
config/nvim/lua/plugin/dap.lua
··· 1 +local M = {} 2 + 3 +function M.setup() 4 + vim.fn.sign_define("DapBreakpoint", { 5 + text = "", 6 + texthl = "LspDiagnosticsSignError", 7 + linehl = "", 8 + numhl = "", 9 + }) 10 + vim.fn.sign_define("DapBreakpointRejected", { 11 + text = "", 12 + texthl = "LspDiagnosticsSignHint", 13 + linehl = "", 14 + numhl = "", 15 + }) 16 + vim.fn.sign_define("DapStopped", { 17 + text = "", 18 + texthl = "LspDiagnosticsSignInformation", 19 + linehl = "DiagnosticUnderlineInfo", 20 + numhl = "LspDiagnosticsSignInformation", 21 + }) 22 +end 23 + 24 +return M
A
config/nvim/lua/plugin/gitsigns.lua
··· 1 +local M = {} 2 + 3 +function M.setup() 4 + require("gitsigns").setup { 5 + signs = { 6 + add = { hl = "GitSignsAdd", text = "│", numhl = "GitSignsAddNr", linehl = "GitSignsAddLn" }, 7 + change = { hl = "GitSignsChange", text = "│", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, 8 + delete = { hl = "GitSignsDelete", text = "_", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, 9 + topdelete = { hl = "GitSignsDelete", text = "‾", numhl = "GitSignsDeleteNr", linehl = "GitSignsDeleteLn" }, 10 + changedelete = { hl = "GitSignsChange", text = "~", numhl = "GitSignsChangeNr", linehl = "GitSignsChangeLn" }, 11 + }, 12 + signcolumn = true, 13 + numhl = false, 14 + linehl = false, 15 + word_diff = false, 16 + keymaps = { 17 + noremap = true, 18 + ["n <leader>gs"] = '<cmd>lua require"gitsigns".stage_hunk()<CR>', 19 + ["n <leader>gr"] = '<cmd>lua require"gitsigns".reset_hunk()<CR>', 20 + ["n <leader>gR"] = '<cmd>lua require"gitsigns".reset_buffer()<CR>', 21 + ["n <leader>gp"] = '<cmd>lua require"gitsigns".preview_hunk()<CR>', 22 + ["n <leader>gl"] = '<cmd>lua require"gitsigns".blame_line(true)<CR>', 23 + ["n <leader>gS"] = '<cmd>lua require"gitsigns".stage_buffer()<CR>', 24 + ["n <leader>gU"] = '<cmd>lua require"gitsigns".reset_buffer_index()<CR>', 25 + }, 26 + watch_gitdir = { 27 + interval = 1000, 28 + follow_files = true, 29 + }, 30 + attach_to_untracked = true, 31 + current_line_blame = false, 32 + current_line_blame_opts = { 33 + virt_text = true, 34 + virt_text_pos = "eol", -- 'eol' | 'overlay' | 'right_align' 35 + delay = 300, 36 + }, 37 + current_line_blame_formatter_opts = { relative_time = false }, 38 + sign_priority = 6, 39 + update_debounce = 100, 40 + status_formatter = nil, 41 + max_file_length = 40000, 42 + preview_config = { 43 + border = "single", 44 + style = "minimal", 45 + relative = "cursor", 46 + row = 0, 47 + col = 1, 48 + }, 49 + yadm = { enable = false }, 50 + } 51 +end 52 + 53 +return M
A
config/nvim/lua/plugin/nvimtree.lua
··· 1 +local M = {} 2 + 3 +function M.setup() 4 + local tree_cb = require("nvim-tree.config").nvim_tree_callback 5 + 6 + require("nvim-tree").setup { 7 + disable_netrw = true, 8 + hijack_netrw = true, 9 + auto_close = true, 10 + auto_open = true, 11 + update_cwd = false, 12 + diagnostics = { 13 + enable = true, 14 + icons = { 15 + hint = "", 16 + info = "", 17 + warning = "", 18 + error = "", 19 + }, 20 + }, 21 + filters = { 22 + dotfiles = true, 23 + custom = { ".git", "node_modules", "__pycache__", "env", ".bin" }, 24 + }, 25 + view = { 26 + width = 30, 27 + side = "left", 28 + auto_resize = false, 29 + mappings = { 30 + custom_only = false, 31 + list = { 32 + { key = { "l", "<CR>", "o" }, cb = tree_cb "edit" }, 33 + { key = "h", cb = tree_cb "close_node" }, 34 + { key = "v", cb = tree_cb "vsplit" }, 35 + }, 36 + }, 37 + }, 38 + } 39 + 40 + vim.g.nvim_tree_group_empty = 1 41 + vim.g.nvim_tree_indent_markers = 1 42 +end 43 + 44 +return M
A
config/nvim/lua/plugin/project.lua
··· 1 +local M = {} 2 + 3 +function M.setup() 4 + require("project_nvim").setup { 5 + manual_mode = false, 6 + detection_methods = { "lsp", "pattern" }, 7 + patterns = { ".git", ".svn", "Makefile", "package.json", "go.mod" }, 8 + ignore_lsp = {}, 9 + exclude_dirs = {}, 10 + show_hidden = false, 11 + silent_chdir = true, 12 + } 13 +end 14 + 15 +return M
A
config/nvim/lua/plugin/statusline.lua
··· 1 +local M = {} 2 + 3 +function M.setup() 4 + require("lualine").setup { 5 + options = { 6 + theme = "codedark", 7 + component_separators = { "", "" }, 8 + section_separators = { "", "" }, 9 + disabled_filetypes = { "NvimTree", "Telescope" }, 10 + }, 11 + sections = { 12 + lualine_a = { "branch", "diff" }, 13 + lualine_b = { "filename" }, 14 + lualine_c = {}, 15 + lualine_x = {}, 16 + lualine_y = { { "diagnostics", sources = { "nvim_lsp" } } }, 17 + lualine_z = { "location" }, 18 + }, 19 + } 20 +end 21 + 22 +return M
A
config/nvim/lua/plugin/telescope.lua
··· 1 +local M = {} 2 + 3 +function M.setup() 4 + local actions = require "telescope.actions" 5 + 6 + require("telescope").setup { 7 + defaults = { 8 + prompt_prefix = " ", 9 + selection_caret = " ", 10 + entry_prefix = " ", 11 + initial_mode = "insert", 12 + selection_strategy = "reset", 13 + sorting_strategy = "descending", 14 + layout_strategy = "horizontal", 15 + layout_config = { 16 + width = 0.75, 17 + preview_cutoff = 120, 18 + prompt_position = "top", 19 + horizontal = { mirror = false }, 20 + vertical = { mirror = false }, 21 + }, 22 + file_ignore_patterns = { ".git", "node_modules", "__pycache__", "target", "env", ".bin" }, 23 + path_display = { shorten = 5 }, 24 + winblend = 0, 25 + border = {}, 26 + borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" }, 27 + color_devicons = true, 28 + set_env = { ["COLORTERM"] = "truecolor" }, 29 + pickers = { 30 + find_files = { find_command = { "fd", "--type=file", "--hidden", "--smart-case" } }, 31 + live_grep = { only_sort_text = true }, 32 + }, 33 + mappings = { 34 + i = { 35 + ["<C-j>"] = actions.move_selection_next, 36 + ["<C-k>"] = actions.move_selection_previous, 37 + ["<C-u>"] = false, 38 + 39 + ["<C-h>"] = "which_key", 40 + }, 41 + n = { 42 + ["<C-j>"] = actions.move_selection_next, 43 + ["<C-k>"] = actions.move_selection_previous, 44 + }, 45 + }, 46 + }, 47 + } 48 + 49 + require("telescope").load_extension "projects" 50 +end 51 + 52 +return M
A
config/nvim/lua/plugin/terminal.lua
··· 1 +local M = {} 2 + 3 +function M.setup() 4 + require("toggleterm").setup { 5 + size = 20, 6 + open_mapping = [[<c-t>]], 7 + hide_numbers = true, 8 + shade_filetypes = {}, 9 + shade_terminals = true, 10 + shading_factor = 2, 11 + start_in_insert = true, 12 + insert_mappings = true, 13 + persist_size = false, 14 + direction = "float", 15 + close_on_exit = true, 16 + shell = vim.o.shell, 17 + float_opts = { 18 + border = "curved", 19 + winblend = 0, 20 + highlights = { 21 + border = "Normal", 22 + background = "Normal", 23 + }, 24 + }, 25 + } 26 +end 27 + 28 +return M
A
config/nvim/lua/plugin/treesitter.lua
··· 1 +local M = {} 2 + 3 +function M.setup() 4 + require("nvim-treesitter.configs").setup { 5 + ensure_installed = { "lua", "go", "gomod" }, 6 + highlight = { enable = true }, 7 + indent = { enable = true, disable = { "python", "yml" } }, 8 + autotag = { enable = true }, 9 + context_commentstring = { enable = true }, 10 + rainbow = { 11 + enable = false, 12 + extended_mode = true, 13 + max_file_lines = 500, 14 + }, 15 + } 16 + 17 + local parser_configs = require("nvim-treesitter.parsers").get_parser_configs() 18 +end 19 + 20 +return M
A
config/nvim/lua/utils.lua
··· 1 +local M = {} 2 + 3 +M.opts = { noremap = true, silent = true } 4 + 5 +function M._map(mode, from, to, opts) 6 + vim.api.nvim_set_keymap(mode, from, to, opts) 7 +end 8 + 9 +function M.map(mode, from, to) 10 + if type(mode) == "table" then 11 + for _, m in pairs(mode) do 12 + M._map(m, from, to, M.opts) 13 + end 14 + end 15 + 16 + M._map(mode, from, to, M.opts) 17 +end 18 + 19 +function M.nmap(from, to) 20 + M._map("n", from, to, M.opts) 21 +end 22 + 23 +function M.expr(mode, from, to) 24 + M._map(mode, from, to, { noremap = true, expr = true }) 25 +end 26 + 27 +return M