diff options
author | Romain Gonçalves <me@rgoncalves.se> | 2022-10-08 12:40:19 +0200 |
---|---|---|
committer | Romain Gonçalves <me@rgoncalves.se> | 2022-10-08 12:40:19 +0200 |
commit | ce6be946d024aa55a15d576388d05f90be671cf2 (patch) | |
tree | fa1053446a3fb06daee8438c1ff664cb36c0abcb /.config/nvim/lua | |
parent | 703ed1915c69911a95cab6e1fb6524629c976800 (diff) | |
download | dots-ce6be946d024aa55a15d576388d05f90be671cf2.tar.gz |
Sat Oct 8 12:40:19 PM CEST 2022
Diffstat (limited to '.config/nvim/lua')
-rwxr-xr-x | .config/nvim/lua/diagnostic.lua | 45 | ||||
-rwxr-xr-x | .config/nvim/lua/keymaps.lua | 19 | ||||
-rwxr-xr-x | .config/nvim/lua/lsp.lua | 6 | ||||
-rwxr-xr-x | .config/nvim/lua/plugins.lua | 164 | ||||
-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 | ||||
-rwxr-xr-x | .config/nvim/lua/settings.lua | 38 |
20 files changed, 444 insertions, 188 deletions
diff --git a/.config/nvim/lua/diagnostic.lua b/.config/nvim/lua/diagnostic.lua new file mode 100755 index 0000000..0eb4e91 --- /dev/null +++ b/.config/nvim/lua/diagnostic.lua @@ -0,0 +1,45 @@ +local original_diagnostic_set = vim.diagnostic.set +local disabled_diagnostics_patterns = { + -- { 'mypy', 'Library stubs not installed' }, + -- { 'mypy', 'Cannot find implementation or library stub' }, + -- { 'mypy', 'Skipping analyzing' } +} + +local function is_diagnostic_disabled(diagnostic, disabled_diagnostic_patterns) + return string.find(diagnostic.source, disabled_diagnostic_patterns[1]) and + string.find(diagnostic.message, disabled_diagnostic_patterns[2]) +end + +local function is_diagnostic_enabled(diagnostic, disabled_diagnostic_patterns) + local found_diagnostic = true + for _, disabled_diagnostic_patterns in pairs(disabled_diagnostics_patterns) do + if is_diagnostic_disabled(diagnostic, disabled_diagnostic_patterns) then + found_diagnostic = false + end + end + return found_diagnostic +end + +vim.diagnostic.set = function(namespace, bufnr, diagnostics, opts) + local filtered_diagnostics = {} + for _, diagnostic in pairs(diagnostics) do + if is_diagnostic_enabled(diagnostic, disabled_diagnostics_patterns) then + table.insert(filtered_diagnostics, diagnostic) + end + end + original_diagnostic_set(namespace, bufnr, filtered_diagnostics, opts) +end + +vim.diagnostic.config{ + underline = false, + signs = true, + severity_sort = true, + update_in_insert = false, + float = { + source = 'always', + }, + virtual_text = { + prefix = '▒ ', + spacing = 8, + }, +} diff --git a/.config/nvim/lua/keymaps.lua b/.config/nvim/lua/keymaps.lua index 070ddc9..5243d8b 100755 --- a/.config/nvim/lua/keymaps.lua +++ b/.config/nvim/lua/keymaps.lua @@ -1,24 +1,9 @@ ---[[ --- Keymaps ---]] - local map = vim.api.nvim_set_keymap local cmd = vim.cmd - -options = {noremap=true} +local options = { noremap=true } map('i', '<C-h>', '<Left>', options) map('i', '<C-j>', '<Down>', options) map('i', '<C-k>', '<Up>', options) map('i', '<C-l>', '<Right>', options) -map('i', '<C-l>', '<Right>', options) - -map('', '<C-n>', ':NvimTreeToggle<CR>', options) - ---[[ -map('n', '<silent><expr>', '<C-Space>', 'compe#complete()', options) -map('n', '<silent><expr>', '<CR>', 'compe#confirm(\'<CR>\'', options) -map('n', '<silent><expr>', '<C-e>', 'compe#close(\'<C-e>\'', options) -map('n', '<silent><expr>', '<C-f>', 'compe#scroll({\'delta\': +4}', options) -map('n', '<silent><expr>', '<C-d>', 'compe#scroll({\'delta\': -4}', options) ---]] +map('i', '<C-L>', '<leader><space> :noh', options) diff --git a/.config/nvim/lua/lsp.lua b/.config/nvim/lua/lsp.lua index 95d9409..4e0624c 100755 --- a/.config/nvim/lua/lsp.lua +++ b/.config/nvim/lua/lsp.lua @@ -1,9 +1,6 @@ ---[[ --- lsp ---]] - local lsp = vim.lsp +--[[ lsp.handlers["textDocument/publishDiagnostics"] = lsp.with( lsp.diagnostic.on_publish_diagnostics, { @@ -15,3 +12,4 @@ lsp.handlers["textDocument/publishDiagnostics"] = lsp.with( signs = true, } ) +--]] diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua deleted file mode 100755 index bb7a7b4..0000000 --- a/.config/nvim/lua/plugins.lua +++ /dev/null @@ -1,164 +0,0 @@ --- bootstrap paq -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 - }) - vim.cmd 'packadd paq-nvim' -end - --- enable paq -vim.cmd 'packadd paq-nvim' - --- plugins -require('paq') { - {'savq/paq-nvim'}; - - -- treesiter / lsp - {'nvim-treesitter/playground'}; - {'nvim-treesitter/nvim-treesitter-textobjects'}; - { - 'nvim-treesitter/nvim-treesitter', - run=vim.api.nvim_command(':silent! TSUpdate') - }; - { - 'neovim/nvim-lspconfig', - run='python3 -m pipx install python-lsp-server[all]' - }; - - -- utils - {'folke/trouble.nvim'}; - {'hrsh7th/nvim-compe'}; - - {'hrsh7th/cmp-nvim-lsp'}; - {'hrsh7th/cmp-cmdline'}; - {'hrsh7th/cmp-buffer'}; - {'hrsh7th/cmp-path'}; - {'hrsh7th/cmp-calc'}; - {'hrsh7th/nvim-cmp'}; - - -- indent - {'lewis6991/gitsigns.nvim'}; - {'glepnir/indent-guides.nvim'}; - {'darazaki/indent-o-matic'}; - - -- dep - {'nvim-lua/plenary.nvim'}; -} - --- treesitter - -local parser_configs = require('nvim-treesitter.parsers').get_parser_configs() - -require('nvim-treesitter.configs').setup { - ensure_installed = 'maintained', - ignore_install = { - 'verilog', - 'kotlin' - }, - highlight = { enable = true }, - incremental_selection = { enable = true }, - textobjects = { enable = true } -} - --- completion - -local cmp = require('cmp') - -cmp.setup({ - mapping = { - ['<C-l>'] = cmp.mapping(cmp.mapping.complete(), { 'i', 'c' }), - ['<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' }), - }, - sources = cmp.config.sources({ - { name = 'nvim_lsp' }, - { name = 'cmdline' }, - { name = 'path' }, - { name = 'calc' } - }, - { - { name = 'buffer' } - }) -}) - -cmp.setup.cmdline('/', { - sources = { - { name = 'buffer' } - } -}) - --- lsp configuration - -local lsputil = require('lspconfig/util') -local python_venv = require('utils').get_python_venv() -require('lspconfig').pylsp.setup{ - cmd = {'pylsp', '-v'}, - cmd_env = { - VIRTUAL_ENV = python_venv, - PATH = lsputil.path.join(python_venv, 'bin') .. ':' .. vim.env.PATH - }, -} - -require('lspconfig').clangd.setup{} -require('lspconfig').elixirls.setup{ cmd = {'elixir-ls'} } -require('lspconfig').eslint.setup{} -require('lspconfig').terraformls.setup{} - --- org - -require('trouble').setup{} - --- syntactic sugar - -require('indent_guides').setup{ - indent_enable=true; - exclude_filetypes={ - 'calendar', - 'gitcommit', - 'help', - 'NvimTree', - }; -} - -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_javascript = { - max_lines = 4096, - }, - - filetype_json = { - max_lines = 4096, - }, - - filetype_typescript = { - max_lines = 4096, - }, -} - -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/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' +} diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index aa04dce..ef8fb95 100755 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -11,12 +11,21 @@ o.autochdir = false o.smarttab = true o.number = true o.list = true +o.mouse = '' o.swapfile = false -- o.foldmethod = 'expr' -- o.foldexpr = 'nvim_treesitter#foldexpr()' +local format = function(diagnostic) + if diagnostic.severity == vim.diagnostic.severity.ERROR then + -- return string.format("E: %s", diagnostic.message) + return diagnostic.message .. diagnostic.source + end + return diagnostic.message +end + cmd 'syntax enable' cmd 'filetype on' cmd 'filetype plugin on' @@ -24,7 +33,30 @@ cmd 'filetype indent on' cmd 'colorscheme colorscheme' vim.cmd([[ -au BufNewFile,BufRead *.Dockerfile,Dockerfile.* setlocal filetype=dockerfile -au BufNewFile,BufRead *.j2*,*.jinja* setlocal filetype=django -au BufNewFile,BufRead *.env* setlocal filetype=sh + au BufNewFile,BufRead *.Dockerfile,Dockerfile.* setlocal filetype=dockerfile + au BufNewFile,BufRead *.j2*,*.jinja* setlocal filetype=django + au BufNewFile,BufRead */task/config setlocal filetype=taskrc + au BufNewFile,BufRead *.env* setlocal filetype=sh + + au BufNewFile,BufRead */playbooks/*.yml set filetype=yaml.ansible + + au BufNewFile,BufRead */.config/neomutt/* + \ if &filetype == "" | + \ setlocal filetype=neomuttrc | + \ endif ]]) + +--[[ +require'nvim-treesitter.configs'.setup { + textobjects = { + lsp_interop = { + enable = true, + border = 'none', + peek_definition_code = { + ["<space>k"] = "@function.outer", + ["<space>K"] = "@class.outer", + }, + }, + }, +} +]]-- |