diff --git a/.gitmodules b/.gitmodules index 29ca9a2..9a6709a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -73,3 +73,6 @@ [submodule "vim/bundle/nvim-ts-context-commentstring"] path = vim/bundle/nvim-ts-context-commentstring url = https://github.com/JoosepAlviste/nvim-ts-context-commentstring +[submodule "vim/bundle/nvim-treesitter"] + path = vim/bundle/nvim-treesitter + url = https://github.com/nvim-treesitter/nvim-treesitter diff --git a/readme.md b/readme.md index 745c1e9..88d653c 100644 --- a/readme.md +++ b/readme.md @@ -35,12 +35,12 @@ A theme, config and collection of plugins for Neovim ## Configuration * **Configure Variables**: The following variables can be added to `vim/user.vim` and have their values set to the values you require: - * `g:autostartchecker`: **1** = Check syntax once an appropriate file is loaded | **0** = Check syntax only after syntax checking is toggled on (_default_: **0**) - * `g:autostarttagbar`: **1** = Have the tagbar load automatically when a compatible format is run | **0** = The tagbar will stay hidden until triggered on demand with its toggle (_default_: **0**) - * `g:disablecompletion`: **1** = Disable _deoplete_ autocompletion | **0** = Enable _deoplete _autocompletion_ if the requirements are met (_default_: **0**) - * `g:disableautotags`: **1** = Prevent tags from being automatically generated and highlighted | **0** = Automatically generate and highlight tags (_default_: **0**) - * `g:disablelinebreaks`: **1** = Override filetype plugins so linebreaks never occur | **0** = Linebreaks are disabled by default, but filetype plugins can override this setting (_default_: **0**) - * `g:powerlinefonts`: **1** = Render the statusline using characters available with powerline-patched fonts | **0** = Render the statusbar with less attractive but more compatible characters available in all fonts (_default_: **0**) + * `g:autostartchecker`: **1** = Enable the syntax checker when a file is opened | **0** = Check syntax only after being toggled on (default: **0**) + * `g:autostarttagbar`: **1** = Load a file with the tagbar visible | **0** = Require the tagbar to be toggled on (default: **0**) + * `g:enabletreesitter`: **1** = Use treesitter for compatible files | **0** = Keep treesitter disabled (default: **0**) + * `g:enablecompletion`: **1** = Enable autocompletion | **0** = Disable autocompletion (default: **0**) + * `g:enableautotags`: **1** = Automatically generate tags files | **0** = Disable tag generation (default: **0**) + * `g:enablepowerline`: **1** = Render the statusline using characters that require powerline-patched fonts | **0** = Render the statusbar with characters that work with all fonts (default: **0**) * **Custom Settings**: Settings with priority over those set by darkcloud-nvimconfig can be added to `vim/user.vim` or any of the folders in the runtimepath. * **Custom Plugins**: Pathogen compatible plugins can be cloned or extracted to `darkcloud-nvimconfig/vim/bundle.user/`, or a folder named `bundle` in any of the folders in the runtimepath. * **Update Script**: (requires: bash+git) Use the `update` script to update the project and submodules, as well as handle any required maintenance, generate docs from the pathogen plugins and create missing config scripts with preset values. @@ -128,6 +128,7 @@ For a complete list of mappings specific to **darkcloud-nvimconfig**, check the * [lightline.vim](https://github.com/itchyny/lightline.vim): A light and configurable statusline/tabline for Vim * [lightline-ale](https://github.com/maximbaz/lightline-ale): Provides ALE indicator for the lightline vim plugin * [MatchTagAlways](https://github.com/Valloric/MatchTagAlways): A Vim plugin that always highlights the enclosing html/xml tags +* [nvim-treesitter](https://github.com/nvim-treesitter/nvim-treesitter): Treesitter configurations and abstraction layer for Neovim * [ReplaceWithRegister](https://github.com/vim-scripts/ReplaceWithRegister): Replace text with the contents of a register (for paste+replace without writing over the buffer) * [splitjoin.vim](https://github.com/AndrewRadev/splitjoin.vim): Simplifies the transition between multiline and single-line code * [tabular](https://github.com/godlygeek/tabular): Vim script for text filtering and alignment diff --git a/update b/update index e3f9328..27c714a 100755 --- a/update +++ b/update @@ -118,12 +118,12 @@ printf '\n%s\n' "$cbg_black ~~~ DarkCloud Neovim Config Update Tool ~~~ $c_reset if (( ! $? )); then { - printf '%s\n%s\n\n' '"Autocheck syntax checking: (1:start toggled on | *0:start toggled off)' '"let g:autostartchecker = 0' - printf '%s\n%s\n\n' '"Autoload Tagbar: (1:start open | *0:start closed)' '"let g:autostarttagbar = 0' - printf '%s\n%s\n\n' '"Disable Completion: (1:disable completion | *0:enable completion if requirements are met)' '"let g:disablecompletion = 0' - printf '%s\n%s\n\n' '"Disable automatic tag generation and highlighting: (1:force disabled tag generation and highlighting | *0:enable automatic tag generation and highlighting)' '"let g:disableautotags = 0' - printf '%s\n%s\n\n' '"Disable automatic linebreaking: (1:force disabled globally | *0:let the filetype decide)' '"let g:disablelinebreaks = 0' - printf '%s\n%s' '"Enable Powerline fonts: (1:expect powerline font | *0:expect regular font)' '"let g:powerlinefonts = 0 "(use powerline font glyphs when enabled)' + printf '%s\n%s\n\n' '"Auto-start syntax checking: (1:start toggled on | *0:start toggled off)' '"let g:autostartchecker = 1' + printf '%s\n%s\n\n' '"Auto-start Tagbar: (1:start open | *0:start closed)' '"let g:autostarttagbar = 1' + printf '%s\n%s\n\n' '"Enable Treesitter: (1:treesitter enabled | *0:treesitter disabled)' '"let g:enabletreesitter = 1' + printf '%s\n%s\n\n' '"Enable Auto-completion: (1:autocompletion enabled | *0:autocompletion disabled)' '"let g:enablecompletion = 1' + printf '%s\n%s\n\n' '"Enable automatic tag generation: (1:enable tag generation | *0:disable automatic tag generation)' '"let g:enableautotags = 1' + printf '%s\n%s' '"Enable Powerline: (1:use powerline characters | *0:use regular characters)' '"let g:enablepowerline = 1' } >> vim/user.vim if [[ -e 'vim/user.vim' ]]; then diff --git a/vim/bundle/nvim-treesitter b/vim/bundle/nvim-treesitter new file mode 160000 index 0000000..c2a2651 --- /dev/null +++ b/vim/bundle/nvim-treesitter @@ -0,0 +1 @@ +Subproject commit c2a265156d5799adbd9f9e7d5385735fa5d21776 diff --git a/vim/config/after.vim b/vim/config/after.vim index 21cb265..34e4afa 100644 --- a/vim/config/after.vim +++ b/vim/config/after.vim @@ -14,15 +14,6 @@ if !exists('g:loaded_matchit') && findfile('plugin/matchit.vim', &rtp) ==# '' runtime! macros/matchit.vim endif -"when enabled, this will override each file type default and disable all line breaks (default: 1) -if !exists("g:disablelinebreaks") - let g:disablelinebreaks = 1 -endif - -if (g:disablelinebreaks == 1) - autocmd VimEnter * set textwidth=0 -endif - "enable omnicompletion for any filetype without that has syntax highlighting if exists("+omnifunc") autocmd VimEnter,Filetype * if &omnifunc == ""|setlocal omnifunc=syntaxcomplete#Complete|endif @@ -38,6 +29,9 @@ autocmd FileChangedRO * nested set noreadonly "don't conceal json syntax let g:vim_json_syntax_conceal = 0 + "disable automatic line breaks + autocmd VimEnter * set textwidth=0 + "set given filenames to various filetypes autocmd BufNewFile,BufRead *.aspx,*.asmx,*.ascx,*.master setlocal ft=aspnet autocmd BufNewFile,BufRead *.gradle setlocal ft=groovy @@ -48,7 +42,7 @@ autocmd FileChangedRO * nested set noreadonly "filtype specific settings autocmd BufEnter,FileType sh setlocal iskeyword-=. - autocmd Filetype text,markdown,gitcommit,mail setlocal nonumber spell nolist linebreak tabstop=2 shiftwidth=2 breakat&vim breakat-=* breakat-=. breakat-=/ breakat-=? breakat-=, breakat-=: breakat-=; breakat-=! "set some defaults for word processing + autocmd Filetype text,markdown,gitcommit,mail setlocal nonumber spell nolist linebreak textwidth=80 tabstop=2 shiftwidth=2 breakat&vim breakat-=* breakat-=. breakat-=/ breakat-=? breakat-=, breakat-=: breakat-=; breakat-=! "set some defaults for word processing autocmd Filetype text,gitcommit,mail setlocal wrap autocmd FileType tmux setlocal commentstring=#\ %s "set the comment string to # autocmd FileType scss setlocal iskeyword+=$ diff --git a/vim/config/keyboard.vim b/vim/config/keyboard.vim index 30e0a58..437352f 100644 --- a/vim/config/keyboard.vim +++ b/vim/config/keyboard.vim @@ -50,6 +50,9 @@ " " | (A) -> paste from xorg paste buffer " +" (terminal) +" | (T) -> leave edit mode +" " (tabs) " | (N) -> go to the next open tab " | (N) -> go to the previous open tab @@ -369,6 +372,10 @@ noremap! "} + "TERMINAL:{ + tnoremap + "} + "TABS:{ nnoremap ':tabnext' nnoremap ':tabprev' diff --git a/vim/config/plugins/deoplete.vim b/vim/config/plugins/deoplete.vim index 53efb81..fb59e9e 100644 --- a/vim/config/plugins/deoplete.vim +++ b/vim/config/plugins/deoplete.vim @@ -1,8 +1,8 @@ -"disable completion (default: 0) -if !exists("g:disablecompletion") - let g:disablecompletion = 0 +"enable completion (default: 0) +if !exists("g:enablecompletion") + let g:enablecompletion = 0 endif -if !g:disablecompletion && g:python_neovim +if !g:enablecompletion && g:python_neovim let g:deoplete#enable_at_startup = 1 endif diff --git a/vim/config/plugins/lightline.vim b/vim/config/plugins/lightline.vim index 5f3c40b..63d2e50 100644 --- a/vim/config/plugins/lightline.vim +++ b/vim/config/plugins/lightline.vim @@ -93,11 +93,11 @@ let g:lightline#ale#indicator_errors = "E:" let g:lightline#ale#indicator_ok = "OK" "status bar config with and without powerline fonts (default: 0) -if !exists("g:powerlinefonts") - let g:powerlinefonts = 0 +if !exists("g:enablepowerline") + let g:enablepowerline = 0 endif -if (g:powerlinefonts == 1) +if (g:enablepowerline == 1) let g:lightline.separator = { 'left': '', 'right': '' } let g:lightline.subseparator = { 'left': '', 'right': '' } else diff --git a/vim/config/plugins/nvim-treesitter.lua b/vim/config/plugins/nvim-treesitter.lua new file mode 100644 index 0000000..c398ec7 --- /dev/null +++ b/vim/config/plugins/nvim-treesitter.lua @@ -0,0 +1,22 @@ +if (vim.g.enabletreesitter ~= nill and vim.g.enabletreesitter == 1) then + if (vim.g.treesitterparserdir ~= nill) then + local parser_dir = vim.g.treesitterparserdir + else + local parser_dir = "~/.config/nvim/treesitter-parsers" + end + + vim.opt.runtimepath:append(parser_dir) + + require'nvim-treesitter.configs'.setup { + ensure_installed = { "bash", "c", "cpp", "git_config", "html", "java", "javascript", "json", "lua", "php", "python", "query", "rust", "toml", "typescript", "vim", "vue" }, + sync_install = false, + auto_install = false, + parser_install_dir = parser_dir, + + highlight = { + enable = true, + disable = {}, + additional_vim_regex_highlighting = false, + } + } +end diff --git a/vim/config/plugins/vim-gutentags.vim b/vim/config/plugins/vim-gutentags.vim index e49ae2c..5e7ed2c 100644 --- a/vim/config/plugins/vim-gutentags.vim +++ b/vim/config/plugins/vim-gutentags.vim @@ -7,6 +7,6 @@ let g:gutentags_file_list_command = { \ } "prevent automatically generating the tagfile and syntax highlighting tags (default: 0) -if exists("g:disableautotags") && g:disableautotags == 1 +if !exists("g:enableautotags") || g:enableautotags == 0 let g:gutentags_enabled = 0 endif