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
|
|
|
|
2020-02-28 02:06:26 +01:00
|
|
|
filetype plugin on " required
|
2019-04-12 19:04:50 +02:00
|
|
|
|
2019-12-12 17:07:26 +01:00
|
|
|
inoremap <expr><TAB> pumvisible() ? "\<C-n>" : "\<TAB>"
|
2019-04-12 19:04:50 +02:00
|
|
|
|
|
|
|
" Enable omni completion.
|
|
|
|
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
|
|
|
|
|
|
|
|
" 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
|
|
|
|
|
|
|
|
call plug#begin()
|
|
|
|
Plug 'drewtempelmeyer/palenight.vim'
|
2020-02-28 02:06:26 +01:00
|
|
|
Plug 'jacoborus/tender.vim'
|
2020-03-25 03:59:42 +01:00
|
|
|
Plug 'dracula/vim', { 'as': 'dracula' }
|
2020-04-27 22:42:42 +02:00
|
|
|
Plug 'jaredgorski/SpaceCamp', { 'as': 'spacecamp' }
|
2019-12-16 00:53:36 +01:00
|
|
|
Plug 'lervag/vimtex', { 'for': 'tex' }
|
|
|
|
Plug 'xuhdev/vim-latex-live-preview', { 'for': 'tex' }
|
2020-02-28 02:06:26 +01:00
|
|
|
Plug 'vim-airline/vim-airline'
|
|
|
|
Plug 'vim-airline/vim-airline-themes'
|
|
|
|
Plug 'ctrlpvim/ctrlp.vim'
|
2020-03-25 03:59:42 +01:00
|
|
|
Plug 'junegunn/fzf.vim'
|
|
|
|
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
|
|
|
Plug 'justmao945/vim-clang'
|
2020-02-28 02:06:26 +01:00
|
|
|
Plug 'tpope/vim-surround'
|
|
|
|
Plug 'tpope/vim-fugitive'
|
|
|
|
Plug 'tpope/vim-repeat'
|
2020-03-25 03:59:42 +01:00
|
|
|
Plug 'gorodinskiy/vim-coloresque'
|
2020-04-27 22:42:42 +02:00
|
|
|
Plug 'rhysd/git-messenger.vim'
|
2020-02-28 02:06:26 +01:00
|
|
|
Plug 'Yggdroot/indentLine'
|
|
|
|
Plug 'cespare/vim-toml'
|
|
|
|
Plug 'preservim/nerdcommenter'
|
|
|
|
Plug 'preservim/nerdtree'
|
|
|
|
Plug 'Xuyuanp/nerdtree-git-plugin'
|
2020-03-18 04:40:11 +01:00
|
|
|
Plug 'mfukar/robotframework-vim'
|
2019-12-12 17:07:26 +01:00
|
|
|
Plug 'roxma/nvim-yarp'
|
|
|
|
Plug 'roxma/vim-hug-neovim-rpc'
|
|
|
|
Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
2020-02-28 02:06:26 +01:00
|
|
|
Plug 'vim-syntastic/syntastic'
|
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:Powerline_symbols = "fancy" " sth like this probably set as a default but won't hurt here
|
|
|
|
let g:airline_highlighting_cache = 1
|
2020-03-18 04:40:11 +01:00
|
|
|
let g:airline_section_z = airline#section#create(['windowswap', '%3p%% ', 'linenr', ' :%3v'])
|
2020-04-27 22:42:42 +02:00
|
|
|
" let g:airline_theme = 'dracula'
|
2020-03-18 04:40:11 +01:00
|
|
|
let g:airline#extensions#tabline#enabled = 1
|
|
|
|
let g:airline#extensions#tabline#formatter = 'unique_tail'
|
2019-12-16 00:53:36 +01:00
|
|
|
|
|
|
|
let g:NERDTreeDirArrowExpandable = '▸'
|
|
|
|
let g:NERDTreeDirArrowCollapsible = '▾'
|
|
|
|
|
2019-12-12 17:07:26 +01:00
|
|
|
let g:gitgutter_terminal_reports_focus=0
|
2020-04-27 22:42:42 +02:00
|
|
|
let g:gitgutter_async = 1
|
2019-12-16 00:53:36 +01:00
|
|
|
let g:gitgutter_sign_allow_clobber=0
|
2019-12-12 17:07:26 +01:00
|
|
|
|
2020-03-24 04:41:53 +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-04-06 04:57:42 +02:00
|
|
|
let g:livepreview_previewer = 'xreader'
|
2020-03-24 04:41:53 +01:00
|
|
|
let g:livepreview_engine = 'pdflatex'
|
|
|
|
let g:vimtex_compiler_progname = 'pdflatex'
|
|
|
|
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
|
|
|
|
let g:NERDCustomDelimiters = { 'vim': { 'left': '"','right': '' }, 'c': { 'left': '/**','right': '*/' } }
|
|
|
|
|
|
|
|
"let g:indentLine_setColors = 0
|
|
|
|
let g:indentLine_char_list = ['|', '¦', '┆', '┊', ':']
|
|
|
|
|
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-02-28 02:06:26 +01:00
|
|
|
let g:syntastic_always_populate_loc_list = 0
|
|
|
|
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#
|
|
|
|
set statusline+=%{SyntasticStatuslineFlag()}
|
|
|
|
set statusline+=%*
|
|
|
|
|
|
|
|
let g:syntastic_javascript_checkers = ['jsl']
|
|
|
|
let g:syntastic_python_checkers = ['pylint']
|
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
|
|
|
|
let g:syntastic_c_cpplint_exec = 'cppcheck'
|
|
|
|
|
2019-12-10 01:05:57 +01:00
|
|
|
" change cursor shape for different editing modes, neovim does this by default
|
|
|
|
if !has('nvim')
|
|
|
|
if exists('$TMUX')
|
2020-02-28 02:06:26 +01:00
|
|
|
let &t_SI = "\<Esc>Ptmux;\<Esc>\e[2 q\<Esc>\\"
|
2019-12-10 01:05:57 +01:00
|
|
|
let &t_SR = "\<Esc>Ptmux;\<Esc>\e[4 q\<Esc>\\"
|
|
|
|
let &t_EI = "\<Esc>Ptmux;\<Esc>\e[2 q\<Esc>\\"
|
|
|
|
else
|
|
|
|
let &t_SI = "\e[6 q"
|
|
|
|
let &t_SR = "\e[4 q"
|
|
|
|
let &t_EI = "\e[2 q"
|
|
|
|
endif
|
|
|
|
endif
|
|
|
|
|
|
|
|
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>
|
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
|
|
|
|
nnoremap <F4> :make!<cr>
|
|
|
|
" 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>
|
|
|
|
nmap gb :!git blame %<CR>
|
2019-12-10 01:05:57 +01:00
|
|
|
|
2020-04-27 22:42:42 +02:00
|
|
|
|
|
|
|
" ------ wayland copy
|
|
|
|
xnoremap "+y y:call system("wl-copy", @")<cr>
|
|
|
|
nnoremap "+p :let @"=substitute(system("wl-paste --no-newline"), '<C-v><C-m>', '', 'g')<cr>p
|
|
|
|
nnoremap "*p :let @"=substitute(system("wl-paste --no-newline --primary"), '<C-v><C-m>', '', 'g')<cr>p
|
|
|
|
|
|
|
|
|
2019-12-10 01:05:57 +01:00
|
|
|
" ------ autocmd ------
|
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
|
|
|
|
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
|
|
|
|
|
|
|
au FileType xml setlocal shiftwidth=2 tabstop=2
|
2020-02-28 02:06:26 +01:00
|
|
|
au FileType html setlocal shiftwidth=2 tabstop=2
|
|
|
|
|
|
|
|
au BufNewFile,BufRead *.js
|
|
|
|
\ setlocal shiftwidth=2 tabstop=2 softtabstop=2 expandtab autoindent fileformat=unix
|
2019-12-10 01:05:57 +01:00
|
|
|
|
|
|
|
au FileType c setl ofu=ccomplete#CompleteCpp
|
|
|
|
au BufNewFile,BufRead *.py,*.pyw,*.pyx,?akefil*
|
|
|
|
\ setlocal tabstop=4 shiftwidth=4 noexpandtab autoindent
|
|
|
|
\ textwidth=79 fileformat=unix
|
|
|
|
" Linux kernel style tabs
|
|
|
|
au BufNewFile,BufRead *.c,*.h,*.cpp
|
|
|
|
\ setlocal tabstop=8 shiftwidth=8 softtabstop=8 noexpandtab autoindent
|
|
|
|
\ textwidth=79 fileformat=unix
|
|
|
|
|
|
|
|
" ------ 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%.%#
|
|
|
|
|
|
|
|
autocmd BufNewFile,BufRead svn-commit.*tmp :0r $SVN_COMMIT_TEMPLATE
|
|
|
|
|
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
|
|
|
|
|
2020-02-28 02:06:26 +01:00
|
|
|
filetype indent plugin on
|
2019-04-12 19:04:50 +02:00
|
|
|
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)
|
|
|
|
|
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-03-25 03:59:42 +01:00
|
|
|
set scrolloff=3 " 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
|
2019-05-15 03:29:22 +02:00
|
|
|
set errorbells " bells in terminal
|
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
|
2019-12-16 00:53:36 +01:00
|
|
|
set updatetime=1000
|
2019-04-12 20:35:24 +02:00
|
|
|
|
2019-12-16 00:53:36 +01:00
|
|
|
syntax enable
|
2020-04-29 15:12:42 +02:00
|
|
|
colo palenight " new fav highlighting
|
2020-04-27 22:42:42 +02:00
|
|
|
set mouse=a " enable mouse in n,v,i,c,h modes
|
|
|
|
set ttymouse=sgr
|
2019-05-15 03:29:22 +02:00
|
|
|
|
2019-11-19 01:07:36 +01:00
|
|
|
set laststatus=2 " show powerline status bar
|
2019-04-29 00:42:36 +02:00
|
|
|
set t_Co=256
|