From b3e1ce732b0dde39d2c4ae99cdc3194f82c28a2d Mon Sep 17 00:00:00 2001 From: ray Date: Sun, 19 Sep 2021 13:01:52 +0100 Subject: [PATCH] lspconfig - add snippet support, fix css --- UltiSnips/php.snippets | 12 ++++++ init.plugins.vim | 2 +- lua/init-plugins.lua | 93 +++++++++++++++++++---------------------- spell/en.utf-8.add | 2 + spell/en.utf-8.add.spl | Bin 2266 -> 2284 bytes 5 files changed, 57 insertions(+), 52 deletions(-) diff --git a/UltiSnips/php.snippets b/UltiSnips/php.snippets index a32a09b..c54e5dd 100644 --- a/UltiSnips/php.snippets +++ b/UltiSnips/php.snippets @@ -1,3 +1,15 @@ +snippet pp "" + +endsnippet + +snippet pe "" + +endsnippet + +snippet ph "" + +endsnippet + snippet pf "public function ..." public function $1($2) { $0 diff --git a/init.plugins.vim b/init.plugins.vim index b5f1a69..a5516b8 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -58,7 +58,7 @@ Plug '~/nvim-paper-tonic' Plug 'hrsh7th/cmp-nvim-lsp', { 'branch': 'main' } Plug 'hrsh7th/cmp-buffer', { 'branch': 'main' } Plug 'hrsh7th/cmp-path', { 'branch': 'main' } - " Plug 'hrsh7th/cmp-nvim-ultisnips' + Plug 'quangnguyen30192/cmp-nvim-ultisnips', { 'branch': 'main' } "}}} diff --git a/lua/init-plugins.lua b/lua/init-plugins.lua index 2d81706..0953dad 100644 --- a/lua/init-plugins.lua +++ b/lua/init-plugins.lua @@ -11,32 +11,6 @@ require'nvim-treesitter.configs'.setup { additional_vim_regex_highlighting = false, }, } --- https://github.com/neovim/nvim-lspconfig --- https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md --- npm install -g typescript typescript-language-server -require'lspconfig'.tsserver.setup{} --- npm install -g vim-language-server -require'lspconfig'.vimls.setup{} --- npm install -g pyright -require'lspconfig'.pyright.setup{} --- phpactor installation - --- https://phpactor.readthedocs.io/en/master/usage/standalone.html -require'lspconfig'.phpactor.setup{} --- npm i -g vscode-langservers-extracted -require'lspconfig'.intelephense.setup{} --- npm install -g intelephense -require'lspconfig'.cssls.setup{} --- npm install -g vls -require'lspconfig'.vuels.setup{} --- npm i -g bash-language-server --- TODO - don't run for sh files but have something else instead - shellcheck? -require'lspconfig'.bashls.setup{} --- npm install -g yaml-language-server -require'lspconfig'.yamlls.setup{} --- npm i -g stylelint-lsp -require'lspconfig'.stylelint_lsp.setup{} --- https://github.com/neovim/nvim-lspconfig/wiki -require'lspconfig'.tailwindcss.setup{} --[efm-langserver] @@ -110,20 +84,48 @@ require "lspconfig".efm.setup { } } +-- [lspconfig] + local nvim_lsp = require('lspconfig') +-- Use a loop to conveniently call 'setup' on multiple servers and +-- map buffer local keybindings when the language server attaches +local servers = { + -- npm i -g bash-language-server + -- TODO - don't run for sh files but have something else instead - shellcheck? + 'bashls', + -- npm i -g vscode-langservers-extracted + 'cssls', + -- npm install -g intelephense + 'intelephense', + -- https://phpactor.readthedocs.io/en/master/usage/standalone.html + 'phpactor', + -- npm install -g pyright + 'pyright', + -- npm i -g stylelint-lsp + 'stylelint_lsp', + -- https://github.com/neovim/nvim-lspconfig/wiki + 'tailwindcss', + -- npm install -g typescript typescript-language-server + 'tsserver', + -- npm install -g vim-language-server + 'vimls', + -- npm install -g vls + 'vuels', + -- npm i -g stylelint-lsp + 'yamlls', +} + -- Use an on_attach function to only map the following keys -- after the language server attaches to the current buffer local on_attach = function(client, bufnr) - local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end - local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end + local function buf_set_keymap(...) vim.api.nvim_buf_set_keymap(bufnr, ...) end + local function buf_set_option(...) vim.api.nvim_buf_set_option(bufnr, ...) end -- Enable completion triggered by buf_set_option('omnifunc', 'v:lua.vim.lsp.omnifunc') - -- Mappings. local opts = { noremap=true, silent=true } - -- See `:help vim.lsp.*` for documentation on any of the below functions buf_set_keymap('n', 'gD', 'lua vim.lsp.buf.declaration()', opts) buf_set_keymap('n', 'gd', 'lua vim.lsp.buf.definition()', opts) @@ -142,26 +144,15 @@ local on_attach = function(client, bufnr) -- buf_set_keymap('n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) -- buf_set_keymap('n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) -- buf_set_keymap('n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) - end --- Use a loop to conveniently call 'setup' on multiple servers and --- map buffer local keybindings when the language server attaches -local servers = { - 'bashls', - 'cssls', - 'intelephense', - 'phpactor', - 'pyright', - 'stylelint_lsp', - 'tailwindcss', - 'tsserver', - 'vimls', - 'vuels' -} +local capabilities = vim.lsp.protocol.make_client_capabilities() +capabilities.textDocument.completion.completionItem.snippetSupport = true + for _, lsp in ipairs(servers) do nvim_lsp[lsp].setup { on_attach = on_attach, + capabilities = capabilities, flags = { debounce_text_changes = 150, } @@ -174,11 +165,11 @@ cmp.setup({ keyword_length = 4 -- autocomplete = false }, - -- snippet = { - -- expand = function(args) - -- vim.fn["vsnip#anonymous"](args.body) - -- end, - -- }, + snippet = { + expand = function(args) + vim.fn["vsnip#anonymous"](args.body) + end, + }, mapping = { [''] = cmp.mapping.complete(), [''] = cmp.mapping.confirm({ select = true }), @@ -188,7 +179,7 @@ cmp.setup({ { name = 'buffer' }, { name = 'nvim_lsp' }, { name = 'path' }, - --{ name = 'ultisnips' }, + { name = 'ultisnips' }, ... } }) diff --git a/spell/en.utf-8.add b/spell/en.utf-8.add index 596a301..d309946 100644 --- a/spell/en.utf-8.add +++ b/spell/en.utf-8.add @@ -174,3 +174,5 @@ erimplement particularly movie multivariable +Unsetting +ajax diff --git a/spell/en.utf-8.add.spl b/spell/en.utf-8.add.spl index 5586cabb36af3d1281a70b70bfd6870ee6a8a046..9eee6c13444aa241f418065cdfcd20a3d037783f 100644 GIT binary patch literal 2284 zcmY*a%WfQ15bdhALo9@lV1X1_augv?G@D3K7M6fTVk;pg5hf-?NZH)(zB7G2{h}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