diff --git a/nvim/init.vim b/nvim/init.vim deleted file mode 100644 index f84e8b66b..000000000 --- a/nvim/init.vim +++ /dev/null @@ -1,194 +0,0 @@ -let plug_install = 0 -let autoload_plug_path = stdpath('config') . '/autoload/plug.vim' -if !filereadable(autoload_plug_path) - silent exe '!curl -fL --create-dirs -o ' . autoload_plug_path . - \ ' https://raw.github.com/junegunn/vim-plug/master/plug.vim' - execute 'source ' . fnameescape(autoload_plug_path) - let plug_install = 1 -endif -unlet autoload_plug_path - -call plug#begin('~/.dotfiles/nvim/plugins') -" Plugins here - -" LSP - Language Server Protocol -Plug 'neovim/nvim-lspconfig' -Plug 'hrsh7th/cmp-nvim-lsp' -Plug 'hrsh7th/cmp-buffer' -Plug 'hrsh7th/cmp-path' -Plug 'hrsh7th/cmp-cmdline' -Plug 'hrsh7th/nvim-cmp' -" TreeSitter - Syntax highlighting -Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} -" Fold-Cycle - Better management of foldable blocks -Plug 'jghauser/fold-cycle.nvim' -" Git Gutter - Git diff markers -Plug 'airblade/vim-gitgutter' -" Lightline - lightweight status/tabline beautification -Plug 'itchyny/lightline.vim' -" Nerdtree - Tree explorer -Plug 'preservim/nerdtree' -" Conqueror of Completion -Plug 'neoclide/coc.nvim', {'branch': 'release'} -Plug 'bmeneg/coc-perl', {'do': 'yarn install && yarn build'} -" Dart lsp -Plug 'dart-lang/dart-vim-plugin' - -call plug#end() - -let g:coc_global_extensions = ['coc-json', 'coc-html', 'coc-python', 'coc-php', 'coc-perl', 'coc-flutter', 'coc-git'] -if plug_install - PlugInstall --sync -endif -unlet plug_install - -source $HOME/.dotfiles/vim/generic - -lua <lua vim.lsp.buf.declaration()', opts) - buf_set_keymap('n', 'gd', 'tab split | lua vim.lsp.buf.definition()', opts) - buf_set_keymap('n', 'K', 'lua vim.lsp.buf.hover()', opts) - buf_set_keymap('n', 'gi', 'lua vim.lsp.buf.implementation()', opts) - buf_set_keymap('n', 't', 'lua vim.lsp.buf.signature_help()', opts) - buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) - buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) - buf_set_keymap('n', 'e', 'lua vim.diagnostic.open_float(0, {{opts2}, scope="line", border="rounded"})', opts) - buf_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev({ float = { border = "rounded" }})', opts) - buf_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next({ float = { border = "rounded" }})', opts) - buf_set_keymap("n", "q", "lua vim.diagnostic.setloclist({open = true})", opts) - -- Set some keybinds conditional on server capabilities - if client.resolved_capabilities.document_formatting then - buf_set_keymap("n", "lf", "lua vim.lsp.buf.formatting()", opts) - end - if client.resolved_capabilities.document_range_formatting then - buf_set_keymap("n", "lf", "lua vim.lsp.buf.formatting()", opts) - end -end --- NOTE: Don't use more than 1 servers otherwise nvim is unstable -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) -capabilities.textDocument.completion.completionItem.snippetSupport = true --- Use pylsp -nvim_lsp.pylsp.setup({ - on_attach = on_attach, - settings = { - pylsp = { - plugins = { - pylint = { enabled = true, executable = "pylint" }, - pyflakes = { enabled = true }, - pycodestyle = { enabled = false }, - jedi_completion = { fuzzy = true }, - pyls_isort = { enabled = true }, - pylsp_mypy = { enabled = true }, - }, - }, }, - flags = { - debounce_text_changes = 200, - }, - capabilities = capabilities, -}) --- Use pyright or jedi_language_server ---local servers = {'jedi_language_server'} ---local servers = {'pyright'} ---for _, lsp in ipairs(servers) do ---nvim_lsp[lsp].setup({ --- on_attach = on_attach, --- capabilities = capabilities ---}) ---end --- Change diagnostic signs. -vim.fn.sign_define("DiagnosticSignError", { text = "✗", texthl = "DiagnosticSignError" }) -vim.fn.sign_define("DiagnosticSignWarn", { text = "!", texthl = "DiagnosticSignWarn" }) -vim.fn.sign_define("DiagnosticSignInformation", { text = "", texthl = "DiagnosticSignInfo" }) -vim.fn.sign_define("DiagnosticSignHint", { text = "", texthl = "DiagnosticSignHint" }) --- global config for diagnostic -vim.diagnostic.config({ - underline = false, - virtual_text = true, - signs = true, - severity_sort = true, -}) --- Change border of documentation hover window, See https://github.com/neovim/neovim/pull/13998. -vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { - border = "rounded", -}) - -require'lspconfig'.perlpls.setup() - -require('fold-cycle').setup({ - open_if_closed = true, - close_if_opened = true, - softwrap_movement_fix = true, -}) -vim.keymap.set('n', '', - function() return require('fold-cycle').open() end, - {silent = true, desc = 'Fold-cycle: open folds'}) -vim.keymap.set('n', '', - function() return require('fold-cycle').close() end, - {silent = true, desc = 'Fold-cycle: close folds'}) -vim.keymap.set('n', 'zC', - function() return require('fold-cycle').close_all() end, - {remap = true, silent = true, desc = 'Fold-cycle: close all folds'}) -EOF - -set foldmethod=expr -set cursorline -set foldexpr=nvim_treesitter#foldexpr()