diff --git a/tasks/neovim.yml b/tasks/neovim.yml index 36d771a..3779c71 100644 --- a/tasks/neovim.yml +++ b/tasks/neovim.yml @@ -112,18 +112,10 @@ dest: '{{ xdg_config_dir }}/nvim/after/ftplugin/yaml.lua', } - { src: 'templates/nvim/init.lua.j2', dest: '{{ xdg_config_dir }}/nvim/init.lua' } - - { - src: 'templates/nvim/lua/auto-commands.lua.j2', - dest: '{{ xdg_config_dir }}/nvim/lua/auto-commands.lua', - } - { src: 'templates/nvim/lua/lsp.lua.j2', dest: '{{ xdg_config_dir }}/nvim/lua/lsp.lua', } - - { - src: 'templates/nvim/lua/nvim-cmp.lua.j2', - dest: '{{ xdg_config_dir }}/nvim/lua/nvim-cmp.lua', - } - { src: 'templates/nvim/lua/options.lua.j2', dest: '{{ xdg_config_dir }}/nvim/lua/options.lua', diff --git a/templates/nvim/init.lua.j2 b/templates/nvim/init.lua.j2 index c540171..0240adf 100644 --- a/templates/nvim/init.lua.j2 +++ b/templates/nvim/init.lua.j2 @@ -2,8 +2,6 @@ require('options') require('lsp') -require('nvim-cmp') -require('auto-commands') require('tree-sitter') require('lua-line') require('git-signs') diff --git a/templates/nvim/lua/auto-commands.lua.j2 b/templates/nvim/lua/auto-commands.lua.j2 deleted file mode 100644 index ee6b22c..0000000 --- a/templates/nvim/lua/auto-commands.lua.j2 +++ /dev/null @@ -1,6 +0,0 @@ --- {{ ansible_managed }} - -vim.api.nvim_create_autocmd('Filetype', { - pattern = 'TelescopeResults', - command = [[:setlocal nofoldenable]], -}) diff --git a/templates/nvim/lua/lsp.lua.j2 b/templates/nvim/lua/lsp.lua.j2 index 37b3645..92fbca2 100644 --- a/templates/nvim/lua/lsp.lua.j2 +++ b/templates/nvim/lua/lsp.lua.j2 @@ -68,22 +68,6 @@ nvim_lsp.ruff.setup({ }) -nvim_lsp.pylsp.setup({ - on_attach = on_attach, - capabilities = capabilities, - cmd = { 'pylsp', '--verbose' }, - settings = { - pylsp = { - plugins = { - ruff = { - enabled = false -- now through ruff lsp - } - } - } - }, - root_dir = python_root_dir -}) - nvim_lsp.pyright.setup({ settings = { pyright = { @@ -120,12 +104,25 @@ cmp.setup({ formatting = { format = function(entry, vim_item) - vim_item.menu = string.format('[%s]', entry.source.source.client.name) + if entry.source.name == 'nvim_lsp' then + vim_item.menu = string.format('[%s]', entry.source.source.client.name) + else + vim_item.menu = string.format('[%s]', entry.source.name) + end + return vim_item end, }, mapping = cmp.mapping.preset.insert({ + [''] = cmp.mapping.scroll_docs(-4), + [''] = cmp.mapping.scroll_docs(4), + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.close(), + [''] = cmp.mapping.confirm { + behavior = cmp.ConfirmBehavior.Replace, + select = true, + }, [''] = cmp.mapping(function(fallback) if cmp.visible() then cmp.select_next_item() @@ -152,3 +149,10 @@ cmp.setup({ end, }, }) + +vim.diagnostic.config({ + float = { + source = 'always', + border = border + }, +}) diff --git a/templates/nvim/lua/nvim-cmp.lua.j2 b/templates/nvim/lua/nvim-cmp.lua.j2 deleted file mode 100644 index b013475..0000000 --- a/templates/nvim/lua/nvim-cmp.lua.j2 +++ /dev/null @@ -1,35 +0,0 @@ --- {{ ansible_managed }} - -local cmp = require('cmp') - -cmp.setup { - mapping = { - [''] = cmp.mapping.select_prev_item(), - [''] = cmp.mapping.select_next_item(), - [''] = cmp.mapping.scroll_docs(-4), - [''] = cmp.mapping.scroll_docs(4), - [''] = cmp.mapping.complete(), - [''] = cmp.mapping.close(), - [''] = cmp.mapping.confirm { - behavior = cmp.ConfirmBehavior.Replace, - select = true, - }, - [''] = function(fallback) - if cmp.visible() then - cmp.select_next_item() - else - fallback() - end - end, - [''] = function(fallback) - if cmp.visible() then - cmp.select_prev_item() - else - fallback() - end - end, - }, - sources = { - { name = 'nvim_lsp' }, - }, -} diff --git a/templates/nvim/lua/options.lua.j2 b/templates/nvim/lua/options.lua.j2 index f04251f..36bbe52 100644 --- a/templates/nvim/lua/options.lua.j2 +++ b/templates/nvim/lua/options.lua.j2 @@ -51,13 +51,9 @@ vim.o.cursorline = true -- theme related vim.o.termguicolors = true --- enable statusbar -vim.o.laststatus = 2 -vim.o.statusline = ' %F %m%r%w %= %{hostname()} %{strlen(&ft)?&ft:"none"} %{(&bomb?",BOM":"")} %{&ff} %l/%L %c %P' - -- use a dedicated file explorer vim.g.loaded_netrw = 1 vim.g.loaded_netrwPlugin = 1 -- python interpreter -vim.g.python3_host_prog = './env/bin/python' +vim.g.python3_host_prog = '/usr/bin/python3' diff --git a/vars/archlinux.yml b/vars/archlinux.yml index c76329f..56ae648 100644 --- a/vars/archlinux.yml +++ b/vars/archlinux.yml @@ -6,6 +6,7 @@ packages: - git - vim - neovim + - python-pynvim - wl-clipboard - npm - docker @@ -37,8 +38,6 @@ aur_build_dir: '/usr/local/src' python_build_dir: '/usr/local/src' python_install_dir: '/opt' -# Note that the "python-lsp-server" and "neovim" python -# packages should be installed to the corresponding virtualenv as well. language_servers: - { package: ansible-language-server,