From: Stefan Huber Date: Mon, 8 Jan 2024 14:30:55 +0000 (+0100) Subject: plugins: Change easychair2 url X-Git-Url: https://git.sthu.org/?p=vimconf.git;a=commitdiff_plain;h=HEAD;hp=fc796f75c5dc7a7d0fa7fb6d56a99b07caf4d270 plugins: Change easychair2 url --- diff --git a/.gitignore b/.gitignore index 48a443e..005ee09 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,12 @@ -plugged +*.swp +.netrwhist init-local.vim keymaps-local.vim macros-local.vim -plugins-local.vim -*.swp neosnippets/mail.snip +plug-snapshot-* +plugged +plugins-local.vim spell/ +tags +vimspector-config/gadgets diff --git a/README.md b/README.md index fef6bdc..43f7882 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,5 @@ # A modular vim configuration -This is my personal vim configuration that is partly inspired by -[SpaceVim](https://spacevim.org/). It is compatible to vim, gvim (8.0+) and -neovim (0.2+). The configuration is split up into multiple files such that -personal customization is separated from boilerplate code. - -![A demo screenshot](https://www.sthu.org/code/codesnippets/img/vimconf-start-plugin.png) -
This repository is a replication of the repository website gives further details and more screenshots.
+ +This is my personal vim configuration. The [git +repo](https://git.sthu.org/?p=vimconf.git;a=summary) of this configuration is +under constant flux, however, it should be compatible with (g)vim (8.0+) and +neovim (0.2+), yet some features are only available with newer versions. + +![A demo screenshot](https://www.sthu.org/code/codesnippets/img/vimconf-startify.png) + + +## Flavors on different machines + +I would like to use this configuration on a large variety of machines with +different needs. To accommodate for this, the configuration is split up into +multiple files and a different set of plugins is used: + +- In any case, the plugin set in `plugins.vim` is loaded. +- If run as non-root user, an additional plugin set in `plugins-noroot.vim` is + loaded. +- If run on a no-low-end-box, an additional plugin set in + `plugins-noroot-nolowendbox.vim` is loaded. A low-end box is indicated by the + existence of the file `lowendbox`, e.g., on my Raspberry Pi installations. +- Also, if `plugins-local.vim` exists, this plugin set is loaded, too. For + instance, on one machine I have gnupg and corresponding vim plugins + configured. + +Similar to `plugins-local.vim`, also the following files are sourced if +existent: + + - `macros-local.vim` + - `keymaps-local.vim` + - `init-local.vim` + +Example files are shipped with the repository. + ## Installation ### Requirements @@ -57,20 +84,6 @@ This install script creates backups of existing configuration files (e.g., `~/.vimrc`) and then creates symlinks to configuration files in `~/.vim`. -## Specialization for local machines - -I personally would like to have the same vim configuration on all my user -accounts. Still, on certain machines I would like to personalize and specialize -the configuration. The following files are sourced if existent: - - - plugins-local.vim - - macros-local.vim - - keymaps-local.vim - - init-local.vim - -Example files are shipped with the repository. - - ## Terminal color settings For consistent background colors you may change the background colors of your diff --git a/after/syntax/json.vim b/after/syntax/json.vim new file mode 100644 index 0000000..6db6a82 --- /dev/null +++ b/after/syntax/json.vim @@ -0,0 +1,4 @@ +syn region jsonComment start="/\*" end="\*/" +syn region jsonComment start="//" end="$" +hi link jsonCommentError Comment +hi link jsonComment Comment diff --git a/ftdetect/dis.vim b/ftdetect/dis.vim new file mode 100644 index 0000000..1d3f669 --- /dev/null +++ b/ftdetect/dis.vim @@ -0,0 +1 @@ +au BufRead,BufNewFile *.dis* set filetype=dis diff --git a/ftplugin/dis.vim b/ftplugin/dis.vim new file mode 100644 index 0000000..0ae4f60 --- /dev/null +++ b/ftplugin/dis.vim @@ -0,0 +1,6 @@ +if exists("b:did_ftplugin") + finish +endif +let b:did_ftplugin=1 + +set ts=4 diff --git a/gvimrc b/gvimrc index 1956f8b..3782ff8 100644 --- a/gvimrc +++ b/gvimrc @@ -1,6 +1,6 @@ set columns=100 set lines=53 -set guifont=Hack\ NF\ 9,Hack\ 9,Liberation\ Mono\ for\ Powerline\ 10,DejaVu\ Sans\ Mono\ 10,Monospace\ 10 +set guifont=JetBrainsMono\ NF\ 9,Hack\ NF\ 9,Hack\ 9,DejaVu\ Sans\ Mono\ 10,Monospace\ 10 set mousehide diff --git a/init-local.vim.example b/init-local.vim.example deleted file mode 100644 index 155438e..0000000 --- a/init-local.vim.example +++ /dev/null @@ -1,27 +0,0 @@ -" Do not show diagnostic window of vim-clang -let g:clang_diagsopt = '' - -let g:ConqueTerm_StartMessages = 0 - -" Reduce load on memory by updating one plugin at a time -"let g:plug_threads = 1 - -" Configuration for youcompleteme, if not using vim-clang. -"let g:ycm_global_ycm_extra_conf = '~/.ycm_extra_conf.py' -"let g:ycm_confirm_extra_conf = 0 -"let g:ycm_min_num_of_chars_for_completion = 2 -"let g:ycm_collect_identifiers_from_tags_files = 1 -"let g:ycm_autoclose_preview_window_after_completion = 1 -"let g:ycm_key_list_select_completion = [''] -"nnoremap jd :YcmCompleter GoToDefinitionElseDeclaration -"let g:ycm_filetype_whitelist = { 'c' : 1, 'cpp' : 1, 'cs' : 1, 'objc' : 1, 'java' : 1, 'python' : 1 } - -" Some terminals, like konsole, cause weired symbols (e.g., q) printed due to -" broken cursor-shape termcodes. -if has('nvim') - set guicursor= - " Workaround some broken plugins which set guicursor indiscriminately. - au OptionSet guicursor noautocmd set guicursor= -end - -" vim:ft=vim diff --git a/init.vim b/init.vim index 86f93b3..9700a32 100644 --- a/init.vim +++ b/init.vim @@ -16,6 +16,9 @@ set fillchars=vert:│,fold:\ set listchars=tab:»­,trail:·,eol:$ set virtualedit=block +" use filetype.lua and do not use filetype.vim for >=neovim-0.7.2 +let g:do_filetype_lua = 1 +let g:did_load_filetypes = 0 filetype plugin indent on set tabstop=4 @@ -36,112 +39,25 @@ set colorcolumn=+1 set mouse=a set wildmenu set wildmode=longest,list:full +set showcmd set tabpagemax=100 -syntax on - -" Load some macros -runtime macros.vim - -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Some global plugin settings - -" Disable devicons on linux terminal -if $TERM == 'linux' - let g:enable_plugin_devicons=0 -" Enable loading of devicons on all others -else - let g:enable_plugin_devicons=1 -endif - -runtime plugsetup.vim - -let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] - -" Some preferences for indent detection -let g:detectindent_min_indent = 2 -let g:detectindent_max_indent = 4 -let g:detectindent_preferred_indent = 4 - -" Attention: Must be run after plugsetup.vim -" Trailing whitespace -highlight default link BadWhitespace SpellCap - -" Setup BadWhitespace syntax match expressions. -function SetBadWhitespaceSyntax() - " Do not expose bad whitespace in help buffers or for man pages. Or, more - " generally, if we open the file readonly. - "if &ft != "help" && &ft != "man" - if !&readonly - " Make trailing whitespace be flagged as bad. - syn match BadWhitespace /\s\+$/ containedin=ALL - " Make space before tab be flagged as bad and vice versa - syn match BadWhitespace / \+\t/ containedin=ALL - syn match BadWhitespace /\t \+/ containedin=ALL - endif -endfunction - -" Make trailing whitespace be flagged as bad. -au BufRead,BufNewFile * call SetBadWhitespaceSyntax() - -let g:airline_powerline_fonts=1 -let g:airline#extensions#tabline#enabled=1 -let g:airline#extensions#branch#enabled=1 - -let g:gruvbox_contrast_light='hard' -let g:gruvbox_contrast_dark='hard' -set bg=dark - -if &term =~ 'linux' - let g:gruvbox_termcolors=16 -else - " Setting termguicolors has two implications: - " - Breaks colors for some versions of mosh, but not if tmux is used on top of - " mosh. See https://github.com/mobile-shell/mosh/issues/928 - set termguicolors - let g:gruvbox_italic = 1 +if has('nvim-0.7') + set laststatus=3 endif -colorscheme gruvbox -" let NERDTreeWinPos="right" -let NERDTreeHijackNetrw=0 -let NERDTreeWinSize=22 -let NERDTreeQuitOnOpen=1 -"au VimEnter * if !argc() | Startify | NERDTree | wincmd w - -let g:neomake_c_enabled_makers = ['clangtidy', 'clangcheck'] -let g:neomake_cpp_enabled_makers = ['clangtidy', 'clangcheck'] +syntax on -" Taken from neomake -if OnBattery() - call neomake#configure#automake('w') +if filereadable($HOME . '/.vim/lowendbox') + let g:lowendbox = 1 else - call neomake#configure#automake('nw', 1000) + let g:lowendbox = 0 endif -let g:clang_compilation_database = '.' - -" Speedup deoplete startup time, see deoplete FAQ -let g:python3_host_prog = '/usr/bin/python3' -" deoplete requires huge startuptime. Delay loading upon first InsertEnter. -let g:deoplete#enable_at_startup = 0 -call deoplete#custom#option({ - \ 'smart_case' : v:true, - \ 'auto_refresh_delay' : 100, - \ }) -au InsertEnter * call deoplete#enable() - -"augroup pencil - "au! - "au FileType markdown,mkd call pencil#init() - "au FileType text call pencil#init() - "au FileType mail call pencil#init() - "au FileType tex call pencil#init() -"augroup END - -let g:vim_markdown_frontmatter=1 -let g:vim_markdown_math=1 +runtime macros.vim +runtime keymaps.vim +runtime plugsetup.vim """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" @@ -165,16 +81,6 @@ au Filetype mail syn match Statement /^\s*-*\s*8<\s*-*\s*$/ " Line wrap crippled with numbers shown au Filetype man setlocal nonumber -" Minimum indenting for source code -au FileType java,cpp,c,cs let g:detectindent_min_indent = 4 -" Consider using localvimrc config file or editorconfig instead -"au BufReadPost *.java :DetectIndent - -au BufEnter *.c* let b:fswitchlocs='reg:/lib/include/,rel:.' -au BufEnter *.h* let b:fswitchlocs='reg:/include/lib/,rel:.' - -au BufEnter *.cpp,*.cc,*.cxx let b:fswitchdst='h,hxx,hpp,hh' -au BufEnter *.h,*.hh,*.hxx let b:fswitchdst='cc,c,cxx,cpp' au BufNewFile *.{h,hpp,hxx} call AddIncludeGuards() au FileType cpp,c packadd termdebug @@ -184,133 +90,36 @@ augroup autofoldcolumn au CursorHold,BufWinEnter * AutoOrigamiFoldColumn augroup END + """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" -" Some plugin-specific settings - -let g:localvimrc_persistent = 1 - -let g:fastfold_minlines = 0 - -au FileType markdown call RagtagInit() - -let g:detectspelllang_langs = {} -let g:detectspelllang_langs.aspell =[ 'en_US', 'de_AT'] -au FileType mail let g:VimMailSpellLangs=['de', 'en'] - -:let g:org_todo_keywords = [['TODO(t)', 'WAITING(w)', '|', 'DONE(d)'], - \ ['|', 'OBSOLETE(o)', 'WONT(n)'], - \ ['CANCELED(c)']] - -let g:vimwiki_list = [{'path': '~/.vimwiki/', - \ 'template_path': '~/.vim/vimwiki/templates', - \ 'template_default': 'default', - \ 'template_ext': '.html'}] -let g:vimwiki_global_ext = 0 - -" Java completion -au FileType java setlocal omnifunc=javacomplete#Complete -au FileType java JCEnable - -let g:VimMailContactsProvider=['khard'] -let g:VimMailContactsCommands={ - \'khard': - \{ 'query' : "khard email --parsable --search-in-source-files", - \'sync': "/bin/true"} - \} - -let g:vimtex_fold_enabled = 1 -let g:vimtex_fold_levelmarker = '➜' - -" The denite settings are largely stolen from spacevim -let s:denite_options = { - \ 'default' : { - \ 'winheight' : 15, - \ 'mode' : 'insert', - \ 'start_filter' : 1, - \ 'quit' : 1, - \ 'highlight_matched_char' : 'MoreMsg', - \ 'highlight_matched_range' : 'MoreMsg', - \ 'direction': 'rightbelow', - \ }} - -augroup spacevim_layer_denite - autocmd! - autocmd FileType denite call s:denite_my_settings() -augroup END +" General settings -function! s:denite_my_settings() abort - nnoremap i - \ denite#do_map('open_filter_buffer') - nnoremap ' - \ denite#do_map('toggle_select').'j' - nnoremap q - \ denite#do_map('quit') - nnoremap - \ denite#do_map('do_action', 'tabopen') - nnoremap - \ denite#do_map('do_action', 'vsplit') - nnoremap - \ denite#do_map('do_action', 'split') - nnoremap - \ denite#do_map('do_action') - nnoremap p - \ denite#do_map('do_action', 'preview') - nnoremap j - nnoremap k -endfunction -" FIND and GREP COMMANDS -if executable('rg') - " Ripgrep command on grep source - call denite#custom#var('grep', 'command', ['rg']) - call denite#custom#var('grep', 'default_opts', - \ ['--vimgrep', '--no-heading']) - call denite#custom#var('grep', 'recursive_opts', []) - call denite#custom#var('grep', 'pattern_opt', ['--regexp']) - call denite#custom#var('grep', 'separator', ['--']) - call denite#custom#var('grep', 'final_opts', []) -endif +" Attention: Must be run after plugsetup.vim +" Trailing whitespace +highlight default link BadWhitespace SpellCap + +" Setup BadWhitespace syntax match expressions. +function SetBadWhitespaceSyntax() + " Do not expose bad whitespace in help buffers or for man pages. Or, more + " generally, if we open the file readonly. + "if &ft != "help" && &ft != "man" + if !&readonly + " Make trailing whitespace be flagged as bad. + syn match BadWhitespace /\s\+$/ containedin=ALL + " Make space before tab be flagged as bad and vice versa + syn match BadWhitespace / \+\t/ containedin=ALL + syn match BadWhitespace /\t \+/ containedin=ALL + endif +endfunction -let s:insert_mode_mappings = [ - \ ['jk', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ] - -let s:normal_mode_mappings = [ - \ ["'", '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['gg', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['', '', 'noremap'], - \ ['q', '', 'noremap'], - \ ['r', '', 'noremap'], - \ ] +" Make trailing whitespace be flagged as bad. +au BufRead,BufNewFile * call SetBadWhitespaceSyntax() " termdebug split windows let g:termdebug_wide = 1 let termdebugger = $HOME . '/.vim/gdb.sh' -"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" - -runtime keymaps.vim if filereadable($HOME . '/.vim/init-local.vim') source ~/.vim/init-local.vim diff --git a/install.sh b/install.sh index d50c6d9..4d7ec01 100755 --- a/install.sh +++ b/install.sh @@ -51,6 +51,7 @@ check_requirements() check_prog curl check_prog git check_vim +python3 + check_vim +lua check_py3 neovim check_font "Hack NF" } @@ -83,7 +84,7 @@ start the plugin provided colorscheme is not available yet. Add this line to your shell configuration, e.g., ~/.profile, to use vim as man pager: - export MANPAGER=\"view -c MANPAGER -\" + export MANPAGER=\"vi -c ASMANPAGER -\" EOF } diff --git a/keymaps.vim b/keymaps.vim index 883b3e0..38f7774 100644 --- a/keymaps.vim +++ b/keymaps.vim @@ -1,6 +1,26 @@ """""""""""""""""""""""""""""""""""""""""""""""""""""""""""" " Global settings +if has('clipboard') + " Use + or * registers + if has('unnamedplus') + set clipboard+=unnamedplus + else + set clipboard+=unnamed + endif + + " Ordinary ctrl+{c,x,v} using system clipboard register +. We use autocmd to + " override plugin keymaps. + "autocmd VimEnter * vnoremap "+y + "autocmd VimEnter * vnoremap "+x + " Is performed by S+Ins + "autocmd VimEnter * nnoremap "+p + "autocmd VimEnter * inoremap + +endif + +" ctrl+d as EOF exits shells and the like. Add a keymap for the same here. +nnoremap :q + nnoremap :Denite file/rec nnoremap / :Denite grep:. nnoremap s :Denite buffer @@ -30,11 +50,26 @@ nmap ga (EasyAlign) au Filetype gnuplot map :call OpenIn("gnuplot -persist") -au Filetype c,cpp,objc map :vsplit:FSRight -au Filetype c,cpp,objc map :FSHere +" Performs a vertial split and a FSHere. For a header file the split is +" performed to the left, for an implementation file to the right. +function FSvsplit() + " We split to the right on header files + if match(expand('%:e'), 'h.*') >= 0 + execute ':leftabove vsplit' + else + execute ':rightbelow vsplit' + endif + + execute ':FSHere' +endfunction + +au Filetype c,cpp,objc map :call FSvsplit() +" Terminal-based vi report S-F12 as F24 +au Filetype c,cpp,objc map :FSHere +au Filetype c,cpp,objc map :FSHere au Filetype markdown map :call RunMarkdown() -au Filetype asciidoc map :call RunAsciidoc() +au Filetype asciidoc,asciidoctor map :call RunAsciidoc() " See https://github.com/artur-shaik/vim-Javacomplete2 " ji ji @@ -56,7 +91,6 @@ au FileType java imap (JavaComplete-Imports-RemoveUnused) - if filereadable($HOME . '/.vim/keymaps-local.vim') source ~/.vim/keymaps-local.vim endif diff --git a/macros.vim b/macros.vim index b33bf4d..1da3dae 100644 --- a/macros.vim +++ b/macros.vim @@ -78,9 +78,12 @@ endfunction function InsertIncludeGuardsWithoutEndif() - let gatename = substitute(expand("%:t"), "\\.", "_", "g") . '_' . strpart(system('pwgen -c 16 1'), 0, 16) - execute "normal! i#ifndef " . gatename - execute "normal! o#define " . gatename + " Build name of guard: Take filename, replace some chars by _ and + " prepend a random sequence to make guard robust against file name + " collisions. + let guardname = substitute(expand("%:t"), "[\\.-]", "_", "g") . '_' . strpart(system('pwgen -c 16 1'), 0, 16) + execute "normal! i#ifndef " . guardname + execute "normal! o#define " . guardname endfunction @@ -109,6 +112,15 @@ endfunction function RunAsciidoctor() execute ":!asciidoctor " . @% + if executable("asciidoctor-pdf") + execute ":!asciidoctor-pdf " . @% + elseif executable("asciidoctor") + execute ":!asciidoctor " . @% + endif +endfunction + +function RunAsciidoctorPdf() + execute ":!asciidoctor-pdf " . @% endfunction @@ -126,7 +138,9 @@ endfunction function RunAsciidoc() - if executable("asciidoctor") + if executable("asciidoctor-pdf") + call RunAsciidoctorPdf() + elseif executable("asciidoctor") call RunAsciidoctor() else echo "No asciidoc implementation found." diff --git a/neosnippets/gitcommit.snip b/neosnippets/gitcommit.snip index ed9ffe3..dc6106c 100644 --- a/neosnippets/gitcommit.snip +++ b/neosnippets/gitcommit.snip @@ -17,3 +17,7 @@ options head snippet acked-by options head Acked-by: ${1:authorname } +snippet Ste-sthu + Stefan Huber +snippet Ste-fhs + Stefan Huber diff --git a/plugins-local.vim.example b/plugins-local.vim.example index c0be0ea..49d6cdf 100644 --- a/plugins-local.vim.example +++ b/plugins-local.vim.example @@ -1,8 +1,20 @@ Plug 'jamessan/vim-gnupg' -" An alternative to youcompleteme (ycm) -Plug 'justmao945/vim-clang', {'for': ['c', 'cpp', 'objc']} - "Plug 'kien/tabman.vim' "Plug 'chikamichi/mediawiki.vim' + +function PluginsLocalConfig() + " Reduce load on memory by updating one plugin at a time + "let g:plug_threads = 1 + + " Some terminals, like konsole, cause weired symbols (e.g., q) printed due to + " broken cursor-shape termcodes. + "if has('nvim') + "set guicursor= + " Workaround some broken plugins which set guicursor indiscriminately. + "au OptionSet guicursor noautocmd set guicursor= + "end +endfunction + +" vim:ft=vim diff --git a/plugins-noroot-nolowendbox.vim b/plugins-noroot-nolowendbox.vim new file mode 100644 index 0000000..f442a5d --- /dev/null +++ b/plugins-noroot-nolowendbox.vim @@ -0,0 +1,314 @@ +if has('nvim') + Plug 'Shougo/deoplete.nvim', {'do': ':UpdateRemotePlugins'} + Plug 'Shougo/denite.nvim', { 'do': ':UpdateRemotePlugins' } +else + Plug 'Shougo/deoplete.nvim' + Plug 'Shougo/denite.nvim' + + Plug 'roxma/nvim-yarp' + Plug 'roxma/vim-hug-neovim-rpc' +endif + +" java extension to deoplete +Plug 'artur-shaik/vim-javacomplete2', {'for': 'java'} + +Plug 'neomake/neomake' +Plug 'puremourning/vimspector' + +Plug 'kana/vim-operator-user' +Plug 'rhysd/vim-clang-format' +Plug 'justmao945/vim-clang', {'for': ['c', 'cpp', 'objc']} + +" Prevent slow foling update, e.g., for vimtex +Plug 'Konfekt/FastFold' +Plug 'lervag/vimtex' + +Plug 'shuber2/vim-syntax-easychair2' + +Plug 'mhinz/vim-signify' +Plug 'tpope/vim-fugitive' +Plug 'gko/vim-coloresque' + +Plug 'vimwiki/vimwiki' +Plug 'jceb/vim-orgmode', {'for': ['org']} + +Plug 'cakebaker/scss-syntax.vim', {'for': 'scss'} +Plug 'hail2u/vim-css3-syntax', {'for': ['scss', 'css']} + +Plug 'https://gitlab.com/dbeniamine/vim-mail' +Plug 'Konfekt/vim-DetectSpellLang', {'do': 'spell'} +Plug 'dpelle/vim-LanguageTool' + +" Disable devicons on linux terminal +if $TERM == 'linux' + let g:enable_plugin_devicons=0 + " Enable loading of devicons on all others +else + let g:enable_plugin_devicons=1 +endif + +Plug 'ryanoasis/vim-devicons', Cond(g:enable_plugin_devicons) +Plug 'joom/latex-unicoder.vim' +Plug 'chrisbra/unicode.vim' + +Plug 'sjl/splice.vim', {'on': 'SpliceInit'} + +" Costs a second startup time +Plug 'dbeniamine/cheat.sh-vim', {'on': 'Cheat'} + +Plug 'sheerun/vim-polyglot' + +" neovim-0.4 has troubles with nvim-treesitter +if has('nvim-0.5') + " neovim-0.7 works until v0.8.0 + if has('nvim-0.9') + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} + else + Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate', 'tag': 'v0.8.0'} + endif + + Plug 'nvim-treesitter/nvim-treesitter-refactor', {'do': ':TSUpdate'} +endif + +function PluginsNorootNolowendboxConfig() + let g:neomake_c_enabled_makers = ['clangtidy', 'clangcheck'] + let g:neomake_cpp_enabled_makers = ['clangtidy', 'clangcheck'] + let g:clang_compilation_database = '.' + + " Taken from neomake + if OnBattery() + call neomake#configure#automake('w') + else + call neomake#configure#automake('nw', 1000) + endif + + " Speedup deoplete startup time, see deoplete FAQ + let g:python3_host_prog = '/usr/bin/python3' + " deoplete requires huge startuptime. Delay loading upon first InsertEnter. + let g:deoplete#enable_at_startup = 0 + call deoplete#custom#option({ + \ 'smart_case' : v:true, + \ 'auto_refresh_delay' : 100, + \ }) + au InsertEnter * call deoplete#enable() + + " The denite settings are largely stolen from spacevim + let s:denite_options = { + \ 'default' : { + \ 'winheight' : 15, + \ 'mode' : 'insert', + \ 'start_filter' : 1, + \ 'quit' : 1, + \ 'highlight_matched_char' : 'MoreMsg', + \ 'highlight_matched_range' : 'MoreMsg', + \ 'direction': 'rightbelow', + \ }} + + augroup spacevim_layer_denite + autocmd! + autocmd FileType denite call s:denite_my_settings() + augroup END + + function! s:denite_my_settings() abort + nnoremap i + \ denite#do_map('open_filter_buffer') + nnoremap ' + \ denite#do_map('toggle_select').'j' + nnoremap q + \ denite#do_map('quit') + nnoremap + \ denite#do_map('do_action', 'tabopen') + nnoremap + \ denite#do_map('do_action', 'vsplit') + nnoremap + \ denite#do_map('do_action', 'split') + nnoremap + \ denite#do_map('do_action') + nnoremap p + \ denite#do_map('do_action', 'preview') + nnoremap j + nnoremap k + endfunction + + " FIND and GREP COMMANDS + if executable('rg') + " Ripgrep command on grep source + call denite#custom#var('grep', 'command', ['rg']) + call denite#custom#var('grep', 'default_opts', + \ ['--vimgrep', '--no-heading']) + call denite#custom#var('grep', 'recursive_opts', []) + call denite#custom#var('grep', 'pattern_opt', ['--regexp']) + call denite#custom#var('grep', 'separator', ['--']) + call denite#custom#var('grep', 'final_opts', []) + endif + + let s:insert_mode_mappings = [ + \ ['jk', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ] + + let s:normal_mode_mappings = [ + \ ["'", '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['gg', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['', '', 'noremap'], + \ ['q', '', 'noremap'], + \ ['r', '', 'noremap'], + \ ] + + " Have deoplete completion for vimtex (e.g., bibtex entries) + au Filetype tex call deoplete#custom#var('omni', 'input_patterns', { + \ 'tex': g:vimtex#re#deoplete }) + + if has('nvim-0.5') + set foldexpr=nvim_treesitter#foldexpr() + +lua <dc VimspectorContinue + nmap ds VimspectorStop + nmap dr :call VimspectorRestartOrCreateConfig() + "nmap dr :call vimspector#Restart() + nmap drr :call vimspector#Reset() + nmap dp VimspectorPause + nmap db VimspectorToggleBreakpoint + nmap dcb VimspectorToggleConditionalBreakpoint + nmap dfb VimspectorAddFunctionBreakpoint + nmap dtc VimspectorRunToCursor + nmap do VimspectorStepOver + nmap di VimspectorStepInto + nmap dof VimspectorStepOut + " for normal mode, the word under the cursor + nmap de VimspectorBalloonEval + " for visual mode, the visually selected text + xmap de VimspectorBalloonEval + + au BufNewFile .vimspector.json read ~/.vim/vimspector-config/vimspector.json + + " Do not show diagnostic window of vim-clang + let g:clang_diagsopt = '' + + augroup ClangFormatSettings + au! + au FileType c,cpp,objc,javascript,java,typescript,protobuf,cuda,vala + \ vmap cf (operator-clang-format) + au FileType c,cpp,objc,javascript,java,typescript,protobuf,cuda,vala + \ nmap cf :ClangFormat + augroup END + +endfunction diff --git a/plugins-noroot.vim b/plugins-noroot.vim new file mode 100644 index 0000000..81411f9 --- /dev/null +++ b/plugins-noroot.vim @@ -0,0 +1,73 @@ +Plug 'majutsushi/tagbar', {'on': 'TagbarToggle'} + +" Conditional loading does not work, see github issue #823 +Plug 'ludovicchabant/vim-gutentags' +"Plug 'vim-scripts/Conque-GDB', {'for': ['c', 'cpp', 'objc']} + +Plug 'editorconfig/editorconfig-vim' +Plug 'embear/vim-localvimrc' + +Plug 'airblade/vim-rooter' +Plug 'Xuyuanp/nerdtree-git-plugin', {'on': 'NERDTreeToggle'} + +Plug 'plasticboy/vim-markdown', {'for': 'markdown'} +Plug 'lvht/tagbar-markdown', {'for': 'markdown'} +Plug 'habamax/vim-asciidoctor', {'for': 'asciidoc'} + +Plug 'PProvost/vim-markdown-jekyll', {'for': 'markdown'} +Plug 'tpope/vim-liquid', {'for': ['liquid', 'html', 'xml', 'markdown']} + +Plug 'tpope/vim-ragtag' + +Plug 'Shougo/neosnippet.vim' +Plug 'Shougo/neosnippet-snippets' + +Plug 'tpope/vim-speeddating' +Plug 'mattn/calendar-vim' + +Plug 'vim-scripts/loremipsum', {'on': 'Loremipsum'} + +Plug 'ggandor/leap.nvim' + +function PluginsNorootConfig() + let g:localvimrc_persistent = 1 + + let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] + + "augroup pencil + "au! + "au FileType markdown,mkd call pencil#init() + "au FileType text call pencil#init() + "au FileType mail call pencil#init() + "au FileType tex call pencil#init() + "augroup END + + let g:vim_markdown_frontmatter=1 + let g:vim_markdown_math=1 + + au FileType markdown call RagtagInit() + + " Generally disable gutentags, but enable for some filetypes + let g:gutentags_enabled = 0 + au FileType c,cpp,objc,tex let g:gutentags_enabled = 1 + " Make manually created tags files also root markers + let g:gutentags_project_root = ['tags'] + let g:gutentags_cache_dir = expand('~/.cache/vim/ctags/') + " Do not automatically generate on browsing + let g:gutentags_generate_on_missing = 0 + let g:gutentags_ctags_exclude_wildignore = 1 + let g:gutentags_ctags_exclude = [ + \'node_modules', '_build', 'build*', 'CMakeFiles', '.*cache*', 'venv', + \'*.md', '*.css', '*.html', '*.json', '*.xml', '*.xmls', '*.ui'] + + " Allow for reflow of bullet paragraphs + let g:vim_markdown_auto_insert_bullets = 0 + + let g:calendar_monday = 1 + + if has('nvim-0.5') +lua < :WhichKey '' + nnoremap :WhichKey ',' + vnoremap :WhichKeyVisual '' + vnoremap :WhichKeyVisual ',' + + let g:which_key_map = {} + au VimEnter * call which_key#register('', 'g:which_key_map') + let g:which_key_map.b = { + \ 'name': '+buffer', + \ '1': ['b1', 'buffer 1'], + \ '2': ['b2', 'buffer 2'], + \ 'd': ['bd', 'delete-buffer'], + \ 'f': ['bfirst', 'first-buffer'], + \ 'h': ['Startify', 'home-buffer'], + \ 'l': ['blast', 'last-buffer'], + \ 'n': ['bnext', 'next-buffer'], + \ 'p': ['bprevious', 'previous-buffer'], + \ } -Plug 'sheerun/vim-polyglot' +endfunction -if filereadable($HOME . '/.vim/plugins-local.vim') - source ~/.vim/plugins-local.vim -endif diff --git a/plugsetup.vim b/plugsetup.vim index ab7fa21..f47a045 100644 --- a/plugsetup.vim +++ b/plugsetup.vim @@ -6,13 +6,46 @@ if empty(glob('~/.vim/autoload/plug.vim')) autocmd VimEnter * PlugInstall --sync | source ~/.vim/init.vim endif + call plug#begin('~/.vim/plugged') + source ~/.vim/plugins.vim + +" Load various conditinoal plugin sets +if filereadable($HOME . '/.vim/plugins-local.vim') + source ~/.vim/plugins-local.vim +endif + +if $USER != "root" + source ~/.vim/plugins-noroot.vim + + if g:lowendbox == 0 + source ~/.vim/plugins-noroot-nolowendbox.vim + endif +endif + call plug#end() -"Automatically install missing plugins -"https://github.com/junegunn/vim-plug/wiki/extra -autocmd VimEnter * - \ if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) - \| PlugInstall --sync | q - \| endif + +" Call the config functions of the plugins +call PluginsConfig() +if filereadable($HOME . '/.vim/plugins-local.vim') + call PluginsLocalConfig() +endif +if $USER != "root" + call PluginsNorootConfig() + if g:lowendbox == 0 + call PluginsNorootNolowendboxConfig() + endif +endif + + +function s:PostConfig() + "Automatically install missing plugins + "https://github.com/junegunn/vim-plug/wiki/extra + if len(filter(values(g:plugs), '!isdirectory(v:val.dir)')) + PlugInstall --sync | q + endif +endfunction + +autocmd VimEnter * call s:PostConfig() diff --git a/syntax/dis.vim b/syntax/dis.vim new file mode 100644 index 0000000..8da41dd --- /dev/null +++ b/syntax/dis.vim @@ -0,0 +1,119 @@ +" Vim syntax file +" Language: x86/x64 GNU Disassembler (objdump -d -Mintel) +" Maintainer: @shiracamus +" Last Change: 2013 Dec 30 + +" For version 5.x: Clear all syntax items +" For version 6.0 and later: Quit when a syntax file was already loaded +if version < 600 + syntax clear +elseif exists("b:current_syntax") + finish +endif + +let s:cpo_save = &cpo +set cpo&vim + +syn case ignore + +syn match disOffset "[+-]" +syn match disNumber "[+-]\?\<0x[0-9a-f]\+\>" contains=disOffset +syn match disNumber "[+-]\?\<[0-9a-f]\+\>" contains=disOffset + +syn match disRegister "\<[re]\?[abcd][xhl]\>" +syn match disRegister "\<[re]\?[sd]il\?\>" +syn match disRegister "\<[re]\?[sbi]pl\?\>" +syn match disRegister "\" +syn match disRegister "[^\t]\<[cdefgs]s\>"hs=s+1 + +syn match disAt "@" +syn match disSection " \.[a-z][a-z_\.-]*:"he=e-1 +syn match disSection "@[a-z0-9_][a-z0-9_-]\+"hs=s+1 contains=disAt,disNumber + +" SH: Having a function name like "f" leads to labels like "", which shall +" not be matched as disNumber. +"syn match disLabel "<[a-z0-9_.][a-z0-9_.@+-]*>"hs=s+1,he=e-1 contains=disNumber,disSection +syn match disLabel "<[a-z0-9_.][a-z0-9_.@+-]*>"hs=s+1,he=e-1 contains=disSection +syn match disHexDump ":\t\([0-9a-f][0-9a-f][ \t]\)\+"hs=s+1 + +syn match disError "" +syn match disError "(bad)" + +syn keyword disTodo contained TODO + +syn region disComment start="/\*" end="\*/" contains=disTodo +syn match disComment "[#;!|].*" contains=disLabel,disTodo +syn match disStatement "//.*" contains=cStatement + +syn match disSpecial display contained "\\\(x\x\+\|\o\{1,3}\|.\|$\)" +syn region disString start=+"+ skip=+\\\\\|\\"\|\\$+ excludenl end=+"+ end=+$+ keepend contains=disSpecial +syn region disString start=+'+ skip=+\\\\\|\\'\|\\$+ excludenl end=+'+ end=+$+ keepend contains=disSpecial + +syn match disFormat ": \+file format " +syn match disTitle "^[^ ]\+: \+file format .*$" contains=disFormat + +syn match disMacro "FWORD" +syn match disMacro "QWORD" +syn match disMacro "DWORD" +syn match disMacro "BYTE" +syn match disMacro "PTR" + +syn match disData ".word" +syn match disData ".short" +syn match disData ".byte" + +" Opecode matched disNumber +syn match disOpecode "\= 508 || !exists("did_dis_syntax_inits") + if version < 508 + let did_dis_syntax_inits = 1 + command -nargs=+ HiLink hi link + else + command -nargs=+ HiLink hi def link + endif + + " The default methods for highlighting. Can be overridden later + " Comment + HiLink disComment Comment + " Constant: String, Character, Number, Boolean, Float + HiLink disNumber Number + HiLink disString String + " Identifier: Function + HiLink disHexDump Identifier + " Statement: Conditional, Repeat, Label, Operator, Keyword, Exception + HiLink disStatement Statement + HiLink disLabel Label + " PreProc: Include, Define, Macro, PreCondit + HiLink disData Define + HiLink disMacro Macro + " Type: StorageClass, Structure, Typedef + HiLink disRegister StorageClass + HiLink disTitle Typedef + " Special: SpecialChar, Tag, Delimiter, SpecialComment, Debug + HiLink disSpecial SpecialChar + HiLink disSection Special + " Underlined + " Ignore + " Error + HiLink disError Error + " Todo + HiLink disTodo Todo + + delcommand HiLink +endif + +let b:current_syntax = "dis" + +let &cpo = s:cpo_save +unlet s:cpo_save + +" vim: ts=8 sts=4 sw=2 diff --git a/vimspector-config/vimspector.json b/vimspector-config/vimspector.json new file mode 100644 index 0000000..c6a761a --- /dev/null +++ b/vimspector-config/vimspector.json @@ -0,0 +1,63 @@ +// This is from a template. Modify for your needs. +{ + "configurations": { + "Launch": { + "default": true, + "adapter": "vscode-cpptools", + "filetypes": [ "cpp", "c", "objc", "rust" ], + "configuration": { + "request": "launch", + "MIMode": "gdb", + "program": "${fileBasenameNoExtension}", + "args": [ ], + "environment": [ ], + "externalConsole": true, + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + }, + "Attach": { + "adapter": "vscode-cpptools", + "filetypes": [ "cpp", "c", "objc", "rust" ], + "configuration": { + "request": "attach", + "MIMode": "gdb", + "program": "${fileBasenameNoExtension}", + "setupCommands": [ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ] + } + }, + "Python: Attach To Vim": { + "adapter": "multi-session", + "filetypes": [ "python" ], + "variables": { + "port": "5678", + "host": "localhost" + }, + "configuration": { + "request": "attach" + } + }, + "Python: Run current script": { + "default": true, + "adapter": "debugpy", + "filetypes": [ "python" ], + "configuration": { + "request": "launch", + "program": "${file}", + "args": [ "*${args:--update-gadget-config}" ], + "justMyCode#json": "${justMyCode:true}" + } + } + } +}