2020-03-25 03:59:42 +01:00
|
|
|
|
" try not to put any lines in your vimrc that you don't understand :)
|
2019-04-12 19:04:50 +02:00
|
|
|
|
set nocompatible
|
2019-11-19 01:07:36 +01:00
|
|
|
|
|
2019-05-15 03:29:22 +02:00
|
|
|
|
filetype off "required
|
2019-04-12 19:04:50 +02:00
|
|
|
|
|
|
|
|
|
" Enable heavy omni completion.
|
|
|
|
|
if !exists('g:neocomplete#sources#omni#input_patterns')
|
|
|
|
|
let g:neocomplete#sources#omni#input_patterns = {}
|
|
|
|
|
endif
|
2019-11-19 01:07:36 +01:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if empty(glob('~/.vim/autoload/plug.vim'))
|
|
|
|
|
silent !curl -fLo ~/.vim/autoload/plug.vim --create-dirs
|
|
|
|
|
\ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
|
|
|
|
|
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
|
|
|
|
endif
|
|
|
|
|
|
2021-05-03 02:05:15 +02:00
|
|
|
|
" Run PlugInstall if there are missing plugins
|
|
|
|
|
autocmd VimEnter * if len(filter(values(g:plugs), '!isdirectory(v:val.dir)'))
|
|
|
|
|
\| PlugInstall --sync | source $MYVIMRC
|
|
|
|
|
\| endif
|
|
|
|
|
|
|
|
|
|
" both "filetype indent on" and "syntax on" are called by Plug, keeping DRY
|
2019-11-19 01:07:36 +01:00
|
|
|
|
call plug#begin()
|
2021-05-03 02:05:15 +02:00
|
|
|
|
Plug 'liuchengxu/space-vim-theme'
|
2020-02-28 02:06:26 +01:00
|
|
|
|
Plug 'vim-airline/vim-airline'
|
|
|
|
|
Plug 'vim-airline/vim-airline-themes'
|
2021-05-03 02:05:15 +02:00
|
|
|
|
|
|
|
|
|
Plug 'ctrlpvim/ctrlp.vim', { 'on': [] }
|
|
|
|
|
" 🌷 Distraction-free writing in Vim
|
|
|
|
|
Plug 'junegunn/goyo.vim', { 'for': 'markdown' }
|
2021-05-29 21:21:59 +02:00
|
|
|
|
Plug 'preservim/nerdcommenter'
|
2021-05-20 20:17:10 +02:00
|
|
|
|
Plug 'airblade/vim-gitgutter'
|
2021-05-03 02:05:15 +02:00
|
|
|
|
|
2020-02-28 02:06:26 +01:00
|
|
|
|
Plug 'tpope/vim-surround'
|
2021-05-03 02:05:15 +02:00
|
|
|
|
" fugitive.vim: A Git wrapper so awesome, it should be illegal
|
2020-02-28 02:06:26 +01:00
|
|
|
|
Plug 'tpope/vim-fugitive'
|
|
|
|
|
Plug 'tpope/vim-repeat'
|
2021-05-03 02:05:15 +02:00
|
|
|
|
Plug 'tpope/vim-speeddating', { 'on': [] }| " quick date incrementing
|
|
|
|
|
" plugin fails to work if it's only loaded on a predefined list of
|
|
|
|
|
" formats, commented for now
|
|
|
|
|
" Plug 'tpope/vim-afterimage', { 'for': ['xpm', 'png', 'ico', 'gif'] }
|
|
|
|
|
Plug 'tpope/vim-jdaddy', { 'for': 'json' }
|
|
|
|
|
Plug 'tpope/vim-ragtag', { 'for': ['html', 'xhtml', 'wml', 'xml', 'xslt', 'xsd', 'jsp', 'php', 'aspperl', 'aspvbs', 'cf', 'mason', 'htmldjango', 'eruby'] }
|
2021-11-10 00:35:12 +01:00
|
|
|
|
Plug 'bazelbuild/vim-ft-bzl'
|
2021-05-03 02:05:15 +02:00
|
|
|
|
|
|
|
|
|
Plug 'gorodinskiy/vim-coloresque'| " coloured background for colour names/codes
|
|
|
|
|
Plug 'lpinilla/vim-codepainter'| " text highlighting
|
2020-04-27 22:42:42 +02:00
|
|
|
|
Plug 'rhysd/git-messenger.vim'
|
2020-02-28 02:06:26 +01:00
|
|
|
|
Plug 'Yggdroot/indentLine'
|
2021-05-03 02:05:15 +02:00
|
|
|
|
Plug 'preservim/nerdtree', { 'on': 'NERDTreeToggle' }
|
|
|
|
|
Plug 'Xuyuanp/nerdtree-git-plugin', { 'on': 'NERDTreeToggle' }
|
|
|
|
|
Plug 'tiagofumo/vim-nerdtree-syntax-highlight', { 'on': 'NERDTreeToggle' }
|
|
|
|
|
|
2019-12-12 17:07:26 +01:00
|
|
|
|
Plug 'roxma/nvim-yarp'
|
|
|
|
|
Plug 'roxma/vim-hug-neovim-rpc'
|
2021-02-10 23:26:30 +01:00
|
|
|
|
Plug 'Shougo/deoplete.nvim'
|
2021-05-03 02:05:15 +02:00
|
|
|
|
Plug 'vim-syntastic/syntastic', { 'on': [] }
|
|
|
|
|
Plug 'dense-analysis/ale'
|
|
|
|
|
Plug 'OmniSharp/omnisharp-vim', { 'for': ['cs', 'csh'] }
|
|
|
|
|
Plug 'justmao945/vim-clang', { 'on': [] }
|
|
|
|
|
Plug 'cdelledonne/vim-cmake'
|
2020-10-05 18:32:34 +02:00
|
|
|
|
Plug 'majutsushi/tagbar'
|
2021-05-03 02:05:15 +02:00
|
|
|
|
Plug 'lvht/tagbar-markdown', { 'for': 'markdown' }
|
|
|
|
|
|
|
|
|
|
Plug 'lervag/vimtex', { 'for': 'tex' }
|
|
|
|
|
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
|
|
|
|
|
Plug 'cespare/vim-toml', { 'for': 'toml' }
|
|
|
|
|
Plug 'Glench/Vim-Jinja2-Syntax'
|
2021-03-15 14:13:32 +01:00
|
|
|
|
Plug 'pearofducks/ansible-vim'
|
2021-11-10 01:08:28 +01:00
|
|
|
|
Plug 'hashivim/vim-terraform', { 'for': 'terraform' }
|
2021-05-03 02:05:15 +02:00
|
|
|
|
Plug 'aouelete/sway-vim-syntax', { 'for': 'sway' }
|
2021-03-15 14:13:32 +01:00
|
|
|
|
Plug 'rust-lang/rust.vim', { 'for': 'rust' }
|
2021-11-10 01:08:28 +01:00
|
|
|
|
Plug 'fatih/vim-go', { 'for': ['go', 'gohtmltmpl'], 'do': ':GoInstallBinaries' }
|
2021-05-03 02:05:15 +02:00
|
|
|
|
Plug 'chikamichi/mediawiki.vim', { 'for': 'wiki' }
|
2021-11-10 01:08:28 +01:00
|
|
|
|
Plug 's3rvac/vim-syntax-redminewiki', { 'for': 'redminewiki' }
|
2021-05-03 02:05:15 +02:00
|
|
|
|
Plug 'mfukar/robotframework-vim', { 'for': 'robotframework' }
|
2019-11-19 01:07:36 +01:00
|
|
|
|
call plug#end()
|
|
|
|
|
|
2019-12-16 00:53:36 +01:00
|
|
|
|
let g:airline_powerline_fonts = 1
|
|
|
|
|
let g:airline_highlighting_cache = 1
|
2021-05-03 02:05:15 +02:00
|
|
|
|
" violet, wombat, deus
|
|
|
|
|
let g:airline_theme = 'violet'
|
2020-03-18 04:40:11 +01:00
|
|
|
|
let g:airline#extensions#tabline#enabled = 1
|
|
|
|
|
let g:airline#extensions#tabline#formatter = 'unique_tail'
|
2021-05-03 02:05:15 +02:00
|
|
|
|
let g:airline_mode_map = {
|
|
|
|
|
\ '__' : '-',
|
|
|
|
|
\ 'c' : 'C',
|
|
|
|
|
\ 'i' : 'I',
|
|
|
|
|
\ 'ic' : 'I-C',
|
|
|
|
|
\ 'ix' : 'I-X',
|
|
|
|
|
\ 'n' : 'N',
|
|
|
|
|
\ 'multi' : 'M',
|
|
|
|
|
\ 'ni' : 'N',
|
|
|
|
|
\ 'no' : 'N',
|
|
|
|
|
\ 'R' : 'R',
|
|
|
|
|
\ 'Rv' : 'R',
|
|
|
|
|
\ 's' : 'S',
|
|
|
|
|
\ 'S' : 'S',
|
|
|
|
|
\ '' : 'S',
|
|
|
|
|
\ 't' : 'T',
|
|
|
|
|
\ 'v' : 'V',
|
|
|
|
|
\ 'V' : 'V-L',
|
|
|
|
|
\ '' : 'V-B',
|
|
|
|
|
\ }
|
|
|
|
|
" skip displaying fileformat output if the output matches a configured string.
|
|
|
|
|
let g:airline#parts#ffenc#skip_expected_string='utf-8[unix]'
|
|
|
|
|
let g:airline#extensions#ale#enabled = 1
|
|
|
|
|
|
2021-11-10 00:40:00 +01:00
|
|
|
|
let g:ale_close_preview_on_insert = 1
|
|
|
|
|
let g:ale_detail_to_floating_preview = 1
|
|
|
|
|
let g:ale_virtualtext_cursor = 1
|
|
|
|
|
let g:ale_hover_to_floating_preview = 1
|
|
|
|
|
let g:ale_completion_enabled = 1
|
|
|
|
|
let g:ale_hover_to_preview = 1
|
|
|
|
|
let g:ale_lsp_suggestions = 1
|
|
|
|
|
|
2021-05-20 20:17:59 +02:00
|
|
|
|
let g:ale_open_list = 0
|
|
|
|
|
let g:ale_keep_list_window_open = 0
|
|
|
|
|
let g:ale_list_window_size = 5
|
2021-05-03 02:05:15 +02:00
|
|
|
|
let g:ale_lint_on_text_changed = 'normal'
|
|
|
|
|
let g:ale_lint_on_insert_leave = 1
|
|
|
|
|
let g:ale_lint_delay = 1000| " the default being 200
|
|
|
|
|
let g:ale_completion_autoimport = 1
|
|
|
|
|
let g:ale_linters = { 'go': ['gopls', 'govet', 'golint'],
|
|
|
|
|
\ 'dockerfile': ['hadolint'],
|
2021-11-10 01:11:30 +01:00
|
|
|
|
\ 'cs': ['OmniSharp'],
|
|
|
|
|
\ 'c': ['clang-format', 'ccls', 'clangd', 'clangtidy', 'cppcheck', 'cquery', 'flawfinder'],
|
|
|
|
|
\ 'cpp': ['clang-format','ccls', 'clangd', 'clangtidy', 'cppcheck', 'flawfinder'],
|
|
|
|
|
\ 'tf': ['tflint', 'terraform', 'tfsec', 'checkov'] }
|
|
|
|
|
let g:ale_fixers = { 'c': ['ccls', 'clang-format', 'clangtidy', 'cppcheck', 'cquery', 'flawfinder'],
|
|
|
|
|
\ 'cpp': ['clang-format', 'clangtidy', 'cppcheck', 'flawfinder'],
|
2021-05-03 02:05:15 +02:00
|
|
|
|
\ 'go': ['gopls'] }
|
|
|
|
|
|
|
|
|
|
if has('patch-8.1.1880')
|
|
|
|
|
set completeopt=longest,menuone,popuphidden
|
|
|
|
|
" Highlight the completion documentation popup background/foreground the same as
|
|
|
|
|
" the completion menu itself, for better readability with highlighted
|
|
|
|
|
" documentation.
|
|
|
|
|
set completepopup=highlight:Pmenu,border:off
|
|
|
|
|
else
|
|
|
|
|
set completeopt=longest,menuone,preview
|
|
|
|
|
" Set desired preview window height for viewing documentation.
|
|
|
|
|
set previewheight=5
|
|
|
|
|
endif
|
|
|
|
|
|
2019-12-16 00:53:36 +01:00
|
|
|
|
|
2019-12-12 17:07:26 +01:00
|
|
|
|
let g:gitgutter_terminal_reports_focus=0
|
2021-03-15 14:14:40 +01:00
|
|
|
|
let g:gitgutter_async = 1
|
2019-12-16 00:53:36 +01:00
|
|
|
|
let g:gitgutter_sign_allow_clobber=0
|
2021-05-20 20:32:50 +02:00
|
|
|
|
let g:gitgutter_set_sign_backgrounds = 0
|
2021-11-10 00:42:30 +01:00
|
|
|
|
let g:gitgutter_preview_win_floating = 1
|
2021-05-03 02:05:15 +02:00
|
|
|
|
set foldtext=gitgutter#fold#foldtext()
|
2019-12-12 17:07:26 +01:00
|
|
|
|
|
2021-02-10 23:26:30 +01:00
|
|
|
|
let g:deoplete#enable_at_startup = 1
|
2020-03-25 03:59:42 +01:00
|
|
|
|
let g:deoplete#enable_ignore_case = 1
|
2019-11-19 01:07:36 +01:00
|
|
|
|
|
2019-12-16 00:53:36 +01:00
|
|
|
|
let g:livepreview_cursorhold_recompile = 0
|
2020-05-27 10:25:31 +02:00
|
|
|
|
let g:livepreview_previewer = 'evince'
|
|
|
|
|
let g:livepreview_engine = 'pdflatex -shell-escape -interaction=nonstopmode'
|
|
|
|
|
let g:vimtex_compiler_progname = 'pdflatex -shell-escape --interaction=nonstopmode'
|
2020-03-24 04:41:53 +01:00
|
|
|
|
let g:tex_flavor = 'latex'
|
2020-02-28 02:06:26 +01:00
|
|
|
|
|
|
|
|
|
" Add spaces after comment delimiters by default
|
|
|
|
|
let g:NERDSpaceDelims = 1
|
|
|
|
|
" Allow commenting and inverting empty lines (useful when commenting a region)
|
|
|
|
|
let g:NERDCommentEmptyLines = 1
|
|
|
|
|
" Enable trimming of trailing whitespace when uncommenting
|
|
|
|
|
let g:NERDTrimTrailingWhitespace = 1
|
|
|
|
|
"""" Enable NERDCommenterToggle to check all selected lines is commented or not
|
|
|
|
|
"""let g:NERDToggleCheckAllLines = 1
|
|
|
|
|
" Add your own custom formats or override the defaults
|
2020-10-05 18:32:34 +02:00
|
|
|
|
let g:NERDCustomDelimiters = { 'vim': { 'left': '"','right': '' }, 'c': { 'left': '/**','right': '*/' }, 'zsh': { 'left': '#','right': ''} }
|
|
|
|
|
let g:NERDTreeGitStatusWithFlags = 1
|
2020-02-28 02:06:26 +01:00
|
|
|
|
|
2020-05-27 10:25:31 +02:00
|
|
|
|
let g:indentLine_setColors = 1
|
2020-02-28 02:06:26 +01:00
|
|
|
|
let g:indentLine_char_list = ['|', '¦', '┆', '┊', ':']
|
2021-02-04 22:37:38 +01:00
|
|
|
|
let g:indentLine_conceallevel = 0
|
2020-02-28 02:06:26 +01:00
|
|
|
|
|
2020-04-27 22:42:42 +02:00
|
|
|
|
|
|
|
|
|
let g:git_messenger_close_on_cursor_moved = v:false
|
|
|
|
|
let g:git_messenger_always_into_popup = v:true
|
2020-10-05 18:32:34 +02:00
|
|
|
|
hi gitmessengerHash term=None guifg=#f0eaaa ctermfg=111
|
2020-04-27 22:42:42 +02:00
|
|
|
|
|
2021-05-03 02:05:15 +02:00
|
|
|
|
" OmniSharp
|
|
|
|
|
" IDE0010: Populate switch - display in ALE as `Info`
|
|
|
|
|
" IDE0055: Fix formatting - display in ALE as `Warning` style error
|
|
|
|
|
" CS8019: Duplicate of IDE0005
|
|
|
|
|
let g:OmniSharp_diagnostic_overrides = {
|
|
|
|
|
\ 'IDE0010': {'type': 'I'},
|
|
|
|
|
\ 'IDE0055': {'type': 'W', 'subtype': 'Style'},
|
|
|
|
|
\ 'CS8019': {'type': 'None'},
|
|
|
|
|
\}
|
2020-04-27 22:42:42 +02:00
|
|
|
|
|
2021-03-15 14:15:41 +01:00
|
|
|
|
let g:syntastic_always_populate_loc_list = 1
|
2020-02-28 02:06:26 +01:00
|
|
|
|
let g:syntastic_auto_loc_list = 2
|
|
|
|
|
let g:syntastic_loc_list_height = 8
|
|
|
|
|
let g:syntastic_check_on_open = 1
|
|
|
|
|
let g:syntastic_check_on_wq = 0
|
|
|
|
|
let g:syntastic_aggregate_errors = 1
|
|
|
|
|
let g:syntastic_id_checkers = 1
|
|
|
|
|
let g:syntastic_error_symbol = "✗"
|
|
|
|
|
let g:syntastic_warning_symbol = "âš "
|
|
|
|
|
|
|
|
|
|
set statusline+=%#warningmsg#
|
2021-05-03 02:05:15 +02:00
|
|
|
|
set statusline+=%{exists('g:loaded_syntastic_plugin')?SyntasticStatuslineFlag():''}
|
2020-02-28 02:06:26 +01:00
|
|
|
|
set statusline+=%*
|
|
|
|
|
|
|
|
|
|
let g:syntastic_javascript_checkers = ['jsl']
|
2021-05-03 02:05:15 +02:00
|
|
|
|
let g:syntastic_python_checkers = ['flake8', 'pylint-3']
|
2020-03-25 03:59:42 +01:00
|
|
|
|
let g:syntastic_c_compiler = 'clang'
|
2020-02-28 02:06:26 +01:00
|
|
|
|
let g:syntastic_c_check_header = 1
|
|
|
|
|
let g:syntastic_c_auto_refresh_includes = 1
|
|
|
|
|
let g:syntastic_cpp_check_header = 1
|
|
|
|
|
let g:syntastic_cpp_auto_refresh_includes = 1
|
2021-05-03 02:05:15 +02:00
|
|
|
|
let g:syntastic_c_cpplint_exec = ['cppcheck', 'clang-check', 'clang-tidy']
|
|
|
|
|
let g:syntastic_go_checkers = ['go', 'gopls', 'golint', 'govet']
|
|
|
|
|
|
|
|
|
|
let g:terraform_align=1
|
|
|
|
|
let g:terraform_fold_sections=1
|
|
|
|
|
let g:terraform_fmt_on_save=1
|
2020-02-28 02:06:26 +01:00
|
|
|
|
|
2019-12-10 01:05:57 +01:00
|
|
|
|
" change cursor shape for different editing modes, neovim does this by default
|
2021-03-23 19:37:38 +01:00
|
|
|
|
if !has('nvim')
|
|
|
|
|
if exists('$TMUX')
|
|
|
|
|
let &t_SI = "\<Esc>Ptmux;\<Esc>\e[12 q\<Esc>\\"
|
|
|
|
|
let &t_SI = "\<Esc>Ptmux;\<Esc>\e[4 q\<Esc>\\"
|
|
|
|
|
let &t_SI = "\<Esc>Ptmux;\<Esc>\e[2 q\<Esc>\\"
|
|
|
|
|
else
|
2021-11-10 00:45:54 +01:00
|
|
|
|
let &t_SI = "\<Esc>]12;purple\x7"
|
2021-03-23 19:37:38 +01:00
|
|
|
|
let &t_SR = "\e[4 q"
|
|
|
|
|
let &t_EI = "\e[2 q"
|
|
|
|
|
endif
|
|
|
|
|
endif
|
2021-03-15 14:16:36 +01:00
|
|
|
|
" reset cursor when vim exits
|
|
|
|
|
autocmd VimLeave * silent !echo -ne "\033]112\007"
|
2019-12-10 01:05:57 +01:00
|
|
|
|
|
|
|
|
|
command! W execute 'silent w !sudo tee % >/dev/null' | edit!
|
2020-02-28 02:06:26 +01:00
|
|
|
|
command! -nargs=* Make write | make! <args> | cwindow
|
2019-12-10 01:05:57 +01:00
|
|
|
|
|
|
|
|
|
" open a terminal in $PWD
|
|
|
|
|
nnoremap <silent> <Leader>tt :terminal<CR>
|
2021-05-03 14:43:57 +02:00
|
|
|
|
" terminal normal mode
|
|
|
|
|
tnoremap <F1> <C-W>N
|
2019-12-16 00:53:36 +01:00
|
|
|
|
" toggle showing whitespace
|
|
|
|
|
noremap <F5> :set list!<CR>
|
2020-02-28 02:06:26 +01:00
|
|
|
|
" make shortcut
|
2021-05-03 14:43:57 +02:00
|
|
|
|
nnoremap <F4> :term ++hidden ++open make<cr>
|
|
|
|
|
nnoremap <leader><F4> :term ++open make<cr>
|
2020-10-05 18:32:34 +02:00
|
|
|
|
nnoremap <F8> :TagbarToggle<CR>
|
2020-02-28 02:06:26 +01:00
|
|
|
|
" NERDTree
|
|
|
|
|
nmap <Leader>nt :NERDTreeToggle<CR>
|
2019-12-16 00:53:36 +01:00
|
|
|
|
|
|
|
|
|
vmap gb :<C-U>!git blame % -L<C-R>=line("'<") <CR>,<C-R>=line("'>") <CR><CR>
|
2020-10-05 18:32:34 +02:00
|
|
|
|
nnoremap gb :!git blame %<CR>
|
2021-11-10 01:03:15 +01:00
|
|
|
|
" ll provided by vimtex
|
|
|
|
|
nnoremap <silent> <Leader>kk :w! !pdflatex -shell-escape -interaction=nonstopmode $PWD/*.tex<CR><CR>
|
|
|
|
|
:function Pdfpls()
|
|
|
|
|
:echom "compiling ur tex goodness!"
|
|
|
|
|
:w!
|
|
|
|
|
:!pdflatex -shell-escape -interaction=nonstopmode $PWD/*.tex
|
|
|
|
|
:!bibtex $PWD/*.aux
|
|
|
|
|
:!pdflatex -shell-escape -interaction=nonstopmode $PWD/*.tex
|
|
|
|
|
:endfunction
|
|
|
|
|
|
|
|
|
|
nnoremap <silent> <Leader>lb :call Pdfpls()<cr><Esc>
|
2021-02-04 22:37:38 +01:00
|
|
|
|
nnoremap <Leader>l :exec &conceallevel ? "set conceallevel=0" : "set conceallevel=1"<CR><CR>
|
2019-12-10 01:05:57 +01:00
|
|
|
|
|
2021-05-03 02:05:15 +02:00
|
|
|
|
" toggle GitGutterLineHighlights
|
|
|
|
|
nnoremap <Leader>d :GitGutterLineHighlightsToggle<cr>
|
|
|
|
|
|
|
|
|
|
" ALE bindings
|
|
|
|
|
nmap <silent> <C-k> <Plug>(ale_previous_wrap)
|
|
|
|
|
nmap <silent> <C-j> <Plug>(ale_next_wrap)
|
|
|
|
|
nnoremap <Leader>a :ALEDetail<cr>
|
2020-04-27 22:42:42 +02:00
|
|
|
|
|
|
|
|
|
" ------ wayland copy
|
2020-10-05 18:32:34 +02:00
|
|
|
|
xnoremap <silent>"+y y:call system("wl-copy", @")<cr>
|
|
|
|
|
nnoremap <silent>"+p :let @"=substitute(system("wl-paste --no-newline"), '<C-v><C-m>', '', 'g')<cr>p
|
2020-04-27 22:42:42 +02:00
|
|
|
|
nnoremap "*p :let @"=substitute(system("wl-paste --no-newline --primary"), '<C-v><C-m>', '', 'g')<cr>p
|
|
|
|
|
|
2020-05-27 10:25:31 +02:00
|
|
|
|
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
|
2020-10-05 18:32:34 +02:00
|
|
|
|
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<left>"
|
2020-04-27 22:42:42 +02:00
|
|
|
|
|
2019-12-10 01:05:57 +01:00
|
|
|
|
" ------ autocmd ------
|
2020-05-27 10:25:31 +02:00
|
|
|
|
|
|
|
|
|
" Enable omni completion.
|
2020-10-05 18:32:34 +02:00
|
|
|
|
" autocmd FileType css setlocal omnifunc=csscomplete#CompleteCSS
|
|
|
|
|
" autocmd FileType html,markdown setlocal omnifunc=htmlcomplete#CompleteTags
|
|
|
|
|
" autocmd FileType javascript setlocal omnifunc=javascriptcomplete#CompleteJS
|
|
|
|
|
" autocmd FileType python setlocal omnifunc=pythoncomplete#Complete
|
|
|
|
|
" autocmd FileType xml setlocal omnifunc=xmlcomplete#CompleteTags
|
2020-05-27 10:25:31 +02:00
|
|
|
|
|
2019-12-16 00:53:36 +01:00
|
|
|
|
" automatically open NERDTree if vim is open on it's own (argc() ==0 )
|
2020-04-27 22:42:42 +02:00
|
|
|
|
" autocmd StdinReadPre * let s:std_in=1
|
|
|
|
|
" autocmd VimEnter * if argc() == 0 && !exists("s:std_in") | NERDTree | endif
|
2019-12-10 01:05:57 +01:00
|
|
|
|
|
|
|
|
|
" Reload changes if file changed outside of vim requires autoread
|
|
|
|
|
augroup load_changed_file
|
|
|
|
|
autocmd!
|
|
|
|
|
autocmd FocusGained,BufEnter * if mode() !=? 'c' | checktime | endif
|
|
|
|
|
autocmd FileChangedShellPost * echo "Changes loaded from source file"
|
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
|
|
" when quitting a file, save the cursor position
|
|
|
|
|
augroup save_cursor_position
|
|
|
|
|
autocmd!
|
|
|
|
|
autocmd BufReadPost * call setpos(".", getpos("'\""))
|
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
|
|
" when not running in a console or a terminal that doesn't support 256 colors
|
|
|
|
|
" enable cursorline in the currently active window and disable it in inactive ones
|
|
|
|
|
if $DISPLAY !=? '' && &t_Co == 256
|
|
|
|
|
augroup cursorline
|
|
|
|
|
autocmd!
|
|
|
|
|
autocmd VimEnter,WinEnter,BufWinEnter * setlocal cursorline
|
|
|
|
|
autocmd WinLeave * setlocal nocursorline
|
|
|
|
|
augroup END
|
|
|
|
|
endif
|
|
|
|
|
|
|
|
|
|
" when entering insert mode, relative line
|
|
|
|
|
" numbers are turned off, leaving absolute line numbers turned on
|
|
|
|
|
augroup numbertoggle
|
|
|
|
|
autocmd!
|
|
|
|
|
autocmd BufEnter,FocusGained,InsertLeave * set number relativenumber
|
|
|
|
|
autocmd BufLeave,FocusLost,InsertEnter * set number norelativenumber
|
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
|
|
hi clear CursorLine
|
|
|
|
|
augroup CLClear
|
|
|
|
|
autocmd! ColorScheme * hi clear CursorLine
|
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
|
|
hi CursorLineNR cterm=bold
|
|
|
|
|
augroup CLNRSet
|
|
|
|
|
set cursorline
|
|
|
|
|
autocmd! ColorScheme * hi CursorLineNR cterm=bold
|
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
|
|
" define indent-based folding, after loading a file switch to manual folding
|
|
|
|
|
augroup vimrc
|
2021-05-03 02:05:15 +02:00
|
|
|
|
autocmd!
|
2019-12-10 01:05:57 +01:00
|
|
|
|
au BufReadPre * setlocal foldmethod=indent
|
|
|
|
|
au BufWinEnter * if &fdm == 'indent' | setlocal foldmethod=manual | endif
|
|
|
|
|
augroup END
|
|
|
|
|
|
2019-12-12 17:07:26 +01:00
|
|
|
|
""" autosave and load views
|
2019-12-16 00:53:36 +01:00
|
|
|
|
au BufWinLeave ?* mkview
|
|
|
|
|
au BufWinEnter ?* silent loadview
|
2019-12-10 01:05:57 +01:00
|
|
|
|
|
2020-05-27 10:25:31 +02:00
|
|
|
|
au FileType xml setlocal shiftwidth=4 tabstop=4
|
|
|
|
|
au FileType html setlocal shiftwidth=4 tabstop=4
|
2020-02-28 02:06:26 +01:00
|
|
|
|
|
|
|
|
|
au BufNewFile,BufRead *.js
|
2020-05-27 10:25:31 +02:00
|
|
|
|
\ setlocal shiftwidth=4 tabstop=4 softtabstop=4 expandtab autoindent fileformat=unix
|
2019-12-10 01:05:57 +01:00
|
|
|
|
|
2021-05-03 04:41:52 +02:00
|
|
|
|
au FileType sway setl textwidth=79
|
|
|
|
|
\ tabstop=8 shiftwidth=8 softtabstop=8 noexpandtab autoindent
|
|
|
|
|
|
2021-11-10 01:15:26 +01:00
|
|
|
|
au FileType rust setl
|
|
|
|
|
\ tabstop=8 shiftwidth=8 softtabstop=8 noexpandtab autoindent ff=unix
|
|
|
|
|
|
2019-12-10 01:05:57 +01:00
|
|
|
|
au BufNewFile,BufRead *.py,*.pyw,*.pyx,?akefil*
|
|
|
|
|
\ setlocal tabstop=4 shiftwidth=4 noexpandtab autoindent
|
2020-05-27 10:25:31 +02:00
|
|
|
|
\ fileformat=unix
|
2021-05-03 04:41:52 +02:00
|
|
|
|
|
|
|
|
|
au FileType c setl ofu=ccomplete#CompleteCpp
|
|
|
|
|
|
2019-12-10 01:05:57 +01:00
|
|
|
|
" Linux kernel style tabs
|
2021-05-03 02:05:15 +02:00
|
|
|
|
au BufNewFile,BufRead,BufEnter *.c,*.h,*.cpp
|
2019-12-10 01:05:57 +01:00
|
|
|
|
\ setlocal tabstop=8 shiftwidth=8 softtabstop=8 noexpandtab autoindent
|
|
|
|
|
\ textwidth=79 fileformat=unix
|
|
|
|
|
|
2021-05-03 02:05:15 +02:00
|
|
|
|
au BufNewFile,BufRead,BufEnter *.tex
|
2021-02-04 22:38:07 +01:00
|
|
|
|
\ setlocal tabstop=2 shiftwidth=2 softtabstop=2 expandtab autoindent
|
|
|
|
|
\ textwidth=79 fileformat=unix conceallevel=0
|
|
|
|
|
|
2021-05-20 20:35:13 +02:00
|
|
|
|
au BufNewFile,BufRead,BufEnter *.bib
|
|
|
|
|
\ setlocal ft=bib tabstop=2 shiftwidth=2 softtabstop=2 noexpandtab autoindent
|
|
|
|
|
\ fileformat=unix conceallevel=0
|
|
|
|
|
|
2021-05-03 02:05:15 +02:00
|
|
|
|
au BufNewFile,BufRead,BufEnter *.cs
|
|
|
|
|
\ setlocal ft=cs tabstop=4 shiftwidth=4 softtabstop=4 noexpandtab autoindent
|
2021-05-03 04:41:52 +02:00
|
|
|
|
\ textwidth=79 fileformat=unix conceallevel=0
|
2021-05-03 02:05:15 +02:00
|
|
|
|
|
|
|
|
|
au BufNewFile,BufRead *.cshtml
|
|
|
|
|
\ setlocal ft=csh tabstop=4 shiftwidth=4 softtabstop=4 noexpandtab autoindent
|
2021-05-03 04:41:52 +02:00
|
|
|
|
\ textwidth=79 fileformat=unix conceallevel=0
|
2021-05-03 02:05:15 +02:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
augroup async_plug_load
|
|
|
|
|
autocmd!
|
2021-05-29 21:21:59 +02:00
|
|
|
|
" these plugins take the longest to load, let's do it in a semi-non-blocking
|
2021-05-03 02:05:15 +02:00
|
|
|
|
" fashion
|
2021-05-29 21:21:59 +02:00
|
|
|
|
autocmd CursorHold,CursorHoldI * call plug#load('syntastic', 'vim-clang', 'vim-speeddating', 'ctrlp.vim')
|
2021-05-03 02:05:15 +02:00
|
|
|
|
\| autocmd! async_plug_load
|
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
augroup omnisharp_commands
|
|
|
|
|
autocmd!
|
|
|
|
|
|
|
|
|
|
" Show type information automatically when the cursor stops moving.
|
|
|
|
|
" Note that the type is echoed to the Vim command line, and will overwrite
|
|
|
|
|
" any other messages in this space including e.g. ALE linting messages.
|
|
|
|
|
autocmd CursorHold *.cs OmniSharpTypeLookup
|
|
|
|
|
|
|
|
|
|
" The following commands are contextual, based on the cursor position.
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> gd <Plug>(omnisharp_go_to_definition)
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>osfu <Plug>(omnisharp_find_usages)
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>osfi <Plug>(omnisharp_find_implementations)
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>ospd <Plug>(omnisharp_preview_definition)
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>ospi <Plug>(omnisharp_preview_implementations)
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>ost <Plug>(omnisharp_type_lookup)
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>osd <Plug>(omnisharp_documentation)
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>osfs <Plug>(omnisharp_find_symbol)
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>osfx <Plug>(omnisharp_fix_usings)
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <C-\> <Plug>(omnisharp_signature_help)
|
|
|
|
|
autocmd FileType cs imap <silent> <buffer> <C-\> <Plug>(omnisharp_signature_help)
|
|
|
|
|
|
|
|
|
|
" Navigate up and down by method/property/field
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> [[ <Plug>(omnisharp_navigate_up)
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> ]] <Plug>(omnisharp_navigate_down)
|
|
|
|
|
" Find all code errors/warnings for the current solution and populate the quickfix window
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>osgcc <Plug>(omnisharp_global_code_check)
|
|
|
|
|
" Contextual code actions (uses fzf, vim-clap, CtrlP or unite.vim selector when available)
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>osca <Plug>(omnisharp_code_actions)
|
|
|
|
|
autocmd FileType cs xmap <silent> <buffer> <Leader>osca <Plug>(omnisharp_code_actions)
|
|
|
|
|
" Repeat the last code action performed (does not use a selector)
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>os. <Plug>(omnisharp_code_action_repeat)
|
|
|
|
|
autocmd FileType cs xmap <silent> <buffer> <Leader>os. <Plug>(omnisharp_code_action_repeat)
|
|
|
|
|
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>os= <Plug>(omnisharp_code_format)
|
|
|
|
|
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>osnm <Plug>(omnisharp_rename)
|
|
|
|
|
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>osre <Plug>(omnisharp_restart_server)
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>osst <Plug>(omnisharp_start_server)
|
|
|
|
|
autocmd FileType cs nmap <silent> <buffer> <Leader>ossp <Plug>(omnisharp_stop_server)
|
|
|
|
|
augroup END
|
|
|
|
|
|
|
|
|
|
|
2019-12-10 01:05:57 +01:00
|
|
|
|
" ------ adv maps ------
|
|
|
|
|
|
|
|
|
|
" strip trailing whitespace, ss (strip space)
|
|
|
|
|
nnoremap <silent> <Leader>ss
|
|
|
|
|
\ :let b:_p = getpos(".") <Bar>
|
|
|
|
|
\ let b:_s = (@/ != '') ? @/ : '' <Bar>
|
|
|
|
|
\ %s/\s\+$//e <Bar>
|
|
|
|
|
\ let @/ = b:_s <Bar>
|
|
|
|
|
\ nohlsearch <Bar>
|
|
|
|
|
\ unlet b:_s <Bar>
|
|
|
|
|
\ call setpos('.', b:_p) <Bar>
|
|
|
|
|
\ unlet b:_p <CR>
|
|
|
|
|
|
2019-12-16 00:53:36 +01:00
|
|
|
|
match Todo /\s\+$/
|
|
|
|
|
|
2019-12-10 01:05:57 +01:00
|
|
|
|
|
2019-05-21 03:23:09 +02:00
|
|
|
|
set softtabstop=4
|
|
|
|
|
set tabstop=4
|
|
|
|
|
set shiftwidth=4
|
2019-04-12 19:04:50 +02:00
|
|
|
|
set expandtab
|
|
|
|
|
set smarttab
|
|
|
|
|
|
|
|
|
|
set errorformat+=%.%#PHP:\ %m\ \(in\ %f\ on\ line\ %l\)%.%#,
|
|
|
|
|
\%E%[0-9]%#.%m:%f?rev=%.%##L%l\ %.%#,%C%.%#
|
|
|
|
|
|
|
|
|
|
|
2020-02-28 02:06:26 +01:00
|
|
|
|
set tags=.tags;
|
2019-04-12 19:04:50 +02:00
|
|
|
|
|
|
|
|
|
set incsearch " incrimental search
|
|
|
|
|
set hlsearch " highlighting when searching
|
|
|
|
|
|
|
|
|
|
set autoindent
|
|
|
|
|
set backspace=2
|
|
|
|
|
|
2020-03-25 03:59:42 +01:00
|
|
|
|
set splitbelow splitright " splits open at bottom and right
|
|
|
|
|
set lazyredraw " don't redraw while executing macros (good performance config)
|
2021-11-10 01:19:45 +01:00
|
|
|
|
set ttyfast
|
2020-03-25 03:59:42 +01:00
|
|
|
|
|
2020-02-28 02:06:26 +01:00
|
|
|
|
set listchars=trail:•,tab:>-
|
2019-12-16 00:53:36 +01:00
|
|
|
|
set list " show/hide tabs and EOL chars (hidden characters)
|
|
|
|
|
set confirm " ask confirmation like save before quit.
|
|
|
|
|
set wildmenu " Tab completion menu when using command mode
|
2020-10-05 18:32:34 +02:00
|
|
|
|
set wildmode=longest:longest,full
|
2020-05-27 10:25:31 +02:00
|
|
|
|
set scrolloff=5 " scroll offset, min lines above/below cursor
|
2019-05-02 01:13:32 +02:00
|
|
|
|
"set scrolljump=5 " jump 5 lines when running out of the screen - NO
|
2019-05-15 03:29:22 +02:00
|
|
|
|
set sidescroll=10 " minimum columns to scroll horizontally
|
2019-04-12 19:04:50 +02:00
|
|
|
|
set showcmd " show command status
|
2019-05-15 03:29:22 +02:00
|
|
|
|
set showmatch " flashes matching parenthese when cursor over the other one
|
2020-03-25 03:59:42 +01:00
|
|
|
|
set mat=2 " how many tenths of a second to blink when matching brackets
|
2019-12-16 00:53:36 +01:00
|
|
|
|
set noshowmode " show editing mode in status (-- INSERT --)
|
2019-04-12 19:04:50 +02:00
|
|
|
|
set ruler " show cursor position
|
2021-11-10 01:21:07 +01:00
|
|
|
|
set colorcolumn=80 " Highlight column 80 to get coding horizontal bound.
|
2020-05-27 10:25:31 +02:00
|
|
|
|
set noerrorbells " bells in vim
|
2019-04-12 19:04:50 +02:00
|
|
|
|
set undolevels=1000 " number of undos stored
|
|
|
|
|
set viminfo='50,"50 " '=marks for x files, "=registers for x files
|
|
|
|
|
|
2019-11-19 01:07:36 +01:00
|
|
|
|
set nofoldenable
|
2019-05-29 00:46:44 +02:00
|
|
|
|
"set foldmethod=indent " indent based folding
|
|
|
|
|
|
2019-05-02 01:13:32 +02:00
|
|
|
|
set encoding=utf-8 " important for powerline besides others
|
2020-02-28 02:06:26 +01:00
|
|
|
|
set ignorecase " searches are case insensitive...
|
|
|
|
|
set smartcase " ... unless they contain at least one capital letter
|
2019-12-12 17:07:26 +01:00
|
|
|
|
set noscrollbind
|
2021-09-01 16:42:29 +02:00
|
|
|
|
set updatetime=250
|
2019-04-12 20:35:24 +02:00
|
|
|
|
|
2021-05-29 21:18:05 +02:00
|
|
|
|
" no background from colorscheme as it messes with background transparency in kitty
|
|
|
|
|
autocmd ColorScheme * highlight Normal ctermbg=NONE guibg=NONE
|
|
|
|
|
set termguicolors
|
2021-05-03 02:05:15 +02:00
|
|
|
|
colo space_vim_theme " new fav highlighting
|
|
|
|
|
" compensate for lack of theme italics
|
|
|
|
|
for s in ["Comment", "Constant", "Include", "Define", "Macro", "Delimiter", "Debug", "Identifier", "Boolean", "markdownItalic"]
|
|
|
|
|
execute "hi " s " cterm=italic"
|
|
|
|
|
endfor
|
2021-05-29 21:22:54 +02:00
|
|
|
|
|
|
|
|
|
" vimtex highlight groups
|
|
|
|
|
hi! link texMathEnvArgName texEnvArgName
|
|
|
|
|
hi! link texMathZone LocalIdent
|
|
|
|
|
hi! link texMathZoneEnv texMathZone
|
|
|
|
|
hi! link texMathZoneEnvStarred texMathZone
|
|
|
|
|
hi! link texMathZoneX texMathZone
|
|
|
|
|
hi! link texMathZoneXX texMathZone
|
|
|
|
|
hi! link texMathZoneEnsured texMathZone
|
|
|
|
|
|
2020-05-27 10:25:31 +02:00
|
|
|
|
set conceallevel=0 " for jsons
|
2020-10-05 18:32:34 +02:00
|
|
|
|
set ttymouse=sgr " tmux mouse behaviour
|
2020-04-27 22:42:42 +02:00
|
|
|
|
set mouse=a " enable mouse in n,v,i,c,h modes
|
2019-05-15 03:29:22 +02:00
|
|
|
|
|
2021-05-03 02:05:15 +02:00
|
|
|
|
set laststatus=2 " show powerline status bar
|
2019-04-29 00:42:36 +02:00
|
|
|
|
set t_Co=256
|
2021-03-15 14:18:07 +01:00
|
|
|
|
set gfn=Fira\ Code\ weight=450\ 12
|
2021-05-03 02:05:15 +02:00
|
|
|
|
|
|
|
|
|
set ballooneval " vim8+ popups
|
|
|
|
|
let g:netrw_beval = 1
|
2021-11-10 01:22:18 +01:00
|
|
|
|
set t_vb=
|
2021-11-10 01:19:45 +01:00
|
|
|
|
|
2021-11-10 01:21:07 +01:00
|
|
|
|
highlight ColorColumn guibg=Black
|
|
|
|
|
highlight ColorColumn ctermbg=0
|
|
|
|
|
|
2021-11-10 01:19:45 +01:00
|
|
|
|
" cursorline optimizations
|
|
|
|
|
set cursorlineopt=number
|
|
|
|
|
syntax sync minlines=256
|
2021-11-10 01:23:37 +01:00
|
|
|
|
|
|
|
|
|
nnoremap <Leader>ve :e $MYVIMRC<CR>
|
|
|
|
|
nnoremap <Leader>vr :source $MYVIMRC<CR>
|