diff options
Diffstat (limited to '.config/nvim/lua/plugins')
-rwxr-xr-x | .config/nvim/lua/plugins/aerial.lua | 32 | ||||
-rwxr-xr-x | .config/nvim/lua/plugins/bufresize.lua | 1 | ||||
-rwxr-xr-x | .config/nvim/lua/plugins/cmp.lua | 26 | ||||
-rwxr-xr-x | .config/nvim/lua/plugins/dap.lua | 21 | ||||
-rwxr-xr-x | .config/nvim/lua/plugins/diffview.lua | 4 | ||||
-rwxr-xr-x | .config/nvim/lua/plugins/gitsigns.lua | 14 | ||||
-rwxr-xr-x | .config/nvim/lua/plugins/indent-guides.lua | 11 | ||||
-rwxr-xr-x | .config/nvim/lua/plugins/indent-o-matic.lua | 14 | ||||
-rwxr-xr-x | .config/nvim/lua/plugins/init.lua | 93 | ||||
-rwxr-xr-x | .config/nvim/lua/plugins/lspconfig.lua | 82 | ||||
-rwxr-xr-x | .config/nvim/lua/plugins/sniprun.lua | 3 | ||||
-rwxr-xr-x | .config/nvim/lua/plugins/telescope.lua | 25 | ||||
-rwxr-xr-x | .config/nvim/lua/plugins/treesitter.lua | 18 | ||||
-rwxr-xr-x | .config/nvim/lua/plugins/which-key.lua | 13 | ||||
-rwxr-xr-x | .config/nvim/lua/plugins/zk.lua | 3 |
15 files changed, 360 insertions, 0 deletions
diff --git a/.config/nvim/lua/plugins/aerial.lua b/.config/nvim/lua/plugins/aerial.lua new file mode 100755 index 0000000..7b915db --- /dev/null +++ b/.config/nvim/lua/plugins/aerial.lua @@ -0,0 +1,32 @@ +require("aerial").setup{ + highlight_on_jump = 800, + min_width = 10, + filter_kind = { + "Array", + "Boolean", + "Class", + "Constant", + "Constructor", + "Enum", + "EnumMember", + "Event", + "Field", + "File", + "Function", + "Interface", + "Key", + "Method", + "Module", + "Namespace", + "Null", + "Number", + "Object", + "Operator", + "Package", + "Property", + "String", + "Struct", + "TypeParameter", + "Variable" + }, +} diff --git a/.config/nvim/lua/plugins/bufresize.lua b/.config/nvim/lua/plugins/bufresize.lua new file mode 100755 index 0000000..c4212f8 --- /dev/null +++ b/.config/nvim/lua/plugins/bufresize.lua @@ -0,0 +1 @@ +require('bufresize').setup{} diff --git a/.config/nvim/lua/plugins/cmp.lua b/.config/nvim/lua/plugins/cmp.lua new file mode 100755 index 0000000..503440f --- /dev/null +++ b/.config/nvim/lua/plugins/cmp.lua @@ -0,0 +1,26 @@ +local cmp = require('cmp') + +cmp.setup({ + mapping = { + ['<C-j>'] = cmp.mapping(cmp.mapping.select_next_item(), { 'i', 'c' }), + ['<C-k>'] = cmp.mapping(cmp.mapping.select_prev_item(), { 'i', 'c' }), + ['<C-Space>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), + -- ['<C-l>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), + -- ['<CR>'] = cmp.mapping.confirm({ select = true }) + }, + sources = cmp.config.sources({ + { name = 'nvim_lsp' }, + { name = 'cmdline' }, + { name = 'path' }, + { name = 'calc' } + }, + { + { name = 'buffer' } + }) +}) + +cmp.setup.cmdline('/', { + sources = { + { name = 'buffer' } + } +}) diff --git a/.config/nvim/lua/plugins/dap.lua b/.config/nvim/lua/plugins/dap.lua new file mode 100755 index 0000000..b927ca6 --- /dev/null +++ b/.config/nvim/lua/plugins/dap.lua @@ -0,0 +1,21 @@ +local dap = require('dap') +local python_venv = require('utils').get_python_venv() + +dap.adapters.python = { + type = 'executable'; + command = 'python'; + args = { '-m', 'debugpy.adapter' }; +} + +dap.configurations.python = { + { + type = 'python'; + request = 'launch'; + name = "Launch file"; + + program = "${file}"; + pythonPath = python_venv .. '/bin/python'; + }, +} + +-- require("dapui").setup{} diff --git a/.config/nvim/lua/plugins/diffview.lua b/.config/nvim/lua/plugins/diffview.lua new file mode 100755 index 0000000..857b041 --- /dev/null +++ b/.config/nvim/lua/plugins/diffview.lua @@ -0,0 +1,4 @@ +require('diffview').setup{ + diff_binaries = false, + enhanced_diff_hl = false, +} diff --git a/.config/nvim/lua/plugins/gitsigns.lua b/.config/nvim/lua/plugins/gitsigns.lua new file mode 100755 index 0000000..7c4a92b --- /dev/null +++ b/.config/nvim/lua/plugins/gitsigns.lua @@ -0,0 +1,14 @@ +require('gitsigns').setup{ + signs = { + add = {hl = 'GitSignsAdd', text = '▍', + numhl='GitSignsAddNr', linehl='GitSignsAddLn'}, + change = {hl = 'GitSignsChange', text = '▍', + numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + delete = {hl = 'GitSignsDelete', text = '▍', + numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + topdelete = {hl = 'GitSignsDelete', text = '▍', + numhl='GitSignsDeleteNr', linehl='GitSignsDeleteLn'}, + changedelete = {hl = 'GitSignsChange', text = '▍', + numhl='GitSignsChangeNr', linehl='GitSignsChangeLn'}, + } +} diff --git a/.config/nvim/lua/plugins/indent-guides.lua b/.config/nvim/lua/plugins/indent-guides.lua new file mode 100755 index 0000000..c50f74d --- /dev/null +++ b/.config/nvim/lua/plugins/indent-guides.lua @@ -0,0 +1,11 @@ +require('indent_guides').setup{ + indent_enable=true; + exclude_filetypes={ + 'calendar', + 'gitcommit', + 'help', + 'lsp-installer', + 'man', + 'NvimTree', + }; +} diff --git a/.config/nvim/lua/plugins/indent-o-matic.lua b/.config/nvim/lua/plugins/indent-o-matic.lua new file mode 100755 index 0000000..4b2abb5 --- /dev/null +++ b/.config/nvim/lua/plugins/indent-o-matic.lua @@ -0,0 +1,14 @@ +require('indent-o-matic').setup { + max_lines = 0, + standard_widths = { 2, 4, 8 }, + + filetype_ = { standard_widths = { 2, 4 } }, + + filetype_css = { max_lines = 4096 }, + filetype_scss = { max_lines = 4096 }, + filetype_json = { max_lines = 4096 }, + filetype_javascript = { max_lines = 4096 }, + filetype_typescript = { max_lines = 4096 }, + filetype_xml = { max_lines = 4096 }, + filetype_django = { max_lines = 4096 }, +} diff --git a/.config/nvim/lua/plugins/init.lua b/.config/nvim/lua/plugins/init.lua new file mode 100755 index 0000000..cd325d2 --- /dev/null +++ b/.config/nvim/lua/plugins/init.lua @@ -0,0 +1,93 @@ +-- bootstrap +local install_path = vim.fn.stdpath('data')..'/site/pack/paqs/start/paq-nvim' +if vim.fn.empty(vim.fn.glob(install_path)) > 0 then + vim.fn.system({ + 'git', 'clone', '--depth=1', + 'https://github.com/savq/paq-nvim.git', + install_path + }) +end + +vim.cmd 'packadd paq-nvim' + +require('paq') { + {'savq/paq-nvim'}; + + -- treesiter + {'nvim-treesitter/playground'}; + {'nvim-treesitter/nvim-treesitter-textobjects'}; + { + 'nvim-treesitter/nvim-treesitter', + run=vim.api.nvim_command(':silent! TSUpdate') + }; + + -- lsp + { + 'neovim/nvim-lspconfig', + run = function() + vim.fn.system({'npm', 'install', '-g', '@ansible/ansible-language-server'}) + vim.fn.system({'npm', 'install', '-g', 'vscode-langservers-extracted'}) + vim.fn.system({'python3', '-m', 'pipx', 'install', '--force', 'python-lsp-server[all]'}) + vim.fn.system({'python3', '-m', 'pipx', 'inject', 'python-lsp-server', 'git+https://github.com/python/mypy'}) + vim.fn.system({'python3', '-m', 'pipx', 'inject', 'python-lsp-server', 'pylsp-mypy'}) + vim.fn.system({'python3', '-m', 'pipx', 'inject', 'python-lsp-server', 'types-all'}) + vim.fn.system({'python3', '-m', 'pipx', 'upgrade', '--include-injected', 'python-lsp-server'}) + -- vim.fn.system({'python3', '-m', 'pip', 'install', '--force', 'debugpy'}) + end + }; + {'mickael-menu/zk-nvim'}; + + {'nvim-telescope/telescope.nvim'}; + {'stevearc/aerial.nvim'}; + {'sindrets/diffview.nvim'}; + {'folke/which-key.nvim'}; + { + 'michaelb/sniprun', + run = 'bash install.sh' + }; + + -- dap + {'mfussenegger/nvim-dap'}; + {'rcarriga/nvim-dap-ui'}; + + -- completion + {'hrsh7th/cmp-nvim-lsp'}; + {'hrsh7th/cmp-cmdline'}; + {'hrsh7th/cmp-buffer'}; + {'hrsh7th/cmp-path'}; + {'hrsh7th/cmp-calc'}; + {'hrsh7th/nvim-cmp'}; + + -- indentation + {'lewis6991/gitsigns.nvim'}; + {'glepnir/indent-guides.nvim'}; + {'darazaki/indent-o-matic'}; + { + 'stsewd/sphinx.nvim', + run=function() + vim.fn.system({'python3', '-m', 'pip', 'install', 'sphinx'}) + vim.api.nvim_command(':silent! UpdateRemotePlugins') + end + }; + + -- qol + {'kwkarlwang/bufresize.nvim'}; + + -- dependencies + {'nvim-lua/plenary.nvim'}; +} + +require('plugins.aerial') +require('plugins.bufresize') +require('plugins.cmp') +-- require('plugins.dap') +require('plugins.diffview') +require('plugins.gitsigns') +require('plugins.indent-guides') +require('plugins.indent-o-matic') +require('plugins.sniprun') +require('plugins.lspconfig') +require('plugins.telescope') +require('plugins.treesitter') +require('plugins.which-key') +require('plugins.zk') diff --git a/.config/nvim/lua/plugins/lspconfig.lua b/.config/nvim/lua/plugins/lspconfig.lua new file mode 100755 index 0000000..9ef6a1d --- /dev/null +++ b/.config/nvim/lua/plugins/lspconfig.lua @@ -0,0 +1,82 @@ +local opts = { noremap=true, silent=true } + +local lsputil = require('lspconfig/util') +local python_venv = require('utils').get_python_venv() + +local on_attach = function(client, bufnr) + -- Enable completion triggered by <c-x><c-o> + vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') + + -- Mappings. + -- See `:help vim.lsp.*` for documentation on any of the below functions + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', '<cmd>lua vim.lsp.buf.declaration()<CR>', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', '<cmd>lua vim.lsp.buf.definition()<CR>', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', '<cmd>lua vim.lsp.buf.hover()<CR>', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', '<cmd>lua vim.lsp.buf.implementation()<CR>', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', '<cmd>lua vim.lsp.buf.references()<CR>', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wa', '<cmd>lua vim.lsp.buf.add_workspace_folder()<CR>', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wr', '<cmd>lua vim.lsp.buf.remove_workspace_folder()<CR>', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>wl', '<cmd>lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))<CR>', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>D', '<cmd>lua vim.lsp.buf.type_definition()<CR>', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>rn', '<cmd>lua vim.lsp.buf.rename()<CR>', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>ca', '<cmd>lua vim.lsp.buf.code_action()<CR>', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '<space>f', '<cmd>lua vim.lsp.buf.formatting()<CR>', opts) + vim.api.nvim_buf_set_keymap(bufnr, 'n', '<C-k>', '<cmd>lua vim.lsp.buf.signature_help()<CR>', opts) + + require("aerial").on_attach(client, bufnr) +end + +vim.api.nvim_set_keymap('n', '<space>d', '<cmd>lua vim.diagnostic.open_float()<CR>', opts) +vim.api.nvim_set_keymap('n', '[d', '<cmd>lua vim.diagnostic.goto_prev()<CR>', opts) +vim.api.nvim_set_keymap('n', ']d', '<cmd>lua vim.diagnostic.goto_next()<CR>', opts) +vim.api.nvim_set_keymap('n', '<space>q', '<cmd>lua vim.diagnostic.setloclist()<CR>', opts) + +require('lspconfig').ansiblels.setup{ on_attach = on_attach } +require('lspconfig').clangd.setup{ on_attach = on_attach } +require('lspconfig').eslint.setup{ on_attach = on_attach } +require('lspconfig').gopls.setup{ on_attach = on_attach } +require('lspconfig').terraformls.setup{ on_attach = on_attach } + +require('lspconfig').dartls.setup{ + on_attach = on_attach, + settings = { + dart = { + analysisExcludedFolders = { '.git' }, + completeFunctionCalls = true, + enableSdkFormatter = true, + showTodos = true + } + } +} + +require('lspconfig').pylsp.setup{ + cmd_env = { + VIRTUAL_ENV = python_venv, + PATH = lsputil.path.join(python_venv, 'bin') .. ':' .. vim.env.PATH, + MYPYPATH = lsputil.path.join(python_venv, 'bin') .. ':' .. (vim.env.MYPYPATH or "") + }, + on_attach = on_attach, + settings = { + pylsp = { + configurationSources = {'flake8', 'pycodestyle'}, + plugins = { + flake8 = { + enabled = true, + ignore = {}, + maxLineLength = 160 + }, + rope_completion = { + enabled = true, + }, + pyflakes = { + enabled = true + }, + } + } + } +} + +require('lspconfig').elixirls.setup{ + cmd = {'elixir-ls'}, + on_attach = on_attach +} diff --git a/.config/nvim/lua/plugins/sniprun.lua b/.config/nvim/lua/plugins/sniprun.lua new file mode 100755 index 0000000..d6d1265 --- /dev/null +++ b/.config/nvim/lua/plugins/sniprun.lua @@ -0,0 +1,3 @@ +require('sniprun').setup{ + display = { 'Terminal' }, +} diff --git a/.config/nvim/lua/plugins/telescope.lua b/.config/nvim/lua/plugins/telescope.lua new file mode 100755 index 0000000..6a5f8c6 --- /dev/null +++ b/.config/nvim/lua/plugins/telescope.lua @@ -0,0 +1,25 @@ +require('telescope').setup{ + defaults = { + borderchars = { '─', '│', '─', '│', '┌', '┐', '┘', '└'} + } +} + +require('telescope').load_extension('aerial') + +local opt = { noremap=true } +local keybinds = { + {'fa', 'aerial'}, + {'fb', 'buffers'}, + {'ff', 'find_files'}, + {'fg', 'git_files'}, + {'fl', 'live_grep'}, + {'fh', 'help_tags'}, + {'fm', 'man_pages'}, + {'fo', 'oldfiles'}, + {'fr', 'resume'}, + {'f/', 'current_buffer_fuzzy_find'}, +} + +for _, keybind in pairs(keybinds) do + vim.api.nvim_set_keymap('n', keybind[1], '<cmd>Telescope ' .. keybind[2] .. '<cr>', opt) +end diff --git a/.config/nvim/lua/plugins/treesitter.lua b/.config/nvim/lua/plugins/treesitter.lua new file mode 100755 index 0000000..7fb6d45 --- /dev/null +++ b/.config/nvim/lua/plugins/treesitter.lua @@ -0,0 +1,18 @@ +require('nvim-treesitter.configs').setup { + ensure_installed = 'all', + ignore_install = { + 'verilog', + 'kotlin' + }, + highlight = { + enable = true, + -- additional_vim_regex_highlighting = { "markdown" } + additional_vim_regex_highlighting = true, + set_custom_captures = { + ["type.string"] = "pythonFunction", + } + }, + incremental_selection = { enable = true }, + textobjects = { enable = true } +} + diff --git a/.config/nvim/lua/plugins/which-key.lua b/.config/nvim/lua/plugins/which-key.lua new file mode 100755 index 0000000..93e19f9 --- /dev/null +++ b/.config/nvim/lua/plugins/which-key.lua @@ -0,0 +1,13 @@ +require("which-key").setup{ + window = { + position = "bottom", -- bottom, top + margin = { 1, 40, 1, 0 }, -- extra window margin [top, right, bottom, left] + padding = { 0, 0, 0, 0 }, -- extra window padding [top, right, bottom, left] + winblend = 0 + }, + icons = { + breadcrumb = ">", -- symbol used in the command line area that shows your active key combo + separator = ":", -- symbol used between a key and it's label + group = "+", -- symbol prepended to a group + }, +} diff --git a/.config/nvim/lua/plugins/zk.lua b/.config/nvim/lua/plugins/zk.lua new file mode 100755 index 0000000..1a091b9 --- /dev/null +++ b/.config/nvim/lua/plugins/zk.lua @@ -0,0 +1,3 @@ +require('zk').setup{ + picker = 'telescope' +} |