From dc285da74f9d33274996bd3a5e3949543217e468 Mon Sep 17 00:00:00 2001 From: ray Date: Sat, 4 Sep 2021 10:11:03 +0100 Subject: [PATCH 01/35] add treesitter, nvim-langserver, efm-langserver --- init.plugins.vim | 439 ++++++++++++++++++++++++----------------- spell/en.utf-8.add | 6 + spell/en.utf-8.add.spl | Bin 2168 -> 2266 bytes 3 files changed, 259 insertions(+), 186 deletions(-) diff --git a/init.plugins.vim b/init.plugins.vim index 385e8a3..8708923 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -5,51 +5,60 @@ if empty(glob('~/.config/nvim/autoload/plug.vim'))" endif call plug#begin('~/.config/nvim/bundle') +" evaluating +" #nvim-treesitter {{{ + " https://github.com/nvim-treesitter/nvim-treesitter + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} " update the parsers on update + " config needs to be after call to plug#end + + " Treesitter uses a different parser for every language, which needs to be generated + " If the language is already supported by nvim-treesitter, you can install it with + " :TSInstall + " - can use tab completion with this + " Parsers not on this list can be added manually + " + " If you update nvim-treesitter and want to make sure the parser is at the latest compatible version (as specified in nvim-treesitter's lockfile.json), use + " :TSUpdate {language}. + " To update all parsers unconditionally, use + " :TSUpdate all or just :TSUpdate. + " + " Each module provides a distinct tree-sitter-based feature such as highlighting, indentation, or folding; see :h nvim-treesitter-modules or "Available modules" below for a list of modules and their options. +" All modules are disabled by default and need to be activated explicitly in your init.vim +" +" Each module can also be enabled or disabled interactively through the following commands: +" :TSBufEnable {module} " enable module on current buffer +" :TSBufDisable {module} " disable module on current buffer +" :TSEnableAll {module} [{ft}] " enable module on every buffer. If filetype is specified, enable only for this filetype. +" :TSDisableAll {module} [{ft}] " disable module on every buffer. If filetype is specified, disable only for this filetype. +" :TSModuleInfo [{module}] " list information about modules state for each filetype +" +" Check :h nvim-treesitter-commands for a list of all available commands. It may be necessary to reload the buffer (e.g., via :e) after enabling a module interactively. + + "}}} +" #vim-lspconfig {{{ + " https://github.com/neovim/nvim-lspconfig + " https://github.com/neovim/nvim-lspconfig/wiki + Plug 'neovim/nvim-lspconfig' + + " setings after plug#end + "}}} + +" keeping " #vim-hexokinase {{{ " https://github.com/chrisbra/Colorizer + " display colors asynchronously Plug 'chrisbra/Colorizer' " let g:colorizer_use_virtual_text = 1 nnoremap cc :ColorToggle "}}} - -" #coc.nvim{{{ - " https://github.com/neoclide/coc.nvim - - " SEE BOTTOM OF THIS FILE FOR coc#add_extension statement - " for some reason fails when added some other places - - Plug 'neoclide/coc.nvim', {'branch': 'release', 'do': { -> coc#util#install()}} - - let g:coc_snippet_next = '' - let g:coc_snippet_prev = '' - - " inoremap coc#refresh() - nnoremap :call CocAction('doHover') - nnoremap cf :call CocAction('doQuickfix') - nnoremap cg :call CocAction('jumpDefinition') - nnoremap ci :call CocAction('jumpImplementation') - nnoremap cr :call CocAction('jumpReferences') - nnoremap cm :call CocAction('rename') - nnoremap ca :call CocAction('codeAction') - nnoremap cs :call CocAction('documentSymbols') - nnoremap cS :call CocAction('workspaceSymbols') - nnoremap ]c :call CocAction('diagnosticNext') - nnoremap [c :call CocAction('diagnosticPrevious') - command! -nargs=0 Format :call CocAction('format') - command! -nargs=? Fold :call CocAction('fold', ) - -" }}} " #delimitMate{{{ " https://github.com/Raimondi/delimitMate +" automatic quote, paranthesis,etc closing. Plug 'Raimondi/delimitMate' let delimitMate_expand_cr = 1 let delimitMate_expand_space = 1 "}}} -" #echodoc.vim{{{ -" https://github.com/Shougo/echodoc.vim - Plug 'Shougo/echodoc.vim' - "}}} " #emmet-vim {{{ " https://github.com/mattn/emmet-vim Plug 'mattn/emmet-vim' @@ -61,6 +70,7 @@ call plug#begin('~/.config/nvim/bundle') "}}} " #gitgutter {{{ " https://github.com/airblade/vim-gitgutter/blob/master/README.mkd + " show git diff in sign column Plug 'airblade/vim-gitgutter' nmap ]h (GitGutterNextHunk) @@ -72,6 +82,7 @@ call plug#begin('~/.config/nvim/bundle') "}}} " #MatchTagAlways{{{ +" always highlights xml/html tags enclosing cursor " https://github.com/Valloric/MatchTagAlways Plug 'Valloric/MatchTagAlways' let g:mta_filetypes = { @@ -82,26 +93,12 @@ let g:mta_filetypes = { \ 'xml' : 1, \} "}}} -" #phpcomplete.vim{{{ - " https://github.com/shawncplus/phpcomplete.vim - Plug 'shawncplus/phpcomplete.vim' - " https://github.com/dsawardekar/wordpress.vim - " For up to date Wordpress Files see: - " https://github.com/joseluis/wordpress.vim-generator - - "}}} " #quickscope{{{ +" highlights unique characters when using f, F, etc " https://github.com/unblevable/quick-scope Plug 'unblevable/quick-scope' let g:qs_highlight_on_keys = ['f', 'F', 't', 'T'] "}}} -" #rainbow{{{ - " https://github.com/luochen1990/rainbow/blob/master/README.md - Plug 'luochen1990/rainbow' - let g:rainbow_active = 0 - nnoremap 9 :RainbowToggle - nnoremap ( :RainbowToggle - "}}} " #switch {{{ "https://github.com/AndrewRadev/switch.vim Plug 'AndrewRadev/switch.vim' @@ -118,52 +115,6 @@ let g:mta_filetypes = { \ ['private', 'public', 'protected'] \ ] - "}}} -" #tagbar {{{ - " Plug 'majutsushi/tagbar' - " - " nnoremap tb :TagbarOpen fj - " nnoremap ] :tag /[.#@]=expand('') - " let g:tagbar_autoclose = 1 - " " let g:tagbar_autopreview = 1 - " " let g:tagbar_previewwin_pos = '' - " - " let g:tagbar_type_css = { - " \ 'ctagstype' : 'css', - " \ 'kinds' : [ - " \ 'c:classes', - " \ 'i:ids', - " \ 't:tags', - " \ 'm:medias' - " \ ] - " \} - " - " let g:tagbar_type_scss = { - " \ 'ctagstype' : 'scss', - " \ 'kinds' : [ - " \ 'v:variables', - " \ 'c:classes', - " \ 'i:ids', - " \ 't:tags', - " \ 'd:medias', - " \ 'm:mixins', - " \ 'f:functions' - " \ ] - " \} - " - " let g:tagbar_type_vue = { - " \ 'ctagstype' : 'vue', - " \ 'kinds' : [ - " \ 'o:objects', - " \ 'f:functions', - " \ 'a:array', - " \ 's:string', - " \ 'b:boolean', - " \ 'n:number', - " \ 'v:variable' - " \ ] - " \ } - "}}} " #ultisnips {{{ " https://github.com/sirver/UltiSnips @@ -220,72 +171,6 @@ let g:mta_filetypes = { set completefunc=CompleteSnippets "}}} -" #vim-dispatch{{{ - " https://github.com/tpope/vim-dispatch - Plug 'tpope/vim-dispatch' - - "}}} -" #vim-easy-align {{{ - " https://github.com/junegunn/vim-easy-align - Plug 'junegunn/vim-easy-align' - - xmap ga (EasyAlign) - nmap ga (EasyAlign) - - "}}} - " #vim-floaterm{{{ -" https://github.com/voldikss/floaterm - Plug 'voldikss/vim-floaterm' - let g:floaterm_opener = 'edit' - nnoremap lf :FloatermNew --height=0.9 --width=0.9 lf - nnoremap lg :FloatermNew --height=0.9 --width=0.9 lazygit - "}}} -" #vim-gutentags {{{ - " https://github.com/ludovicchabant/vim-gutentags - " Plug 'ludovicchabant/vim-gutentags' - " - " let g:gutentags_ctags_tagfile = '.tags' - " let g:gutentags_ctags_exclude = ['package.json', 'Session.vim', 'package-lock.json', 'TODO.txt'] - " let g:gutentags_resolve_symlinks = 1 - - "}}} -" #vim-Jinja2-Syntax{{{ -" https://github.com/studio-vx/Vim-Jinja2-Syntax -" original: https://github.com/Glench/Vim-Jinja2-Syntax - Plug 'studio-vx/Vim-Jinja2-Syntax' - - "}}} -" #vim-shellcheck{{{ -" https://github.com/itspriddle/vim-shellcheck - Plug 'itspriddle/vim-shellcheck' - - "}}} - -" #vim-SyntaxRange{{{ -" https://github.com/inkarkat/vim-SyntaxRange - " Plug 'inkarkat/vim-SyntaxRange' - " command! HiJinja call SyntaxRange#Include('{{', '}}', 'jinja', 'jinjaBraces', 'jinjaVariable') - " command! HiJinja call SyntaxRange#IncludeEx('start=/{{-\?/hs=s+2 end=/-\?}}/he=s-1', 'jinja') -"}}} -" #vim-Styled-components{{{ - "https://github.com/styled-components/vim-styled-components - Plug 'styled-components/vim-styled-components', { 'branch': 'main' } -"}}} -" #wordpress.vim{{{ - " doesn't support universal ctags -" #Plug 'dsawardekar/wordpress.vim' - " This fork does: - " https://github.com/DArcMattr/wordpress.vim/tree/universal-ctags - " Using studio-vx fork - " Plug 'studio-vx/wordpress.vim', { 'branch': 'universal-ctags' } - - "}}} -" #vim-git{{{ - " https://github.com/tpope/vim-git - Plug 'tpope/vim-git' - - "}}} - " #Netrw {{{ let g:netrw_liststyle=3 @@ -302,17 +187,34 @@ let g:mta_filetypes = { " fork of tpope/vim-obsession Plug 'studio-vx/vim-obsession' - "}}} -" #undotree {{{ - Plug 'mbbill/undotree' - nnoremap ut :UndotreeToggle - "}}} " #tcomment_vim{{{ " https://github.com/tomtom/tcomment_vim Plug 'tomtom/tcomment_vim' "}}} +" #vim-rsi{{{ + "https://github.com/tpope/vim-rsi + Plug 'tpope/vim-rsi' + + "}}} +" #wakatime{{{ + " https://wakatime.com/vim + Plug 'wakatime/vim-wakatime' + + "}}} +" #vim-repeat{{{ + " https://github.com/tpope/vim-repeat + " makes repeat . work for more stuff + Plug 'tpope/vim-repeat' + + "}}} +" #vim-surround{{{ + Plug 'tpope/vim-surround' + + "}}} + +" reconfigure and learn to use properly " #vim-fzf {{{ " https://github.com/junegunn/fzf.vim Plug 'junegunn/fzf' @@ -342,46 +244,211 @@ let g:fzf_colors = \ 'header': ['fg', 'Comment'] } "}}} -" #polyglot{{{ - " https://github.com/sheerun/vim-polyglot - Plug 'sheerun/vim-polyglot' +" #vim-shellcheck{{{ +" https://github.com/itspriddle/vim-shellcheck + Plug 'itspriddle/vim-shellcheck' - " vue options - let g:vue_disable_pre_processors=0 - " set custom syntax highlighting - augroup fixhighlighting - autocmd! - autocmd BufNewFile,BufRead *.vue syntax sync fromstart - augroup END -"}}} + "}}} " #vim-markdown{{{ " https://github.com/plasticboy/vim-markdown Plug 'plasticboy/vim-markdown' let g:vim_markdown_toc_autofit = 1 let g:vim_markdown_fenced_languages = ['bash=sh'] "}}} -" #vim-repeat{{{ - " https://github.com/tpope/vim-repeat - Plug 'tpope/vim-repeat' +" #undotree {{{ + Plug 'mbbill/undotree' + nnoremap ut :UndotreeToggle "}}} -" #vim-rsi{{{ - "https://github.com/tpope/vim-rsi - Plug 'tpope/vim-rsi' + +" do i still need, can i replace? +" #vim-dispatch{{{ + " https://github.com/tpope/vim-dispatch + Plug 'tpope/vim-dispatch' "}}} -" #vim-surround{{{ - Plug 'tpope/vim-surround' +" #phpcomplete.vim{{{ +" improved php completion + " https://github.com/shawncplus/phpcomplete.vim + Plug 'shawncplus/phpcomplete.vim' + " https://github.com/dsawardekar/wordpress.vim + " For up to date Wordpress Files see: + " https://github.com/joseluis/wordpress.vim-generator "}}} -" #wakatime{{{ - " https://wakatime.com/vim - Plug 'wakatime/vim-wakatime' +" #vim-floaterm{{{ +" https://github.com/voldikss/floaterm +" allows to open floating terminal + Plug 'voldikss/vim-floaterm' + let g:floaterm_opener = 'edit' + nnoremap lf :FloatermNew --height=0.9 --width=0.9 lf + nnoremap lg :FloatermNew --height=0.9 --width=0.9 lazygit + "}}} +" #vim-Jinja2-Syntax{{{ +" https://github.com/studio-vx/Vim-Jinja2-Syntax +" original: https://github.com/Glench/Vim-Jinja2-Syntax + Plug 'studio-vx/Vim-Jinja2-Syntax' + + "}}} + +" ------------------------------------------------------------------------------ + +" get rid +" #coc.nvim{{{ + " https://github.com/neoclide/coc.nvim + + " SEE BOTTOM OF THIS FILE FOR coc#add_extension statement + " for some reason fails when added some other places + + " Plug 'neoclide/coc.nvim', {'branch': 'release', 'do': { -> coc#util#install()}} + + " let g:coc_snippet_next = '' + " let g:coc_snippet_prev = '' + + " inoremap coc#refresh() + nnoremap :call CocAction('doHover') + nnoremap cf :call CocAction('doQuickfix') + nnoremap cg :call CocAction('jumpDefinition') + nnoremap ci :call CocAction('jumpImplementation') + nnoremap cr :call CocAction('jumpReferences') + nnoremap cm :call CocAction('rename') + nnoremap ca :call CocAction('codeAction') + nnoremap cs :call CocAction('documentSymbols') + nnoremap cS :call CocAction('workspaceSymbols') + nnoremap ]c :call CocAction('diagnosticNext') + nnoremap [c :call CocAction('diagnosticPrevious') + command! -nargs=0 Format :call CocAction('format') + command! -nargs=? Fold :call CocAction('fold', ) + +" }}} +" #polyglot{{{ + " https://github.com/sheerun/vim-polyglot + " Plug 'sheerun/vim-polyglot' + + " vue options + " let g:vue_disable_pre_processors=0 + " set custom syntax highlighting + " augroup fixhighlighting + " autocmd! + " autocmd BufNewFile,BufRead *.vue syntax sync fromstart + " augroup END +"}}} +" #echodoc.vim{{{ +" https://github.com/Shougo/echodoc.vim +" display function signatures fromm completions in the command line + " Plug 'Shougo/echodoc.vim' + "}}} +" #rainbow{{{ + " https://github.com/luochen1990/rainbow/blob/master/README.md + " Plug 'luochen1990/rainbow' + " let g:rainbow_active = 0 + " nnoremap 9 :RainbowToggle + " nnoremap ( :RainbowToggle + "}}} +" #vim-easy-align {{{ + " https://github.com/junegunn/vim-easy-align + " Plug 'junegunn/vim-easy-align' + " + " xmap ga (EasyAlign) + " nmap ga (EasyAlign) + + "}}} +" #vim-git{{{ + " https://github.com/tpope/vim-git + " Plug 'tpope/vim-git' "}}} call plug#end() runtime macros/matchit.vim +" Configurations + +" #nvim-treesitter {{{ +lua <Sn&sbTc9jxMhRIarKTAvYPGwk=R*x{NjV6jLGz$Mh5nUx z6TWAT+}N8gjdIg)1^AaU-q9pX(oCDiOLfWf9KKa=aSnHmVz?L!umKEUSGzkerp^Wa zBx*A-YtnSut2Dkd85`$r#~*L}ETs5y7Nql{JmsuL9~NDKShN43WQJ?~XZswLJtW)9 z3ZkWtI!us{NAGeYF>9`DKQP5UvMRt~<-Yqbw%gdU5>D(bN{b06cp?2$fhu^(wkC_C z`lfN40=a4MX3c-tDiSj_O})gNV|a~Y5Z#&k2nq=i#40G-TvDi@fhgDtTEtQXtMhWflg;gNo09}Qu(1*wx6z*= z7B)f(3mZF4qm@6vUWG$v4_S8EnR)Ncn|Yi1s#bQl+e(I(Qa$&GE0mtLJs9Z?dl|D(pW93Ir`V`I44j}F%M%Ry!~=$-n2a3$+c13nZZFg! zmqp6R8hOKoVdVNDQOZYLP?+^W={0AunRyDCNqAOIDw6BaCEPfH)bKKiim>!$uMrJv zQu@X@s9E>M0_5gpt-$idkUI4#!c|>$cV;hqGg9Vt3?L9>B_ Date: Sat, 4 Sep 2021 11:40:16 +0100 Subject: [PATCH 02/35] update nvim-lspconfig formatt on save --- init.plugins.vim | 100 ++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 95 insertions(+), 5 deletions(-) diff --git a/init.plugins.vim b/init.plugins.vim index 8708923..439fc09 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -407,9 +407,11 @@ require'lspconfig'.yamlls.setup{} require'lspconfig'.stylelint_lsp.setup{} -- https://github.com/neovim/nvim-lspconfig/wiki require'lspconfig'.tailwindcss.setup{} - --- efm-langserver settings --- npm install -g eslint_d +EOF + "}}} +" #efm-langserver {{{ +" npm install -g eslint_d +lua << EOF local eslint = { lintCommand = "eslint_d -f unix --stdin --stdin-filename ${INPUT}", lintStdin = true, @@ -427,10 +429,36 @@ local shellcheck = { "%f:%l:%c: %tote: %m", } } +local flake8 = { + lintCommand = "flake8 --stdin-display-name ${INPUT} -", + lintStdin = true, + lintFormats = {"%f:%l:%c: %m"} +} +local black = { + formatCommand = "black --quiet -", + formatStdin = true +} +-- sudo pacman -Syu jq +local jq = { + lintCommand = "jq ." + } +-- npm install -g fixjson +local fixjson = { + formatCommand = "fixjson" +} local util = require "lspconfig".util +local on_attach = function(client) + if client.resolved_capabilities.document_formatting then + vim.cmd [[augroup lsp_formatting]] + vim.cmd [[autocmd!]] + vim.cmd [[autocmd BufWritePre :lua vim.lsp.buf.formatting_sync({}, 1000)]] + vim.cmd [[augroup END]] + end +end require "lspconfig".efm.setup { init_options = {documentFormatting = true}, - filetypes = {"javascript", "typescript", "sh"}, + on_attach = on_attach, + filetypes = {"javascript", "typescript", "json", "sh", "python"}, root_dir = function(fname) return util.root_pattern("tsconfig.json")(fname) or util.root_pattern(".eslintrc.js", ".git")(fname); @@ -440,12 +468,74 @@ require "lspconfig".efm.setup { languages = { javascript = {eslint}, typescript = {eslint}, + json = {jq, fixjson}, + python = {flake8, black}, sh = {shellcheck} } } } - EOF +" }}} +" #nvim-lspconfig (keybindings etc) {{{ +lua << EOF +local nvim_lsp = require('lspconfig') + +-- 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 + + -- 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) + 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', '', 'lua vim.lsp.buf.signature_help()', opts) + 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) + buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) + buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) + buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) + buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) + buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) + buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) + buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) + buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) + buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', 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', + 'phpactor', + 'pyright', + 'stylelint_lsp', + 'tailwindcss', + 'tsserver', + 'vimls', + 'vuels' +} +for _, lsp in ipairs(servers) do + nvim_lsp[lsp].setup { + on_attach = on_attach, + flags = { + debounce_text_changes = 150, + } + } +end +EOF + "}}} From cec47a2328353921569cb6af5bcbbc3f3d99eb72 Mon Sep 17 00:00:00 2001 From: ray Date: Sat, 4 Sep 2021 11:59:31 +0100 Subject: [PATCH 03/35] efm-langserver format on save --- init.plugins.vim | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/init.plugins.vim b/init.plugins.vim index 439fc09..7c889b5 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -407,11 +407,12 @@ require'lspconfig'.yamlls.setup{} require'lspconfig'.stylelint_lsp.setup{} -- https://github.com/neovim/nvim-lspconfig/wiki require'lspconfig'.tailwindcss.setup{} -EOF - "}}} -" #efm-langserver {{{ -" npm install -g eslint_d -lua << EOF + +-- EOF +-- "}}} + --[efm-langserver] {{{ + +-- " npm install -g eslint_d local eslint = { lintCommand = "eslint_d -f unix --stdin --stdin-filename ${INPUT}", lintStdin = true, @@ -447,7 +448,7 @@ local fixjson = { formatCommand = "fixjson" } local util = require "lspconfig".util -local on_attach = function(client) +local on_attach_efm = function(client) if client.resolved_capabilities.document_formatting then vim.cmd [[augroup lsp_formatting]] vim.cmd [[autocmd!]] @@ -457,7 +458,7 @@ local on_attach = function(client) end require "lspconfig".efm.setup { init_options = {documentFormatting = true}, - on_attach = on_attach, + on_attach = on_attach_efm, filetypes = {"javascript", "typescript", "json", "sh", "python"}, root_dir = function(fname) return util.root_pattern("tsconfig.json")(fname) or @@ -476,7 +477,7 @@ require "lspconfig".efm.setup { } EOF " }}} -" #nvim-lspconfig (keybindings etc) {{{ +" #nvim-lspconfig {{{ lua << EOF local nvim_lsp = require('lspconfig') From 174362d35f32a4b949a1c330561fe7322d1916b2 Mon Sep 17 00:00:00 2001 From: ray Date: Sat, 4 Sep 2021 12:21:35 +0100 Subject: [PATCH 04/35] update completeopt --- init.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.vim b/init.vim index 3c2f644..599e3a1 100644 --- a/init.vim +++ b/init.vim @@ -252,7 +252,7 @@ set hidden set hlsearch -set completeopt=menuone +set completeopt=menuone,noselect set nospell set spelllang=en_gb From 78b7069aa72ba7e4807c6fe416aaabf3d12d1f2c Mon Sep 17 00:00:00 2001 From: ray Date: Sat, 4 Sep 2021 12:21:41 +0100 Subject: [PATCH 05/35] remove unused plugins --- init.plugins.vim | 72 ++---------------------------------------------- 1 file changed, 3 insertions(+), 69 deletions(-) diff --git a/init.plugins.vim b/init.plugins.vim index 7c889b5..552069b 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -293,72 +293,6 @@ let g:vim_markdown_fenced_languages = ['bash=sh'] " ------------------------------------------------------------------------------ -" get rid -" #coc.nvim{{{ - " https://github.com/neoclide/coc.nvim - - " SEE BOTTOM OF THIS FILE FOR coc#add_extension statement - " for some reason fails when added some other places - - " Plug 'neoclide/coc.nvim', {'branch': 'release', 'do': { -> coc#util#install()}} - - " let g:coc_snippet_next = '' - " let g:coc_snippet_prev = '' - - " inoremap coc#refresh() - nnoremap :call CocAction('doHover') - nnoremap cf :call CocAction('doQuickfix') - nnoremap cg :call CocAction('jumpDefinition') - nnoremap ci :call CocAction('jumpImplementation') - nnoremap cr :call CocAction('jumpReferences') - nnoremap cm :call CocAction('rename') - nnoremap ca :call CocAction('codeAction') - nnoremap cs :call CocAction('documentSymbols') - nnoremap cS :call CocAction('workspaceSymbols') - nnoremap ]c :call CocAction('diagnosticNext') - nnoremap [c :call CocAction('diagnosticPrevious') - command! -nargs=0 Format :call CocAction('format') - command! -nargs=? Fold :call CocAction('fold', ) - -" }}} -" #polyglot{{{ - " https://github.com/sheerun/vim-polyglot - " Plug 'sheerun/vim-polyglot' - - " vue options - " let g:vue_disable_pre_processors=0 - " set custom syntax highlighting - " augroup fixhighlighting - " autocmd! - " autocmd BufNewFile,BufRead *.vue syntax sync fromstart - " augroup END -"}}} -" #echodoc.vim{{{ -" https://github.com/Shougo/echodoc.vim -" display function signatures fromm completions in the command line - " Plug 'Shougo/echodoc.vim' - "}}} -" #rainbow{{{ - " https://github.com/luochen1990/rainbow/blob/master/README.md - " Plug 'luochen1990/rainbow' - " let g:rainbow_active = 0 - " nnoremap 9 :RainbowToggle - " nnoremap ( :RainbowToggle - "}}} -" #vim-easy-align {{{ - " https://github.com/junegunn/vim-easy-align - " Plug 'junegunn/vim-easy-align' - " - " xmap ga (EasyAlign) - " nmap ga (EasyAlign) - - "}}} -" #vim-git{{{ - " https://github.com/tpope/vim-git - " Plug 'tpope/vim-git' - - "}}} - call plug#end() runtime macros/matchit.vim @@ -499,9 +433,9 @@ local on_attach = function(client, bufnr) 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', '', 'lua vim.lsp.buf.signature_help()', opts) - 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) + -- 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) buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) From 2e8442b64e13a1cf3090bf41d31b8bfb759af99c Mon Sep 17 00:00:00 2001 From: ray Date: Sat, 4 Sep 2021 13:27:58 +0100 Subject: [PATCH 06/35] add treesitter playground --- init.plugins.vim | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/init.plugins.vim b/init.plugins.vim index 552069b..cfadbb4 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -35,10 +35,9 @@ call plug#begin('~/.config/nvim/bundle') " Check :h nvim-treesitter-commands for a list of all available commands. It may be necessary to reload the buffer (e.g., via :e) after enabling a module interactively. "}}} -" #vim-lspconfig {{{ - " https://github.com/neovim/nvim-lspconfig - " https://github.com/neovim/nvim-lspconfig/wiki - Plug 'neovim/nvim-lspconfig' +" #playground {{{ + " https://github.com/nvim-treesitter/playground + Plug 'nvim-treesitter/playground' " setings after plug#end "}}} @@ -386,7 +385,7 @@ local on_attach_efm = function(client) if client.resolved_capabilities.document_formatting then vim.cmd [[augroup lsp_formatting]] vim.cmd [[autocmd!]] - vim.cmd [[autocmd BufWritePre :lua vim.lsp.buf.formatting_sync({}, 1000)]] + vim.cmd [[autocmd BufWritePre :lua vim.lsp.buf.formatting_seq_sync({}, 1000)]] vim.cmd [[augroup END]] end end From d4a4fde031f0d121f8aa2e4a08f2fc3fad11b71e Mon Sep 17 00:00:00 2001 From: ray Date: Sat, 4 Sep 2021 13:37:48 +0100 Subject: [PATCH 07/35] add treesitter playground --- init.plugins.vim | 5 +++++ init.vim | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/init.plugins.vim b/init.plugins.vim index cfadbb4..660021e 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -38,6 +38,11 @@ call plug#begin('~/.config/nvim/bundle') " #playground {{{ " https://github.com/nvim-treesitter/playground Plug 'nvim-treesitter/playground' + "}}} +" #vim-lspconfig {{{ + " https://github.com/neovim/nvim-lspconfig + " https://github.com/neovim/nvim-lspconfig/wiki + Plug 'neovim/nvim-lspconfig' " setings after plug#end "}}} diff --git a/init.vim b/init.vim index 599e3a1..438f617 100644 --- a/init.vim +++ b/init.vim @@ -15,7 +15,8 @@ function! SynStack()"{{{ endif echo map(synstack(line('.'), col('.')), 'synIDattr(v:val,"name")') '-> ' . synIDattr(synIDtrans(synID(line('.'),col('.'),1)), 'name' ) endfunc -nmap pp :call SynStack() +" nmap pp :call SynStack() +nmap pp :TSHighlightCapturesUnderCursor "}}} function! s:RunShellCommand(cmdline) abort"{{{ " Shell command From 88d230ea3479e4ee69ecbaa76375cd43586c9fc3 Mon Sep 17 00:00:00 2001 From: ray Date: Sat, 4 Sep 2021 14:20:45 +0100 Subject: [PATCH 08/35] add lsp diagnostic virtual text colors --- init.plugins.vim | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/init.plugins.vim b/init.plugins.vim index 660021e..8531aa1 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -5,6 +5,10 @@ if empty(glob('~/.config/nvim/autoload/plug.vim'))" endif call plug#begin('~/.config/nvim/bundle') +" colorscheme (temporary) +Plug 'https://github.com/marko-cerovac/material.nvim' +let g:material_style = 'lighter' + " evaluating " #nvim-treesitter {{{ " https://github.com/nvim-treesitter/nvim-treesitter @@ -35,7 +39,7 @@ call plug#begin('~/.config/nvim/bundle') " Check :h nvim-treesitter-commands for a list of all available commands. It may be necessary to reload the buffer (e.g., via :e) after enabling a module interactively. "}}} -" #playground {{{ +" #playground (temporary) {{{ " https://github.com/nvim-treesitter/playground Plug 'nvim-treesitter/playground' "}}} From 16266dada95941a0b24fcf3ec4e63cdd00b17518 Mon Sep 17 00:00:00 2001 From: ray Date: Sun, 5 Sep 2021 17:48:05 +0100 Subject: [PATCH 09/35] add lsp diagnostics color scheme --- colors/paper-custom.erb | 2 +- colors/paper-custom.vim | 15 +++++---------- 2 files changed, 6 insertions(+), 11 deletions(-) diff --git a/colors/paper-custom.erb b/colors/paper-custom.erb index 8b62d23..c82fa7e 100644 --- a/colors/paper-custom.erb +++ b/colors/paper-custom.erb @@ -73,7 +73,7 @@ ui_fg_error = ["#d70000", 196, "red"] ui_fg_warning = ["#d75f00", 166, "yellow"] - ui_fg_question = ["#56acd7", 247, "darkgray"] + ui_fg_question = ["#d7a100", 247, "darkgray"] # Step 3: highlights highlights = [ diff --git a/colors/paper-custom.vim b/colors/paper-custom.vim index 672bddc..29aed03 100644 --- a/colors/paper-custom.vim +++ b/colors/paper-custom.vim @@ -91,7 +91,7 @@ if ($TERM =~ '256' || &t_Co >= 256) || has("gui_running") hi ErrorMsg ctermbg=NONE ctermfg=196 cterm=italic guibg=NONE guifg=#d70000 gui=italic hi ModeMsg ctermbg=NONE ctermfg=255 cterm=italic guibg=NONE guifg=#555555 gui=italic hi MoreMsg ctermbg=NONE ctermfg=255 cterm=italic guibg=NONE guifg=#555555 gui=italic - hi Question ctermbg=NONE ctermfg=247 cterm=italic guibg=NONE guifg=#56acd7 gui=italic + hi Question ctermbg=NONE ctermfg=247 cterm=italic guibg=NONE guifg=#d7a100 gui=italic hi WarningMsg ctermbg=NONE ctermfg=166 cterm=italic guibg=NONE guifg=#d75f00 gui=italic hi CursorColumn ctermbg=250 ctermfg=NONE cterm=NONE guibg=#eeeeee guifg=NONE gui=NONE hi EndOfBuffer ctermbg=234 ctermfg=234 cterm=NONE guibg=#ffffff guifg=#ffffff gui=NONE @@ -297,19 +297,14 @@ if ($TERM =~ '256' || &t_Co >= 256) || has("gui_running") hi link jsonValue String hi link jsonQuote Noise hi link octobercmsSectionDelimiter Noise - hi link CocErrorSign ErrorMsg - hi link CocWarningSign WarningMsg - hi link CocInfoSign Question - hi link CocHintSign Question - hi link CocHighlightText IncSearch - hi link CocUnderline Error + hi link LspDiagnosticsDefaultError ErrorMsg + hi link LspDiagnosticsDefaultWarning WarningMsg + hi link LspDiagnosticsDefaultInformation Question + hi link LspDiagnosticsDefaultHint Question hi link LspErrorText ErrorMsg hi link LspWarningText WarningMsg hi link LspInformationText Question hi link LspHintText Question - hi link ALEError CocUnderline - hi link ALEErrorSign ErrorMsg - hi link ALEErrorSign ErrorMsg hi link mkdCodeStart Comment hi link mkdListItem Conditional hi link netrwTreeBar Noise From f7cee27291522965d706de2ffb50839efecf756b Mon Sep 17 00:00:00 2001 From: ray Date: Sun, 5 Sep 2021 17:52:28 +0100 Subject: [PATCH 10/35] add nvim-cmp --- init.plugins.vim | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/init.plugins.vim b/init.plugins.vim index 8531aa1..a881c26 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -50,6 +50,16 @@ let g:material_style = 'lighter' " setings after plug#end "}}} +" #nvim-cmp {{{ + " https://github.com/hrsh7th/nvim-cmp/ + " completion + Plug 'hrsh7th/nvim-cmp' + Plug 'hrsh7th/cmp-nvim-lsp' + Plug 'hrsh7th/cmp-buffer' + Plug 'hrsh7th/cmp-path' + " Plug 'hrsh7th/cmp-nvim-ultisnips' + + "}}} " keeping " #vim-hexokinase {{{ @@ -480,6 +490,35 @@ end EOF "}}} +" #cmp-nvim-ultisnips {{{ +lua <'] = cmp.mapping.complete(), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.abort(), + }, + sources = { + { name = 'buffer' }, + { name = 'nvim_lsp' }, + { name = 'path' }, + --{ name = 'ultisnips' }, + ... + } + }) +EOF + + "}}} From 17cdb1b4b5a3962c9940e4ca151dffae2635c4cd Mon Sep 17 00:00:00 2001 From: ray Date: Sun, 5 Sep 2021 18:32:21 +0100 Subject: [PATCH 11/35] remove unused mappings --- init.vim | 39 --------------------------------------- 1 file changed, 39 deletions(-) diff --git a/init.vim b/init.vim index 438f617..d80c520 100644 --- a/init.vim +++ b/init.vim @@ -329,23 +329,11 @@ set conceallevel=0 "----------------------------------------------------------------------------}}} " #mappings {{{ let g:mapleader = ' ' -" image capable file browser -nnoremap rs :!VIMRUNTIME= st -t WM_FORCE_FULLSCREEN ranger -" search and replace {{{ -nnoremap rr :%s/\<=expand('')\>//g -"}}} -" #syntax -nnoremap s :syntax on -nnoremap S :syntax off " miscallaneous {{{ -nnoremap fc :set foldcolumn= nnoremap l :colorscheme paper-custom -nnoremap c :call ToggleHighlights() nnoremap d :colorscheme monotonous-dark nnoremap 0 ^ nnoremap cs :let @/="" -nnoremap : :setlocal number: -nnoremap rc :so $MYVIMRC nnoremap nh (&hls && v:hlsearch ? ':nohls' : ':set hls')."\n" " Focus on current fold, close the rest nnoremap zz zMzvzt @@ -354,20 +342,6 @@ tnoremap " open quickfix window of TODOs nnoremap td :grep -RE '(TODO\\|FIXME)' .:botright cwindow:echo len(getqflist()) 'TODOs' " sync highlighting from start -nnoremap ss :syntax sync fromstart - -"}}} -" git mappings {{{ -nnoremap ga :!clear; git add %; git status -nnoremap gg :!clear; git add %; git commit -m '' -nnoremap gs :!VIMRUNTIME= st -t WM_FORCE_FLOATING -g 230x62 tig status - -"}}} -" movement/navigation{{{ -" alias for :tjump -nnoremap tj g -" alias for :ptjump -nnoremap tp g} "}}} " location list and quickfix mappings {{{ @@ -389,21 +363,8 @@ nnoremap qn :cnewer "}}} " insert mode mappings {{{ -inoremap jj; A; -inoremap jj, A, inoremap jjrg :reg -inoremap :w :w -inoremap [:w :w -inoremap {:w :w -nnoremap ''; ''; -"}}} -" working_with_underscores{{{ -nnoremap w f_l -nnoremap b hT_ -nnoremap e lt_ -onoremap u t_ -onoremap U f_ "}}} "----------------------------------------------------------------------------}}} " #abbreviations {{{ From e20854512032df550151536aee4139f0bbc7d490 Mon Sep 17 00:00:00 2001 From: ray Date: Sun, 5 Sep 2021 19:27:27 +0100 Subject: [PATCH 12/35] move lua config to separate module --- init.plugins.vim | 209 +------------------------------------------ lua/init-plugins.lua | 185 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 187 insertions(+), 207 deletions(-) create mode 100644 lua/init-plugins.lua diff --git a/init.plugins.vim b/init.plugins.vim index a881c26..666fa86 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -241,7 +241,6 @@ Plug 'junegunn/fzf.vim' nnoremap fg :GFiles nnoremap ff :Files nnoremap fh :History -nnoremap ft :Tags nnoremap fb :Buffers nnoremap fH :Helptags @@ -254,7 +253,7 @@ let g:fzf_colors = \ 'bg+': ['bg', 'CursorLine', 'CursorColumn'], \ 'hl+': ['fg', 'WildMenu'], \ 'info': ['fg', 'Comment'], - \ 'border': ['fg', 'Ignore'], + \ 'border': ['fg', 'Comment'], \ 'prompt': ['fg', 'Constant'], \ 'pointer': ['fg', 'Special'], \ 'marker': ['fg', 'Keyword'], @@ -314,213 +313,9 @@ let g:vim_markdown_fenced_languages = ['bash=sh'] call plug#end() runtime macros/matchit.vim -" Configurations - -" #nvim-treesitter {{{ lua < :lua vim.lsp.buf.formatting_seq_sync({}, 1000)]] - vim.cmd [[augroup END]] - end -end -require "lspconfig".efm.setup { - init_options = {documentFormatting = true}, - on_attach = on_attach_efm, - filetypes = {"javascript", "typescript", "json", "sh", "python"}, - root_dir = function(fname) - return util.root_pattern("tsconfig.json")(fname) or - util.root_pattern(".eslintrc.js", ".git")(fname); - end, - settings = { - rootMarkers = {".eslintrc.js", ".git/"}, - languages = { - javascript = {eslint}, - typescript = {eslint}, - json = {jq, fixjson}, - python = {flake8, black}, - sh = {shellcheck} - } - } -} -EOF -" }}} -" #nvim-lspconfig {{{ -lua << EOF -local nvim_lsp = require('lspconfig') - --- 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 - - -- 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) - 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', '', 'lua vim.lsp.buf.signature_help()', opts) - -- 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) - buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) - buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) - buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) - buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) - buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) - buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) - buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) - buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) - buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', 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', - 'phpactor', - 'pyright', - 'stylelint_lsp', - 'tailwindcss', - 'tsserver', - 'vimls', - 'vuels' -} -for _, lsp in ipairs(servers) do - nvim_lsp[lsp].setup { - on_attach = on_attach, - flags = { - debounce_text_changes = 150, - } - } -end -EOF - - "}}} -" #cmp-nvim-ultisnips {{{ -lua <'] = cmp.mapping.complete(), - [''] = cmp.mapping.confirm({ select = true }), - [''] = cmp.mapping.abort(), - }, - sources = { - { name = 'buffer' }, - { name = 'nvim_lsp' }, - { name = 'path' }, - --{ name = 'ultisnips' }, - ... - } - }) -EOF - - "}}} - - " vim: set fdm=marker ft=vim: diff --git a/lua/init-plugins.lua b/lua/init-plugins.lua new file mode 100644 index 0000000..bee230f --- /dev/null +++ b/lua/init-plugins.lua @@ -0,0 +1,185 @@ +require'nvim-treesitter.configs'.setup { + ensure_installed = "maintained", -- one of "all", "maintained" (parsers with maintainers), or a list of languages + ignore_install = { "c" }, -- List of parsers to ignore installing + highlight = { + enable = true, -- false will disable the whole extension + disable = { "c", "rust" }, -- list of language that will be disabled + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + 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'.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] + +-- " npm install -g eslint_d +local eslint = { + lintCommand = "eslint_d -f unix --stdin --stdin-filename ${INPUT}", + lintStdin = true, + lintFormats = {"%f:%l:%c: %m"}, + lintIgnoreExitCode = true, + formatCommand = "eslint_d --fix-to-stdout --stdin --stdin-filename=${INPUT}", + formatStdin = true +} +local shellcheck = { + lintCommand = "shellcheck -f gcc -x", + lintSource = "shellcheck", + lintFormats = { + "%f:%l:%c: %trror: %m", + "%f:%l:%c: %tarning: %m", + "%f:%l:%c: %tote: %m", + } +} +local flake8 = { + lintCommand = "flake8 --stdin-display-name ${INPUT} -", + lintStdin = true, + lintFormats = {"%f:%l:%c: %m"} +} +local black = { + formatCommand = "black --quiet -", + formatStdin = true +} +-- sudo pacman -Syu jq +local jq = { + lintCommand = "jq ." +} +-- npm install -g fixjson +local fixjson = { + formatCommand = "fixjson" +} +local util = require "lspconfig".util +local on_attach_efm = function(client) + if client.resolved_capabilities.document_formatting then + vim.cmd [[augroup lsp_formatting]] + vim.cmd [[autocmd!]] + vim.cmd [[autocmd BufWritePre :lua vim.lsp.buf.formatting_seq_sync({}, 1000)]] + vim.cmd [[augroup END]] + end +end +require "lspconfig".efm.setup { + init_options = {documentFormatting = true}, + on_attach = on_attach_efm, + filetypes = {"javascript", "typescript", "json", "sh", "python"}, + root_dir = function(fname) + return util.root_pattern("tsconfig.json")(fname) or + util.root_pattern(".eslintrc.js", ".git")(fname); + end, + settings = { + rootMarkers = {".eslintrc.js", ".git/"}, + languages = { + javascript = {eslint}, + typescript = {eslint}, + json = {jq, fixjson}, + python = {flake8, black}, + sh = {shellcheck} + } + } +} + +local nvim_lsp = require('lspconfig') + +-- 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 + + -- 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) + 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', '', 'lua vim.lsp.buf.signature_help()', opts) + -- 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) + buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) + buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) + buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) + buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) + buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) + buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) + buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) + buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) + buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', 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', + 'phpactor', + 'pyright', + 'stylelint_lsp', + 'tailwindcss', + 'tsserver', + 'vimls', + 'vuels' +} +for _, lsp in ipairs(servers) do + nvim_lsp[lsp].setup { + on_attach = on_attach, + flags = { + debounce_text_changes = 150, + } + } +end + +local cmp = require'cmp' +cmp.setup({ + completion = { + keyword_length = 4 + -- autocomplete = false + }, + -- snippet = { + -- expand = function(args) + -- vim.fn["vsnip#anonymous"](args.body) + -- end, + -- }, + mapping = { + [''] = cmp.mapping.complete(), + [''] = cmp.mapping.confirm({ select = true }), + [''] = cmp.mapping.abort(), + }, + sources = { + { name = 'buffer' }, + { name = 'nvim_lsp' }, + { name = 'path' }, + --{ name = 'ultisnips' }, + ... + } +}) From dd6b4f1284f0457c5e474da76c6a4171d0d6a8b0 Mon Sep 17 00:00:00 2001 From: ray Date: Sun, 5 Sep 2021 19:47:46 +0100 Subject: [PATCH 13/35] update --- init.plugins.vim | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/init.plugins.vim b/init.plugins.vim index 666fa86..641b71b 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -47,8 +47,6 @@ let g:material_style = 'lighter' " https://github.com/neovim/nvim-lspconfig " https://github.com/neovim/nvim-lspconfig/wiki Plug 'neovim/nvim-lspconfig' - - " setings after plug#end "}}} " #nvim-cmp {{{ " https://github.com/hrsh7th/nvim-cmp/ @@ -313,6 +311,7 @@ let g:vim_markdown_fenced_languages = ['bash=sh'] call plug#end() runtime macros/matchit.vim +" require lua init module lua < Date: Mon, 6 Sep 2021 12:47:57 +0100 Subject: [PATCH 14/35] add paper-tonic colorscheme --- init.plugins.vim | 3 +++ init.vim | 4 +++- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/init.plugins.vim b/init.plugins.vim index 641b71b..43c9e9d 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -9,6 +9,9 @@ call plug#begin('~/.config/nvim/bundle') Plug 'https://github.com/marko-cerovac/material.nvim' let g:material_style = 'lighter' +" colorscheme in develpment paper-tonic +Plug '~/paper-tonic' + " evaluating " #nvim-treesitter {{{ " https://github.com/nvim-treesitter/nvim-treesitter diff --git a/init.vim b/init.vim index d80c520..841a6a5 100644 --- a/init.vim +++ b/init.vim @@ -2,6 +2,8 @@ " problems if I ever use ruby virtual environments or RVM or similar. let g:ruby_host_prog = '~/.gem/ruby/2.7.0/bin/neovim-ruby-host' +set rtp+='~/paper-tonic' + source ~/.config/nvim/init.plugins.vim source ~/.config/nvim/init.tabline.vim source ~/.config/nvim/init.auto-window.vim @@ -213,7 +215,7 @@ if exists('+termguicolors') set termguicolors endif -colorscheme paper-custom +colorscheme paper-tonic set updatetime=100 set timeoutlen=500 From c6b63d871bd9573c81eebf3699d22cdb448032e3 Mon Sep 17 00:00:00 2001 From: ray Date: Mon, 6 Sep 2021 13:01:43 +0100 Subject: [PATCH 15/35] paper-tonic -> nvim-paper-tonic --- init.plugins.vim | 2 +- init.vim | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/init.plugins.vim b/init.plugins.vim index 43c9e9d..91b708b 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -10,7 +10,7 @@ Plug 'https://github.com/marko-cerovac/material.nvim' let g:material_style = 'lighter' " colorscheme in develpment paper-tonic -Plug '~/paper-tonic' +Plug '~/nvim-paper-tonic' " evaluating " #nvim-treesitter {{{ diff --git a/init.vim b/init.vim index 841a6a5..24c924b 100644 --- a/init.vim +++ b/init.vim @@ -2,7 +2,7 @@ " problems if I ever use ruby virtual environments or RVM or similar. let g:ruby_host_prog = '~/.gem/ruby/2.7.0/bin/neovim-ruby-host' -set rtp+='~/paper-tonic' +set rtp+='~/nvim-paper-tonic' source ~/.config/nvim/init.plugins.vim source ~/.config/nvim/init.tabline.vim From 5c336c9c126c8d40e3395266fca69e7bc51120fb Mon Sep 17 00:00:00 2001 From: ray Date: Mon, 6 Sep 2021 13:24:28 +0100 Subject: [PATCH 16/35] add lua-format --- colors/paper-custom.erb | 12 ------------ lua/init-plugins.lua | 10 ++++++++-- 2 files changed, 8 insertions(+), 14 deletions(-) diff --git a/colors/paper-custom.erb b/colors/paper-custom.erb index c82fa7e..6070c22 100644 --- a/colors/paper-custom.erb +++ b/colors/paper-custom.erb @@ -22,18 +22,6 @@ color_primary = ["#555555", 19, "darkblue"] color_primary_strong = ["#444444", 17, "darkblue"] - # color_primary_weak = ["#898fcb", 20, "blue"] - # color_primary = ["#7e84c6", 19, "darkblue"] - # color_primary_strong = ["#5c6191", 17, "darkblue"] - - # color_primary_weak = ["#9f61c2", 20, "blue"] - # color_primary = ["#8132ad", 19, "darkblue"] - # color_primary_strong = ["#641b8d", 17, "darkblue"] - - # color_primary_weak = ["#ff9800", 20, "blue"] - # color_primary = ["#d68000", 19, "darkblue"] - # color_primary_strong = ["#bc6200", 17, "darkblue"] - color_2_weak = ["#5e955e", 28, "darkgreen"] color_2 = ["#008700", 22, "darkgreen"] color_2_strong = ["#005a00", 22, "darkgreen"] diff --git a/lua/init-plugins.lua b/lua/init-plugins.lua index bee230f..9182001 100644 --- a/lua/init-plugins.lua +++ b/lua/init-plugins.lua @@ -73,6 +73,11 @@ local jq = { local fixjson = { formatCommand = "fixjson" } +-- https://aur.archlinux.org/packages/lua-format/ +local luaformat = { + formatCommand = 'lua-formatt -i', + formatStdin = true +} local util = require "lspconfig".util local on_attach_efm = function(client) if client.resolved_capabilities.document_formatting then @@ -85,7 +90,7 @@ end require "lspconfig".efm.setup { init_options = {documentFormatting = true}, on_attach = on_attach_efm, - filetypes = {"javascript", "typescript", "json", "sh", "python"}, + filetypes = {"javascript", "typescript", "json", "sh", "python", "lua"}, root_dir = function(fname) return util.root_pattern("tsconfig.json")(fname) or util.root_pattern(".eslintrc.js", ".git")(fname); @@ -97,7 +102,8 @@ require "lspconfig".efm.setup { typescript = {eslint}, json = {jq, fixjson}, python = {flake8, black}, - sh = {shellcheck} + sh = {shellcheck}, + lua = {luaformat} } } } From be3f150d12a9ce14952b4f91761faa8c359f15ea Mon Sep 17 00:00:00 2001 From: ray Date: Tue, 7 Sep 2021 13:44:51 +0100 Subject: [PATCH 17/35] update --- init.tabline.vim | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/init.tabline.vim b/init.tabline.vim index 9ac48ef..20f26b9 100644 --- a/init.tabline.vim +++ b/init.tabline.vim @@ -44,7 +44,7 @@ function! MyTabLine() "{{{ let l:file = "''" endif - let l:customtabline .= l:file . ' ' + let l:customtabline .= l:file . '%T%#TabLineFill# ' let l:tabnumber = l:tabnumber + 1 From 0752dda7dc9a4de30dd9bf245319f0dbef6fafb8 Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 8 Sep 2021 14:11:11 +0100 Subject: [PATCH 18/35] add intelephense --- lua/init-plugins.lua | 2 ++ spell/en.utf-8.add | 2 ++ spell/en.utf-8.add.spl | Bin 2266 -> 2266 bytes 3 files changed, 4 insertions(+) diff --git a/lua/init-plugins.lua b/lua/init-plugins.lua index 9182001..1b532cf 100644 --- a/lua/init-plugins.lua +++ b/lua/init-plugins.lua @@ -23,6 +23,8 @@ require'lspconfig'.pyright.setup{} -- 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{} diff --git a/spell/en.utf-8.add b/spell/en.utf-8.add index bc17407..596a301 100644 --- a/spell/en.utf-8.add +++ b/spell/en.utf-8.add @@ -172,3 +172,5 @@ Maclaurin Multivariable erimplement particularly +movie +multivariable diff --git a/spell/en.utf-8.add.spl b/spell/en.utf-8.add.spl index cae246a077a08323f9511c07f9d4506d5ca5b0d6..5586cabb36af3d1281a70b70bfd6870ee6a8a046 100644 GIT binary patch delta 66 zcmca5cuR0Y8jB1g1H+0;#vH~H#!SXC#ze*fATlh|GeoS QA@gh?$=H*+iTxHM07H}!ApigX delta 66 zcmca5cuR0Y8jD;eBO?Q2Pby;$V+ms>V;N&2V-b)}WK05zGpKKFVkux`Vqu*8h4nu- RBLlNYI!M?&dlUODMgSV|4_W{K From 37c02901fbf3de68d80eb9a677ed0e065baa9215 Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 8 Sep 2021 15:45:27 +0100 Subject: [PATCH 19/35] update --- lua/init-plugins.lua | 1 + 1 file changed, 1 insertion(+) diff --git a/lua/init-plugins.lua b/lua/init-plugins.lua index 1b532cf..562c7af 100644 --- a/lua/init-plugins.lua +++ b/lua/init-plugins.lua @@ -150,6 +150,7 @@ end local servers = { 'bashls', 'cssls', + 'intelephense', 'phpactor', 'pyright', 'stylelint_lsp', From 13956ce1782a1525823eee07d503d64867e0d726 Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 8 Sep 2021 15:56:41 +0100 Subject: [PATCH 20/35] update tab settings --- after/ftplugin/python.vim | 8 -------- ftplugin/html.vim | 2 -- ftplugin/javascript.vim | 2 -- init.vim | 4 ++-- 4 files changed, 2 insertions(+), 14 deletions(-) diff --git a/after/ftplugin/python.vim b/after/ftplugin/python.vim index 07cea3a..781849d 100644 --- a/after/ftplugin/python.vim +++ b/after/ftplugin/python.vim @@ -1,11 +1,4 @@ set tabstop=4 -set softtabstop=0 -set shiftwidth=4 -set noexpandtab - -" set softtabstop=8 -" set tabstop=4 -" set shiftwidth=4 set textwidth=88 @@ -16,4 +9,3 @@ set colorcolumn=88 noremap :w:silent !clear;python % :redraw! nnoremap :call SaveAndExecute('python') -command! CTagsPython !ctags -R --fields=+l --languages=python --python-kinds=-iv -f ./.tags-py $(python -c "import os, sys; print(' '.join('{}'.format(d) for d in sys.path if os.path.isdir(d)))") diff --git a/ftplugin/html.vim b/ftplugin/html.vim index b32befc..e69de29 100644 --- a/ftplugin/html.vim +++ b/ftplugin/html.vim @@ -1,2 +0,0 @@ -set tabstop=2 -set shiftwidth=2 diff --git a/ftplugin/javascript.vim b/ftplugin/javascript.vim index 8d449ca..9c6427c 100644 --- a/ftplugin/javascript.vim +++ b/ftplugin/javascript.vim @@ -2,6 +2,4 @@ set iskeyword+=$ -set tabstop=2 -set shiftwidth=2 set foldmethod=syntax diff --git a/init.vim b/init.vim index 24c924b..54b90d6 100644 --- a/init.vim +++ b/init.vim @@ -264,9 +264,9 @@ set diffopt+=vertical set rnu nu -set tabstop=4 +set tabstop=2 set softtabstop=-1 -set shiftwidth=4 +set shiftwidth=0 set shiftround set noexpandtab set autoindent From 0046be65ca422ab6d081d8db43f8465aaea66b50 Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 8 Sep 2021 16:10:05 +0100 Subject: [PATCH 21/35] set ftplugin files to use setlocal not set --- after/ftplugin/html.vim | 2 +- after/ftplugin/javascript.vim | 3 --- after/ftplugin/php.vim | 2 ++ after/ftplugin/python.vim | 10 +++++----- after/ftplugin/sass.vim | 3 +-- after/ftplugin/vim.vim | 2 +- ftplugin/css.vim | 2 +- ftplugin/javascript.vim | 7 ++----- ftplugin/php.vim | 1 - ftplugin/sass.vim | 2 +- ftplugin/vue.vim | 2 +- 11 files changed, 15 insertions(+), 21 deletions(-) create mode 100644 after/ftplugin/php.vim delete mode 100644 ftplugin/php.vim diff --git a/after/ftplugin/html.vim b/after/ftplugin/html.vim index b7086e9..a06a63b 100644 --- a/after/ftplugin/html.vim +++ b/after/ftplugin/html.vim @@ -1 +1 @@ -set foldnestmax=5 +setlocal foldnestmax=5 diff --git a/after/ftplugin/javascript.vim b/after/ftplugin/javascript.vim index 7c7f9dc..101be7c 100644 --- a/after/ftplugin/javascript.vim +++ b/after/ftplugin/javascript.vim @@ -1,6 +1,3 @@ -" NOTE also see ../ftplugin/javascript.vim -set shiftwidth=2 - " https://gist.github.com/romainl/1f50c55b0ee92e5420de51e6c4b38491 nnoremap cF :call CocAction('runCommand', 'eslint.executeAutofix') diff --git a/after/ftplugin/php.vim b/after/ftplugin/php.vim new file mode 100644 index 0000000..9787fb3 --- /dev/null +++ b/after/ftplugin/php.vim @@ -0,0 +1,2 @@ +setlocal iskeyword+=$ +setlocal autoindent diff --git a/after/ftplugin/python.vim b/after/ftplugin/python.vim index 781849d..de126ac 100644 --- a/after/ftplugin/python.vim +++ b/after/ftplugin/python.vim @@ -1,11 +1,11 @@ -set tabstop=4 +setlocal tabstop=4 -set textwidth=88 +setlocal textwidth=88 -set foldmethod=indent -set foldnestmax=1 +setlocal foldmethod=indent +setlocal foldnestmax=1 -set colorcolumn=88 +setlocal colorcolumn=88 noremap :w:silent !clear;python % :redraw! nnoremap :call SaveAndExecute('python') diff --git a/after/ftplugin/sass.vim b/after/ftplugin/sass.vim index 79981e1..d19ac0e 100644 --- a/after/ftplugin/sass.vim +++ b/after/ftplugin/sass.vim @@ -1,2 +1 @@ - -set includeexpr=substitute(substitute(substitute(v:fname,'\%(.*/\|^\)\zs','_',''),'^[\\~@]\/','./',''),'^[\\~@]','./node_modules/','') +setlocal includeexpr=substitute(substitute(substitute(v:fname,'\%(.*/\|^\)\zs','_',''),'^[\\~@]\/','./',''),'^[\\~@]','./node_modules/','') diff --git a/after/ftplugin/vim.vim b/after/ftplugin/vim.vim index 03361bb..57b1e2e 100644 --- a/after/ftplugin/vim.vim +++ b/after/ftplugin/vim.vim @@ -1,2 +1,2 @@ - set foldmethod=marker +setlocal foldmethod=marker diff --git a/ftplugin/css.vim b/ftplugin/css.vim index ea5af32..df4fe48 100644 --- a/ftplugin/css.vim +++ b/ftplugin/css.vim @@ -1 +1 @@ -set iskeyword+=- +setlocal iskeyword+=- diff --git a/ftplugin/javascript.vim b/ftplugin/javascript.vim index 9c6427c..9c0321c 100644 --- a/ftplugin/javascript.vim +++ b/ftplugin/javascript.vim @@ -1,5 +1,2 @@ -" also see after/ftplugin/javascript.vim - -set iskeyword+=$ - -set foldmethod=syntax +setlocal iskeyword+=$ +setlocal foldmethod=syntax diff --git a/ftplugin/php.vim b/ftplugin/php.vim deleted file mode 100644 index 88b6ebc..0000000 --- a/ftplugin/php.vim +++ /dev/null @@ -1 +0,0 @@ -set iskeyword+=$ diff --git a/ftplugin/sass.vim b/ftplugin/sass.vim index 88b6ebc..fc6035c 100644 --- a/ftplugin/sass.vim +++ b/ftplugin/sass.vim @@ -1 +1 @@ -set iskeyword+=$ +setlocal iskeyword+=$ diff --git a/ftplugin/vue.vim b/ftplugin/vue.vim index e34f6bb..5325c8c 100644 --- a/ftplugin/vue.vim +++ b/ftplugin/vue.vim @@ -1,4 +1,4 @@ -set includeexpr=substitute(substitute(v:fname,'^[\\~@]\/','./',''),'^[\\~@]','./node_modules/','') +setlocal includeexpr=substitute(substitute(v:fname,'^[\\~@]\/','./',''),'^[\\~@]','./node_modules/','') setlocal suffixesadd=.js,.vue,.scss setlocal complete=.,w,b,u,i From 0f62bfa83fe7a68cf77ddef7e662811bd0e498ad Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 8 Sep 2021 16:14:14 +0100 Subject: [PATCH 22/35] delete unused files --- after/syntax/gitcommit.vim | 3 - after/syntax/html.vim | 79 ---------------- after/syntax/i3config.vim | 2 - after/syntax/python.vim | 2 - after/syntax/scss.vim | 2 - after/syntax/vim.vim | 2 - after/syntax/vue.html | 61 ------------- coc-settings.json | 40 --------- syntax/cst.vim | 179 ------------------------------------- syntax/octobercms.vim | 18 ---- 10 files changed, 388 deletions(-) delete mode 100644 after/syntax/gitcommit.vim delete mode 100644 after/syntax/html.vim delete mode 100644 after/syntax/i3config.vim delete mode 100644 after/syntax/python.vim delete mode 100644 after/syntax/scss.vim delete mode 100644 after/syntax/vim.vim delete mode 100644 after/syntax/vue.html delete mode 100644 coc-settings.json delete mode 100644 syntax/cst.vim delete mode 100644 syntax/octobercms.vim diff --git a/after/syntax/gitcommit.vim b/after/syntax/gitcommit.vim deleted file mode 100644 index 11db794..0000000 --- a/after/syntax/gitcommit.vim +++ /dev/null @@ -1,3 +0,0 @@ -syn match gitCommitNumber "\<\d\+\>" containedin=gitCommitComment -syn keyword gitCommitAhead ahead containedin=gitCommitOnBranch -syn keyword gitCommitBehind behind containedin=gitCommitOnBranch diff --git a/after/syntax/html.vim b/after/syntax/html.vim deleted file mode 100644 index eb0b8bf..0000000 --- a/after/syntax/html.vim +++ /dev/null @@ -1,79 +0,0 @@ -syn clear htmlArg -syn clear htmlCssDefinition - -" css classes -syn region cssClassRegion contained start=+class="+hs=s+7 end=+"+he=e-1 contains=htmlSpecialChar,cssClassAttr,cssAttrNoise,cssClassName containedin=htmlTag,htmlTagN keepend -syn region cssClassRegion contained start=+class='+hs=s+7 end=+'+he=e-1 contains=htmlSpecialChar,cssClassAttr,cssAttrNoise,cssClassName containedin=htmlTag,htmlTagN keepend -syn region cssClassName contained start=+"+hs=s+1 end=+"+he=e-1 contains=cssAttrNoise keepend -syn region cssClassName contained start=+'+hs=s+1 end=+'+he=e-1 contains=cssAttrNoise keepend -syn match cssClassAttr "class" contained - -" css IDs -syn region cssIdRegion contained start=+id="+hs=s+4 end=+"+he=e-1 contains=htmlSpecialChar,cssIdentifierAttr,cssAttrNoise,cssIdentifier containedin=htmlTag,htmlTagN keepend -syn region cssIdRegion contained start=+id='+hs=s+4 end=+'+he=e-1 contains=htmlSpecialChar,cssIdentifierAttr,cssAttrNoise,cssIdentifier containedin=htmlTag,htmlTagN keepend -syn region cssIdentifier contained start=+"+hs=s+1 end=+"+he=s-1 contains=cssAttrNoise keepend -syn region cssIdentifier contained start=+'+hs=s+1 end=+'+he=s-1 contains=cssAttrNoise keepend -syn match cssIdentifierAttr "id" contained - -" img arguments -syn region htmlArgRegion contained start=+src="+hs=s+5 end=+"+he=e-1 contains=htmlSpecialChar,cssAttrNoise,htmlSrcArg,htmlSrcValue containedin=htmlTag,htmlTagN keepend -syn region htmlArgRegion contained start=+src='+hs=s+5 end=+'+he=e-1 contains=htmlSpecialChar,cssAttrNoise,htmlSrcArg,htmlSrcValue containedin=htmlTag,htmlTagN keepend -syn region htmlSrcValue contained start=+"+hs=s+1 end=+"+he=s-1 contains=cssAttrNoise keepend -syn region htmlSrcValue contained start=+'+hs=s+1 end=+'+he=s-1 contains=cssAttrNoise keepend -syn match htmlSrcArg "src" contained - -syn region htmlArgRegion contained start=+srcset="+hs=s+8 end=+"+he=e-1 contains=htmlSpecialChar,htmlSrcsetArg,htmlSrcsetValue,cssAttrNoise containedin=htmlTag,htmlTagN keepend -syn region htmlArgRegion contained start=+srcset='+hs=s+8 end=+'+he=e-1 contains=htmlSpecialChar,htmlSrcsetArg,htmlSrcsetValue,cssAttrNoise containedin=htmlTag,htmlTagN keepend -syn region htmlSrcsetValue contained start=+"+hs=s+1 end=+"+he=s-1 contains=cssAttrNoise keepend -syn region htmlSrcsetValue contained start=+'+hs=s+1 end=+'+he=s-1 contains=cssAttrNoise keepend -syn match htmlSrcsetArg "srcset" contained - -syn region htmlArgRegion contained start=+\\)" containedin=htmlTag,vueTag,htmlTagN -syn region vueLink start="[^>]*" end=""me=e-14 contains=@Spell,vueTag,htmlEndTag,htmlSpecialChar,htmlPreProc,htmlComment,htmlLeadingSpace,javaScript,@htmlPreproc,vueComponentName -syn region vueTag start=+<[^/]+ end=+>+ fold contained contains=htmlString,htmlArg,htmlValue,htmlTagError,htmlEvent,htmlCssDefinition,@htmlPreproc,@htmlArgCluster,vueDynamicComponent -syn match vueComponentName contained "router-link" containedin=vueTag,htmlEndTag -hi! def link vueLink htmlLink - -syn match vueDynamicComponent contained "\\|\\|\" containedin=htmlTag,vueTag,htmlTagN -syn match vueTransitionComponent contained "\" containedin=htmlTag,vueTag,htmlTagN nextgroup=vueTransitionName,vueTransitionMode -syn region vueTransitionName contained start=+\sname="+hs=s+7 end=+"+he=e-1 containedin=htmlTag,vueTag,htmlTagN -syn region vueTransitionMode contained start=+\smode="+hs=s+7 end=+"+he=e-1 containedin=htmlTag,vueTag,htmlTagN - -syn keyword vueTagSpecial contained template script style containedin=htmlTagN -syn keyword htmlArg contained scoped ts - -" syn region cssClassRegion contained start=+classes="+hs=s+9 end=+"+he=e-1 contains=htmlSpecialChar,cssClassAttr,cssAttrNoise,cssClassName containedin=htmlTag,htmlTagN keepend -" syn region cssClassRegion contained start=+classes='+hs=s+9 end=+'+he=e-1 contains=htmlSpecialChar,cssClassAttr,cssAttrNoise,cssClassName containedin=htmlTag,htmlTagN keepend - -syn match cssClassesAttr contained "\<[-a-zA-z0-9]*class[-a-zA-z0-9]*=" contains=htmlSpecialChar,cssClassAttr,cssAttrNoise,cssClassName containedin=htmlTag,vueTag,htmlTagN keepend nextgroup=vueClassesName - -syn region vueClassesName contained start=+"+hs=s+1 end=+"+he=e-1 - -hi def link cssClassesAttr cssClassAttr -hi def link vueClassesname cssClassName -hi def link vueObjectKey cssClassName -hi def link vueDirectiveClass Noise -hi def link vueDirectiveClassName vueClassesName -hi def link vueMustache Identifier diff --git a/coc-settings.json b/coc-settings.json deleted file mode 100644 index b60e06b..0000000 --- a/coc-settings.json +++ /dev/null @@ -1,40 +0,0 @@ -{ - "suggest.triggerAfterInsertEnter": false, - "suggest.autoTrigger": "always", - "suggest.noselect": true, - "suggest.snippetIndicator": "►", - "suggest.timeout": 1000, - "suggest.echodocSupport": true, - "signature.enable": true, - "diagnostic.enable": true, - "diagnostic.warningSign": "λ", - "diagnostic.errorSign": "Λ", - "diagnostic.infoSign": "λ", - "diagnostic.hintSign": "λ", - "coc.source.buffer.ignoreGitignore": true, - "javascript.validate.enable": false, - "vetur.format.defaultFormatter.js": "prettier-eslint", - "vetur.format.defaultFormatter.html": "prettier", - "vetur.format.defaultFormatter.scss": "prettier", - "scss.validate": true, - "python.linting.flake8Enabled": true, - "python.linting.flake8Path": "/home/ray/.local/bin/flake8", - "python.linting.lintOnSave": true, - "python.formatting.provider": "black", - "python.formatting.blackPath": "/home/ray/.local/bin/black", - "coc.preferences.formatOnSaveFiletypes": ["python", "vue"], - "sh.enable": true, - "sh.highlightParsingErrors": true, - - "css.validate": true, - "stylelint.enable": true, - "stylelint.autoFixOnSave": true, - "prettier.requireConfig": true, - - "eslint.enable": true, - "eslint.autoFixOnSave": true, - "eslint.filetypes": [ - "javascript", - "vue" - ] -} diff --git a/syntax/cst.vim b/syntax/cst.vim deleted file mode 100644 index eb1efbe..0000000 --- a/syntax/cst.vim +++ /dev/null @@ -1,179 +0,0 @@ -" Vim syntax file -" Language: cst -" Maintainer: Thomas R. Kimpton -" URL: http://www.gooberdude.com/~tkimpton/vim/syntax/cst.vim -" Last Change: 5/14/2003 -" Remark: Used to test color schemes: edit your color scheme file, and -" to see what each color assignment does, set the color scheme to your color -" scheme then type the command ':setf cst'. As you continue to make changes -" save your changes, and switch to another color scheme and back to your own -" to see changes. - -" Quit when a syntax file was already loaded -if !exists("main_syntax") - if version < 600 - syntax clear - elseif exists("b:current_syntax") - finish - endif - " we define it here so that included files can test for it - let main_syntax='cst' -endif - -" don't use standard HiLink, it will not work with included syntax files -if version < 508 - command! -nargs=+ CSTHiLink hi link -else - command! -nargs=+ CSTHiLink hi def link -endif - -syntax case ignore - -" match definitions -syn match CSTSpecialKey /\/ -syn match CSTNonText /\/ -syn match CSTDirectory /\/ -syn match CSTErrorMsg /\/ -syn match CSTIncSearch /\/ -syn match CSTSearch /\/ -syn match CSTMoreMsg /\/ -syn match CSTModeMsg /\/ -syn match CSTLineNr /\/ -syn match CSTQuestion /\/ -syn match CSTStatusLineNC /\/ -syn match CSTStatusLine /\/ -syn match CSTVertSplit /\/ -syn match CSTTitle /\/ -syn match CSTVisualNOS /\/ -syn match CSTVisual /\/ -syn match CSTWarningMsg /\/ -syn match CSTWildMenu /\/ -syn match CSTFolded /\/ -syn match CSTFoldColumn /\/ -syn match CSTSignColumn /\/ -syn match CSTDiffAdd /\/ -syn match CSTDiffChange /\/ -syn match CSTDiffDelete /\/ -syn match CSTDiffText /\/ -syn match CSTCursor /\/ -syn match CSTComment /\/ -syn match CSTConstant /\/ -syn match CSTString /\/ -syn match CSTCharacter /\/ -syn match CSTNumber /\/ -syn match CSTBoolean /\/ -syn match CSTFloat /\/ -syn match CSTIdentifier /\/ -syn match CSTFunction /\/ -syn match CSTStatement /\/ -syn match CSTConditional /\/ -syn match CSTRepeat /\/ -syn match CSTLabel /\/ -syn match CSTOperator /\/ -syn match CSTKeyword /\/ -syn match CSTException /\/ -syn match CSTPreProc /\/ -syn match CSTInclude /\/ -syn match CSTDefine /\/ -syn match CSTMacro /\/ -syn match CSTPreCondit /\/ -syn match CSTType /\/ -syn match CSTStorageClass /\/ -syn match CSTStructure /\/ -syn match CSTTypeDef /\/ -syn match CSTSpecial /\/ -syn match CSTSpecialChar /\/ -syn match CSTTag /\/ -syn match CSTDelimiter /\/ -syn match CSTSpecialComment /\/ -syn match CSTDebug /\/ -syn match CSTUnderlined /\/ -syn match CSTIgnore /\/ -syn match CSTError /\/ -syn match CSTSpellBad /\/ -syn match CSTSpellCap /\/ -syn match CSTSpellLocal /\/ -syn match CSTSpellRare /\/ -syn match CSTTodo /\/ - -" The default highlighting. -if version >= 508 || !exists("did_CST_syn_inits") - if version < 508 - let did_CST_syn_inits = 1 - endif - CSTHiLink CSTSpecialKey SpecialKey - CSTHiLink CSTNonText NonText - CSTHiLink CSTDirectory Directory - CSTHiLink CSTErrorMsg ErrorMsg - CSTHiLink CSTIncSearch IncSearch - CSTHiLink CSTSearch Search - CSTHiLink CSTMoreMsg MoreMsg - CSTHiLink CSTModeMsg ModeMsg - CSTHiLink CSTLineNr LineNr - CSTHiLink CSTQuestion Question - CSTHiLink CSTStatusLineNC StatusLineNC - CSTHiLink CSTStatusLine StatusLine - CSTHiLink CSTVertSplit VertSplit - CSTHiLink CSTTitle Title - CSTHiLink CSTVisualNOS VisualNOS - CSTHiLink CSTVisual Visual - CSTHiLink CSTWarningMsg WarningMsg - CSTHiLink CSTWildMenu WildMenu - CSTHiLink CSTFolded Folded - CSTHiLink CSTFoldColumn FoldColumn - CSTHiLink CSTSignColumn SignColumn - CSTHiLink CSTDiffAdd DiffAdd - CSTHiLink CSTDiffChange DiffChange - CSTHiLink CSTDiffDelete DiffDelete - CSTHiLink CSTDiffText DiffText - CSTHiLink CSTCursor Cursor - CSTHiLink CSTComment Comment - CSTHiLink CSTConstant Constant - CSTHiLink CSTString String - CSTHiLink CSTCharacter Character - CSTHiLink CSTNumber Number - CSTHiLink CSTBoolean Boolean - CSTHiLink CSTFloat Float - CSTHiLink CSTIdentifier Identifier - CSTHiLink CSTFunction Function - CSTHiLink CSTStatement Statement - CSTHiLink CSTConditional Conditional - CSTHiLink CSTRepeat Repeat - CSTHiLink CSTLabel Label - CSTHiLink CSTOperator Operator - CSTHiLink CSTKeyword Keyword - CSTHiLink CSTException Exception - CSTHiLink CSTPreProc PreProc - CSTHiLink CSTInclude Include - CSTHiLink CSTDefine Define - CSTHiLink CSTMacro Macro - CSTHiLink CSTPreCondit PreCondit - CSTHiLink CSTType Type - CSTHiLink CSTStorageClass StorageClass - CSTHiLink CSTStructure Structure - CSTHiLink CSTTypedef Typedef - CSTHiLink CSTSpecial Special - CSTHiLink CSTSpecialChar SpecialChar - CSTHiLink CSTTag Tag - CSTHiLink CSTDelimiter Delimiter - CSTHiLink CSTSpecialComment SpecialComment - CSTHiLink CSTDebug Debug - CSTHiLink CSTUnderlined Underlined - CSTHiLink CSTIgnore Ignore - CSTHiLink CSTError Error - CSTHiLink CSTSpellBad SpellBad - CSTHiLink CSTSpellCap SpellCap - CSTHiLink CSTSpellLocal SpellLocal - CSTHiLink CSTSpellRare SpellRare - CSTHiLink CSTTodo Todo -endif - -delcommand CSTHiLink - -let b:current_syntax = "cst" - -if main_syntax == 'cst' - unlet main_syntax -endif - -" vim: set filetype=cst: diff --git a/syntax/octobercms.vim b/syntax/octobercms.vim deleted file mode 100644 index a2f1706..0000000 --- a/syntax/octobercms.vim +++ /dev/null @@ -1,18 +0,0 @@ -if exists("b:current_syntax") - finish -endif - -" changing order of following 4 lines breaks highlighting TODO - why? -syntax include @octoberPHP syntax/php.vim -unlet! b:current_syntax -syntax include @octoberConfig syntax/dosini.vim -runtime! syntax/jinja.vim - -syntax region octoberConfig start=@\%^\([a-zA-z]\+[a-zA-Z0-9]\+\s*=\s*\("\|'\)\)\|\[\s*[a-zA-Z0-9]\+\s*\]@ end=+^==$+me=e-2 contains=@octoberConfig -syntax region octoberPHP start=+^==$+ms=s+2 end=+^==$+me=e-2 contains=@octoberPHP - -" FIXME - why these no work! -" syntax match octobercmsSectionDelimiter "^==$" -" highlight link octobercmsSectionDelimiter Comment - -let b:current_syntax = "octobercms" From fad1f15ad4a5ffeaf7779a4f4266b7b80526276f Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 8 Sep 2021 16:43:54 +0100 Subject: [PATCH 23/35] fix vim-plug error for non-master branches --- init.plugins.vim | 19 +++++-------------- 1 file changed, 5 insertions(+), 14 deletions(-) diff --git a/init.plugins.vim b/init.plugins.vim index 91b708b..cd854f4 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -6,7 +6,7 @@ endif call plug#begin('~/.config/nvim/bundle') " colorscheme (temporary) -Plug 'https://github.com/marko-cerovac/material.nvim' +Plug 'https://github.com/marko-cerovac/material.nvim', { 'branch': 'main' } let g:material_style = 'lighter' " colorscheme in develpment paper-tonic @@ -54,10 +54,10 @@ Plug '~/nvim-paper-tonic' " #nvim-cmp {{{ " https://github.com/hrsh7th/nvim-cmp/ " completion - Plug 'hrsh7th/nvim-cmp' - Plug 'hrsh7th/cmp-nvim-lsp' - Plug 'hrsh7th/cmp-buffer' - Plug 'hrsh7th/cmp-path' + Plug 'hrsh7th/nvim-cmp', { 'branch': 'main' } + Plug 'hrsh7th/cmp-nvim-lsp', { 'branch': 'main' } + Plug 'hrsh7th/cmp-buffer', { 'branch': 'main' } + Plug 'hrsh7th/cmp-path', { 'branch': 'main' } " Plug 'hrsh7th/cmp-nvim-ultisnips' "}}} @@ -284,15 +284,6 @@ let g:vim_markdown_fenced_languages = ['bash=sh'] " https://github.com/tpope/vim-dispatch Plug 'tpope/vim-dispatch' - "}}} -" #phpcomplete.vim{{{ -" improved php completion - " https://github.com/shawncplus/phpcomplete.vim - Plug 'shawncplus/phpcomplete.vim' - " https://github.com/dsawardekar/wordpress.vim - " For up to date Wordpress Files see: - " https://github.com/joseluis/wordpress.vim-generator - "}}} " #vim-floaterm{{{ " https://github.com/voldikss/floaterm From 6847f5b91546a9a31acef94d82821984e4fe5ddb Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 8 Sep 2021 16:44:08 +0100 Subject: [PATCH 24/35] restructure --- init.vim | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/init.vim b/init.vim index 54b90d6..38450e0 100644 --- a/init.vim +++ b/init.vim @@ -269,7 +269,10 @@ set softtabstop=-1 set shiftwidth=0 set shiftround set noexpandtab + set autoindent +set breakindent +set showbreak=\ \ ↳\ set formatoptions=cq set wrapmargin=0 @@ -298,10 +301,6 @@ set foldlevelstart=99 set showmode -set autoindent -set breakindent -set showbreak=\ \ ↳\ - set mouse=a set listchars=eol:¬,tab:│\ ,trail:~,extends:>,precedes:<,space:· From 6af0c102978641f807ad86a83be9c0ac47a70c91 Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 8 Sep 2021 16:44:42 +0100 Subject: [PATCH 25/35] workaround for php autoindent turned off https://github.com/nvim-treesitter/nvim-treesitter/issues/462 --- after/indent/php.vim | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 after/indent/php.vim diff --git a/after/indent/php.vim b/after/indent/php.vim new file mode 100644 index 0000000..2d98542 --- /dev/null +++ b/after/indent/php.vim @@ -0,0 +1,4 @@ +" https://github.com/nvim-treesitter/nvim-treesitter/issues/462#issuecomment-700278736 +setlocal indentexpr = +setlocal autoindent +setlocal smartindent From ca70b402c4f7172f8cde749c0a08b651fbb9831c Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 8 Sep 2021 17:08:30 +0100 Subject: [PATCH 26/35] add SpacesToTabs command --- init.commands.vim | 9 +++++++++ init.vim | 1 + 2 files changed, 10 insertions(+) create mode 100644 init.commands.vim diff --git a/init.commands.vim b/init.commands.vim new file mode 100644 index 0000000..451427d --- /dev/null +++ b/init.commands.vim @@ -0,0 +1,9 @@ +function! s:spacestotabs() + %s/^ / /e + %s/^ / /e + %s/^ / /e + %s/^ / /e + %s/^ / /e + %s/^ / /e +endfunction +command SpacesToTabs call s:spacestotabs() diff --git a/init.vim b/init.vim index 38450e0..0ee58e8 100644 --- a/init.vim +++ b/init.vim @@ -8,6 +8,7 @@ source ~/.config/nvim/init.plugins.vim source ~/.config/nvim/init.tabline.vim source ~/.config/nvim/init.auto-window.vim source ~/.config/nvim/init.fold-text.vim +source ~/.config/nvim/init.commands.vim " TODO - maybe separate some of these into own files too " #functions {{{ From d389e1fed14c0db96e46a69e7e746f7d4cbfe200 Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 8 Sep 2021 22:22:51 +0100 Subject: [PATCH 27/35] move commands to separate file --- init.commands.vim | 18 ++++++++++++++++++ init.vim | 11 ----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/init.commands.vim b/init.commands.vim index 451427d..418e83d 100644 --- a/init.commands.vim +++ b/init.commands.vim @@ -1,3 +1,5 @@ +" SpacesToTabs {{{ +" TODO - ake a proper regex substitution function! s:spacestotabs() %s/^ / /e %s/^ / /e @@ -7,3 +9,19 @@ function! s:spacestotabs() %s/^ / /e endfunction command SpacesToTabs call s:spacestotabs() + + +"}}} +" TrimWhitespace {{{ +command! -range=% TrimWhitespace let b:wv = winsaveview() | + \ keeppattern ,s/\s\+$// | + \ call winrestview(b:wv) + + +"}}} +" Scratch, ScratchVertical {{{ +command! Scratch new | setlocal buftype=nofile | setlocal bufhidden=hide | setlocal noswapfile +command! ScratchVertical vnew | setlocal buftype=nofile | setlocal bufhidden=hide | setlocal noswapfile +"}}} +" +" diff --git a/init.vim b/init.vim index 0ee58e8..3c751b8 100644 --- a/init.vim +++ b/init.vim @@ -181,17 +181,6 @@ function! ToggleHighlights() abort "{{{ endfunction "}}} "----------------------------------------------------------------------------}}} -"#commands{{{ -" TrimWhitespace{{{ -command! -range=% TrimWhitespace let b:wv = winsaveview() | - \ keeppattern ,s/\s\+$// | - \ call winrestview(b:wv) -"}}} -" Scratch, ScratchVertical{{{ -command! Scratch new | setlocal buftype=nofile | setlocal bufhidden=hide | setlocal noswapfile -command! ScratchVertical vnew | setlocal buftype=nofile | setlocal bufhidden=hide | setlocal noswapfile -"}}} -"}}} " #settings {{{ scriptencoding utf-8 From a022178884ef39196695c67544d78a7e350fb065 Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 8 Sep 2021 22:23:18 +0100 Subject: [PATCH 28/35] reformat --- lua/init-plugins.lua | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lua/init-plugins.lua b/lua/init-plugins.lua index 562c7af..6fd76b3 100644 --- a/lua/init-plugins.lua +++ b/lua/init-plugins.lua @@ -130,18 +130,18 @@ local on_attach = function(client, bufnr) 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', '', 'lua vim.lsp.buf.signature_help()', opts) + buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) + buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) + buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) + buf_set_keymap('n', 'l', 'lua vim.lsp.diagnostic.set_loclist()', opts) + buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) + buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) + buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) + buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) + buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', opts) -- 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) - buf_set_keymap('n', 'D', 'lua vim.lsp.buf.type_definition()', opts) - buf_set_keymap('n', 'rn', 'lua vim.lsp.buf.rename()', opts) - buf_set_keymap('n', 'ca', 'lua vim.lsp.buf.code_action()', opts) - buf_set_keymap('n', 'gr', 'lua vim.lsp.buf.references()', opts) - buf_set_keymap('n', 'e', 'lua vim.lsp.diagnostic.show_line_diagnostics()', opts) - buf_set_keymap('n', '[d', 'lua vim.lsp.diagnostic.goto_prev()', opts) - buf_set_keymap('n', ']d', 'lua vim.lsp.diagnostic.goto_next()', opts) - buf_set_keymap('n', 'q', 'lua vim.lsp.diagnostic.set_loclist()', opts) - buf_set_keymap('n', 'f', 'lua vim.lsp.buf.formatting()', opts) end From 7b13d73648251c25ea77709b1fbecd2716bce9ef Mon Sep 17 00:00:00 2001 From: ray Date: Wed, 8 Sep 2021 22:23:35 +0100 Subject: [PATCH 29/35] add treesitter highlights --- after/queries/css/highlights.scm | 18 ++++++++++++++++++ after/queries/ecma/highlights.scm | 0 after/queries/html/highlights.scm | 17 +++++++++++++++++ 3 files changed, 35 insertions(+) create mode 100644 after/queries/css/highlights.scm create mode 100644 after/queries/ecma/highlights.scm create mode 100644 after/queries/html/highlights.scm diff --git a/after/queries/css/highlights.scm b/after/queries/css/highlights.scm new file mode 100644 index 0000000..7fa2000 --- /dev/null +++ b/after/queries/css/highlights.scm @@ -0,0 +1,18 @@ +(id_selector (id_name) @CssIdentifier) +(id_selector (id_name)) @CssIdSelector +(tag_name) @HtmlTagName + +(class_selector (class_name) @CssClassName) +(selectors (pseudo_class_selector (class_name) @cssPseudoClass)) +(nesting_selector) @cssNestingSelector + +; need to find out how to make this more specific? +(universal_selector) @CssUniversalSelector + +((property_name) (_)) @CssProp + +(unit) @CssUnit + +(declaration (property_name) (_) @CssPropertyValue) + +(media_statement (feature_query (feature_name) @cssMediaFeatureName (_ (unit) @cssMediaQueryValueUnit) @cssMediaQueryValue) @cssMediaQuery) diff --git a/after/queries/ecma/highlights.scm b/after/queries/ecma/highlights.scm new file mode 100644 index 0000000..e69de29 diff --git a/after/queries/html/highlights.scm b/after/queries/html/highlights.scm new file mode 100644 index 0000000..2b752d4 --- /dev/null +++ b/after/queries/html/highlights.scm @@ -0,0 +1,17 @@ +(start_tag + (attribute + (attribute_name) @ClassNameAttribute (#eq? @ClassNameAttribute "class") + (quoted_attribute_value + (attribute_value) @CssClassName ))) + +(start_tag + (attribute + (attribute_name) @IdAttribute (#eq? @IdAttribute "id") + (quoted_attribute_value + (attribute_value) @CssIdentifier ))) + +(start_tag + (attribute + (attribute_name) @DataAttribute (#match? @DataAttribute "^data-") + (quoted_attribute_value + (attribute_value) @DataAttributeValue ))) From aaf41ab39e2f05666862bbb3ee3523d892382258 Mon Sep 17 00:00:00 2001 From: ray Date: Thu, 9 Sep 2021 14:56:57 +0100 Subject: [PATCH 30/35] add nvim-autopairs, nvim-ts-autotag --- init.plugins.vim | 17 ++++++++++++----- lua/init-plugins.lua | 15 +++++++++++++++ 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/init.plugins.vim b/init.plugins.vim index cd854f4..b5f1a69 100644 --- a/init.plugins.vim +++ b/init.plugins.vim @@ -71,12 +71,19 @@ Plug '~/nvim-paper-tonic' nnoremap cc :ColorToggle "}}} -" #delimitMate{{{ -" https://github.com/Raimondi/delimitMate +" #nvim-autopairs {{{ +" https://github.com/windwp/nvim-autopairs " automatic quote, paranthesis,etc closing. - Plug 'Raimondi/delimitMate' - let delimitMate_expand_cr = 1 - let delimitMate_expand_space = 1 + Plug 'windwp/nvim-autopairs' + "}}} + + +" #nvim-autopairs {{{ +" https://github.com/windwp/nvim-ts-autotag +" automatic html tag closing/renaming. +Plug 'windwp/nvim-ts-autotag', { 'branch': 'main' } + + "}}} " #emmet-vim {{{ " https://github.com/mattn/emmet-vim diff --git a/lua/init-plugins.lua b/lua/init-plugins.lua index 6fd76b3..2d81706 100644 --- a/lua/init-plugins.lua +++ b/lua/init-plugins.lua @@ -192,3 +192,18 @@ cmp.setup({ ... } }) +-- nvim-autopairs +require('nvim-autopairs').setup{} +-- you need setup cmp first put this after cmp.setup() +require("nvim-autopairs.completion.cmp").setup({ + map_cr = true, -- map on insert mode + map_complete = true, -- it will auto insert `(` after select function or method item + auto_select = true -- automatically select the first item +}) + +--nvim-ts-autotag +require'nvim-treesitter.configs'.setup { + autotag = { + enable = true, + } +} From b3e1ce732b0dde39d2c4ae99cdc3194f82c28a2d Mon Sep 17 00:00:00 2001 From: ray Date: Sun, 19 Sep 2021 13:01:52 +0100 Subject: [PATCH 31/35] 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}YX zXXgb=vhX*sjQj^|{246#0a>zQg~B=2V+A~N&+WSPICbhVKRtckHNGhBzmKBz+h4dO z&HQYhhoePNR&~?$!|}=K@*|fW6;-p8N}L=?Ctg(JtUQrgsyI^ZB$6N!MLQKltz1<1H=JQy+-s8`07%;cap=|7`un#0$QE)3Rpz1p|*HV z5?s;J!(}EXV_JJl%JOb4tA=BENk;Kir!#|d9)ORIS`b3YT6=Q{La9-dgCa$?$gRVD z3#|&k#%RkJ@}0!jI&18TyjALg>Swswn~XsBCa_BB^KP!`!U$?D6BOkWk9S;6hns0Q zD%x&11*#Gs;z>z~p6R@@z|5dy?npEe;0GDFDDW9Zil=irBZKC_^8AOeNOG}~LSw(O z9OP|~cFb?DHeW6LIP}mu z<*Z-JeCU9ME?bDHLRMLBHs(_GY{J{VQ`h4l8x=B^4PT7qo36^3HzXp@yn5D!x#4}v zFmhOH)oa0~var8;cy|D375?2>Td}cq%d>{(%`Y7oTy;Rd)ChP%{2GiZ%h#Eye3jjB z9y6f#ih9r%q5h_0b{B&eNW)o5#2if>AA!}&0U)8yx5nHXW)|%fC<`Il6yEJ`xYUPw zh||#MjOmVPE#XVICNMw`I^bj$`c2THLcAOvY(}RI8lOsyA;xLSxz=|NEcpzkV^ro8 zWQKpDWphCH>l#_$`yzl!%8o65z%!xT6>HAV2Q6{lVZJP);l5z$IGHo*O_%0R|1#n) zPuJ5~)f}rQO$5XBlNi&S2;C}S#yY|DYIMWX*zVNcFuL(^gluR2ifba4TdyzWOrTrhKNO?7N=CXoOr8H0;E1jZ?{zPQS8 z=IBbarbgHnpV3YlyPDgb$>_`6{LJt)t4j_uE5dCF?S0IsmW`!gEB0bFJ6ATU`8@V@ zyV?kF_ttU1&L`u-tBoF3m-yn3i*;rbDo}#&Q~aoK5gMxg1Uh3c!OeF8(TOkqt;Y;d zXNGsK9o%kRkC(nP3hxfsG{WCqjC4m*x@w?6AxeZ459R%i5FvUTj#CQ&4xfBNvz?&BxVzdwBW z>SrI02K*v=*)=-3ckjbI+I%EG%0oMGDCuEWp4j_SXxFlbVE?qmmgrZ+OeB#<~`UL_|21ufBym@d!?KJ literal 2266 zcmY*a%WfQ15bdfSM`nct5|Jj(4tX?LS`mZ9Dw)JlPz)vkETjnOPIu4D^>p`b`eA#- z0xz?eZ(xZmzQLct!e5Xj3sx+U!a3Dr1w3*;>el1bsYieR{HUq2JU@6BMLVC|b+aVR z=8L62UFAg?s;2GE&M($?T$-2FT1s(pDve~K8mGm%1S#W4wUJ1?NEA&` zu3P3s09MTlMC#0IAr+8%M9nm!f529k;JuM0ob|C=IL@KfNUMNF)arx9b27sbEi<@G z;D z0zcwONQqwRqO`!wpkeMvG!ozk892!C>w1dE3pyi%=E3s(o3Kc7zLi4bX=ypgZ(iy? zziBXEHT*d9xGh>(?Kl`DGaqUN9po`=iCe)W5epf--DOZf77Q3m(Njr%gYt7bNHgC6 z3tiR_Q-!Ru+-%6T>g9;1p;6c3K?Wro8*tH`PxK7~FP1SZf5lAbtR&((-j?DxalyT!tCY2YKkU zMyS8&nBB$TInr>J5-~?($BSq6mHe>wMs{MW+RxC(M{-G~8D#9%pk-z46-o>7PdZ^~FvyFRL@n zNEE?v@yv{C&V&vNn6XkYz3JWXsc-nAw;5KZ&l-~wtMMC;Qo#PfG7qT3rq!C$z?3?G zVJx}F3F;t)#~)i*&aKDj)xe#!IJNZ@WAVslgq3IaxTqSaa)BYlKQ+`Sue9M(g10{y zhoa^Kmo0r&WBqP>Q0_Nz4wWRdJt42XnPYFNV~aD18Gw>8xVTSXoFnUwn-tF+UWwv& zM%d6eo+Pmg-0Mt6kC*0Wj;mQ+bDUWb?n}geiYe8i!eQFSzS>UDjSXwEh_g^{cLLm9 zIgZ$7)UUi?^su_b7w_gf%*L0X1osO~3xqXL;T$S`E5Xa5M>L+y0g~GWvf=Gi>09G% z)a_t^(4aZiUJJNPfHi>Y$r7L!wi*K9YSK%&9%aKd>ESg)47?A#A^~!CyDH(JNO0J1 zVg}Q@4OSbAZOs)}a{axKpw2!#*X$R2DrQk6AAk7h@$~T7(buoOJNY5=ryV|onM{pC zuG<5cM|+RuTX|$poJ4w<$}@X^4(%XM5bXc^jGwgqkxrdFloQiD*2K#p%->HpH0a$p zdRZ!#8|DR)rGw9YTBdSj)~^t!#Isdk-{|`ESW%q! Date: Sun, 19 Sep 2021 13:28:34 +0100 Subject: [PATCH 32/35] cmp - fix snippets --- lua/init-plugins.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lua/init-plugins.lua b/lua/init-plugins.lua index 0953dad..a9c48e2 100644 --- a/lua/init-plugins.lua +++ b/lua/init-plugins.lua @@ -162,14 +162,14 @@ end local cmp = require'cmp' cmp.setup({ completion = { - keyword_length = 4 + 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 }), From d27b3caa9c519d16f5a61163515b9eae6a08764a Mon Sep 17 00:00:00 2001 From: ray Date: Sun, 19 Sep 2021 13:49:22 +0100 Subject: [PATCH 33/35] remove abbreviations, move some into snippets --- UltiSnips/css.snippets | 23 +++++++++++++++++++++-- init.vim | 19 ------------------- 2 files changed, 21 insertions(+), 21 deletions(-) diff --git a/UltiSnips/css.snippets b/UltiSnips/css.snippets index 8645782..5eb7046 100644 --- a/UltiSnips/css.snippets +++ b/UltiSnips/css.snippets @@ -1,4 +1,23 @@ -snippet sld "/* stylelint-disable-next-line ... */" +snippet abs "pabs position: absolute;" +position: absolute; +endsnippet +snippet fix "position: fixed;" +position: fixed; +endsnippet +snippet rel "position: relative;" +position: relative; +endsnippet +snippet row "flex-direction: row;" +flex-direction: row; +endsnippet +snippet col "flex-direction: column;" +flex-direction: column; +endsnippet +snippet over "overflow: hidden;" +overflow: $0; +endsnippet + +snippet style "/* stylelint-disable-next-line ... */" /* stylelint-disable-next-line ${1:declaration-block-no-shorthand-property-overrides} */ endsnippet @@ -29,7 +48,7 @@ linear-gradient( endsnippet snippet bglg "background: linear-gradient ..." -background: linear-gradient( +background-image: linear-gradient( ${2:to bottom}, ${3:transparent}, ${4:transparent} diff --git a/init.vim b/init.vim index 3c751b8..4adf2dd 100644 --- a/init.vim +++ b/init.vim @@ -360,31 +360,12 @@ inoremap jjrg :reg "----------------------------------------------------------------------------}}} " #abbreviations {{{ -" spelling"{{{ iabbrev adn and iabbrev waht what iabbrev tehn then iabbrev functin function iabbrev positin position -"}}} -" css{{{ -" TODO move these into autocommand to just load in css, scss, jsx, files -iabbrev pabs position: absolute; -iabbrev pfix position: fixed; -iabbrev prel position: relative; -iabbrev fdr flex-direction: row; -iabbrev fdc flex-direction: column; -iabbrev jcc justify-content: center; -iabbrev aic align-items: center; -iabbrev ovh overflow: hidden; -iabbrev ovv overflow: visible; -iabbrev ova overflow: auto; - -iabbrev ct'' content-type: ''; - -"}}} - "----------------------------------------------------------------------------}}} " #autocommands {{{ From d6a71c92d42f554abb77231b3fe4b725ff0b2628 Mon Sep 17 00:00:00 2001 From: ray Date: Sun, 19 Sep 2021 14:56:16 +0100 Subject: [PATCH 34/35] fix js json issues (tsserver confilct?) --- lua/init-plugins.lua | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/lua/init-plugins.lua b/lua/init-plugins.lua index a9c48e2..afb5452 100644 --- a/lua/init-plugins.lua +++ b/lua/init-plugins.lua @@ -66,7 +66,7 @@ end require "lspconfig".efm.setup { init_options = {documentFormatting = true}, on_attach = on_attach_efm, - filetypes = {"javascript", "typescript", "json", "sh", "python", "lua"}, + filetypes = {"javascript", "json", "sh", "python", "lua"}, root_dir = function(fname) return util.root_pattern("tsconfig.json")(fname) or util.root_pattern(".eslintrc.js", ".git")(fname); @@ -75,11 +75,10 @@ require "lspconfig".efm.setup { rootMarkers = {".eslintrc.js", ".git/"}, languages = { javascript = {eslint}, - typescript = {eslint}, - json = {jq, fixjson}, - python = {flake8, black}, - sh = {shellcheck}, - lua = {luaformat} + json = {jq, fixjson}, + python = {flake8, black}, + sh = {shellcheck}, + lua = {luaformat} } } } @@ -105,7 +104,7 @@ local servers = { -- npm i -g stylelint-lsp 'stylelint_lsp', -- https://github.com/neovim/nvim-lspconfig/wiki - 'tailwindcss', + -- 'tailwindcss', -- npm install -g typescript typescript-language-server 'tsserver', -- npm install -g vim-language-server From b12e317651a514369e3b718f0c15363cafe87f05 Mon Sep 17 00:00:00 2001 From: ray Date: Mon, 20 Sep 2021 21:23:42 +0100 Subject: [PATCH 35/35] update --- lua/init-plugins.lua | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/lua/init-plugins.lua b/lua/init-plugins.lua index afb5452..904b622 100644 --- a/lua/init-plugins.lua +++ b/lua/init-plugins.lua @@ -56,12 +56,12 @@ local luaformat = { } local util = require "lspconfig".util local on_attach_efm = function(client) - if client.resolved_capabilities.document_formatting then - vim.cmd [[augroup lsp_formatting]] - vim.cmd [[autocmd!]] - vim.cmd [[autocmd BufWritePre :lua vim.lsp.buf.formatting_seq_sync({}, 1000)]] - vim.cmd [[augroup END]] - end + -- if client.resolved_capabilities.document_formatting then + -- vim.cmd [[augroup lsp_formatting]] + -- vim.cmd [[autocmd!]] + -- vim.cmd [[autocmd BufWritePre :lua vim.lsp.buf.formatting_seq_sync({}, 1000)]] + -- vim.cmd [[augroup END]] + -- end end require "lspconfig".efm.setup { init_options = {documentFormatting = true}, @@ -75,10 +75,10 @@ require "lspconfig".efm.setup { rootMarkers = {".eslintrc.js", ".git/"}, languages = { javascript = {eslint}, - json = {jq, fixjson}, - python = {flake8, black}, - sh = {shellcheck}, - lua = {luaformat} + json = {jq, fixjson}, + python = {flake8, black}, + sh = {shellcheck}, + lua = {luaformat} } } } @@ -111,7 +111,6 @@ local servers = { 'vimls', -- npm install -g vls 'vuels', - -- npm i -g stylelint-lsp 'yamlls', }