# HG changeset patch # User zegervdv # Date 1598340959 -7200 # Node ID dd8b9d0c0e4159e0c8cdf81b2a0552d6fde92f1e # Parent 994e456b145e2898b8cb23717b4ace83b3d658bb Move lua config to lua.init diff -r 994e456b145e -r dd8b9d0c0e41 dot_config/nvim/init.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dot_config/nvim/init.lua Tue Aug 25 09:35:59 2020 +0200 @@ -0,0 +1,77 @@ +local lsp = require'nvim_lsp' + +require "nvim-treesitter.highlight" +-- local hlmap = vim.treesitter.TSHighlighter.hl_map + +require'nvim-treesitter.configs'.setup { + highlight = { + enable = true, + }, + incremental_selection = { + enable = true, + keymaps = { + init_selection = "gnn", + node_incremental = "grn", + scope_incremental = "grc", + node_decremental = "grm", + } + }, + refactor = { + smart_rename = { + enable = true, + keymaps = { + smart_rename = "grr", + }, + }, + navigation = { + enable = true, + keymaps = { + goto_definition = "gnd", + list_definitions = "gnD", + }, + }, + }, +} + +local chain_complete_list = { + default = { + default = { + {complete_items = {'lsp', 'snippet'}}, + {complete_items = {'path'}, triggered_only = {'/'}}, + }, + string = { + {complete_items = {'path'}, triggered_only = {'/'}}, + }, + comment = {}, + } +} + +local on_attach = function(client) + require'diagnostic'.on_attach({ + -- enable_virtual_text = 1, + -- virtual_text_prefix = 'F', + }) + require'completion'.on_attach({ + sorting = 'alphabet', + matching_strategy_list = {'exact', 'fuzzy'}, + chain_complete_list = chain_complete_list, + }) + -- This came from https://github.com/tjdevries/config_manager/blob/master/xdg_config/nvim/lua/lsp_config.lua + local mapper = function(mode, key, result) + vim.fn.nvim_buf_set_keymap(0, mode, key, result, {noremap=true, silent=true}) + end + + mapper('n', 'gd', 'lua vim.lsp.buf.declaration()') + mapper('n', '', 'lua vim.lsp.buf.definition()') + mapper('n', 'K', 'lua vim.lsp.buf.hover()') + mapper('n', 'gD', 'lua vim.lsp.buf.implementation()') + mapper('n', '1gD', 'lua vim.lsp.buf.type_definition()') + mapper('n', 'gr', 'lua vim.lsp.buf.references()') + mapper('n', 'g0', 'lua vim.lsp.buf.document_symbol()') + mapper('i', '', 'lua vim.lsp.buf.signature_help()') +end + +lsp.pyls.setup{ + cmd = {"pyls"}, + on_attach = on_attach; +} diff -r 994e456b145e -r dd8b9d0c0e41 dot_config/nvim/init.vim --- a/dot_config/nvim/init.vim Tue Aug 25 08:56:35 2020 +0200 +++ b/dot_config/nvim/init.vim Tue Aug 25 09:35:59 2020 +0200 @@ -1145,15 +1145,6 @@ autocmd FileType python setlocal path-=** autocmd Filetype python let b:delimitMate_nesting_quotes = ['"', "'"] augroup END -lua << EOF - vim.lsp.set_log_level("debug") -EOF -lua << EOF -require'nvim_lsp'.pyls.setup{ - cmd = {"pyls"}, - on_attach = require'on_attach'.on_attach -} -EOF let g:python_highlight_all=1 " }}} @@ -1283,37 +1274,6 @@ " autocmd BufWritePre * try | undojoin | Neoformat | catch /^Vim\%((\a\+)\)\=:E790/ | finally | silent Neoformat | endtry " augroup END " }}} -lua <