|
let $vundle="~/AppData/Local/nvim/bundle/Vundle.vim" |
|
|
|
" Be iMproved |
|
set nocompatible |
|
|
|
"===================================================== |
|
"" Vundle settings |
|
"===================================================== |
|
filetype off |
|
set rtp+=$vundle |
|
call vundle#begin() |
|
|
|
Plugin 'VundleVim/Vundle.vim' " let Vundle manage Vundle, required |
|
|
|
"-------------------=== Code/Project navigation ===------------- |
|
Plugin 'scrooloose/nerdtree' " Project and file navigation |
|
Plugin 'jistr/vim-nerdtree-tabs' |
|
Plugin 'majutsushi/tagbar' " Class/module browser |
|
Plugin 'ctrlpvim/ctrlp.vim' " Fast transitions on project files |
|
|
|
"-------------------=== Other ===------------------------------- |
|
Plugin 'bling/vim-airline' " Lean & mean status/tabline for vim |
|
Plugin 'vim-airline/vim-airline-themes' " Themes for airline |
|
Plugin 'powerline/powerline' " Powerline fonts plugin |
|
Plugin 'fisadev/FixedTaskList.vim' " Pending tasks list |
|
Plugin 'rosenfeld/conque-term' " Consoles as buffers |
|
Plugin 'tpope/vim-surround' " Parentheses, brackets, quotes, XML tags, and more |
|
Plugin 'flazz/vim-colorschemes' " Colorschemes |
|
Plugin 'airblade/vim-gitgutter.git' " Git support |
|
Plugin 'rafi/awesome-vim-colorschemes.git' " Awesome Vim color schemes |
|
|
|
"-------------------=== Snippets support ===-------------------- |
|
Plugin 'garbas/vim-snipmate' " Snippets manager |
|
Plugin 'MarcWeber/vim-addon-mw-utils' " dependencies #1 |
|
Plugin 'tomtom/tlib_vim' " dependencies #2 |
|
Plugin 'honza/vim-snippets' " snippets repo |
|
|
|
"-------------------=== Languages support ===------------------- |
|
Plugin 'tpope/vim-commentary' " Comment stuff out |
|
Plugin 'mitsuhiko/vim-sparkup' " Sparkup(XML/jinja/htlm-django/etc.) support |
|
Plugin 'Rykka/riv.vim' " ReStructuredText plugin |
|
Plugin 'Valloric/YouCompleteMe' " Autocomplete plugin |
|
Plugin 'jiangmiao/auto-pairs.git' " Braces magic |
|
|
|
"-------------------=== Python ===----------------------------- |
|
Plugin 'klen/python-mode' " Python mode (docs, refactor, lints...) |
|
Plugin 'scrooloose/syntastic' " Syntax checking plugin for Vim |
|
Plugin 'ambv/black' " Format python with black |
|
|
|
call vundle#end() " required |
|
filetype on |
|
filetype plugin on |
|
filetype plugin indent on |
|
|
|
"===================================================== |
|
"" General settings |
|
"===================================================== |
|
syntax enable " syntax highlight |
|
|
|
set t_Co=256 " set 256 colors |
|
"colorscheme wombat256mod " set color scheme |
|
colorscheme onedark " set color scheme |
|
|
|
set number " show line numbers |
|
set ruler |
|
set ttyfast " terminal acceleration |
|
set relativenumber " toggle on relative numbers |
|
|
|
set tabstop=4 " 4 whitespaces for tabs visual presentation |
|
set shiftwidth=4 " shift lines by 4 spaces |
|
set smarttab " set tabs for a shifttabs logic |
|
set expandtab " expand tabs into spaces |
|
set autoindent " indent when moving to the next line while writing code |
|
set si " smart indent |
|
|
|
set cursorline " shows line under the cursor's line |
|
set showmatch " shows matching part of bracket pairs (), [], {} |
|
|
|
set enc=utf-8 " utf-8 by default |
|
|
|
set autoread " auto read when a file is changed from the outside |
|
set nobackup " no backup files |
|
set nowritebackup " only in case you don't want a backup file while editing |
|
set noswapfile " no swap files |
|
set updatetime=500 " wait 0.5 sec after stoping typing to trigger plugins |
|
|
|
set backspace=indent,eol,start " backspace removes all (indents, EOLs, start) What is start? |
|
|
|
set scrolloff=10 " let 10 lines before/after cursor during scroll |
|
|
|
set clipboard=unnamed " use system clipboard |
|
|
|
set exrc " enable usage of additional .vimrc files from working directory |
|
set secure " prohibit .vimrc files to execute shell, create files, etc... |
|
|
|
set cmdheight=2 |
|
|
|
" A buffer becomes hidden when it is abandoned |
|
set hid |
|
|
|
" Highlight search results |
|
set hlsearch |
|
|
|
" <Ctrl-l> redraws the screen and removes any search highlighting. |
|
nnoremap <silent> <C-l> :nohl<CR><C-l> |
|
|
|
" Makes search act like search in modern browsers |
|
set incsearch |
|
|
|
" No annoying sound on errors |
|
set noerrorbells |
|
set novisualbell |
|
set t_vb= |
|
set tm=500 |
|
|
|
" Add a bit extra margin to the left |
|
set foldcolumn=1 |
|
|
|
" Configure backspace so it acts as it should act |
|
set backspace=eol,start,indent |
|
set whichwrap+=<,>,h,l |
|
|
|
let mapleader = "," |
|
|
|
" Additional mappings for Esc (useful for MacBook with touch bar) |
|
"inoremap jj <Esc> |
|
"inoremap jk <Esc> |
|
|
|
"""""""""""""""""""""""""""""" |
|
" => Visual mode related |
|
"""""""""""""""""""""""""""""" |
|
" Visual mode pressing * or # searches for the current selection |
|
" Super useful! From an idea by Michael Naumann |
|
vnoremap <silent> * :<C-u>call VisualSelection('', '')<CR>/<C-R>=@/<CR><CR> |
|
vnoremap <silent> # :<C-u>call VisualSelection('', '')<CR>?<C-R>=@/<CR><CR> |
|
|
|
"===================================================== |
|
"" Moving around, tabs, windows and buffers |
|
"===================================================== |
|
|
|
" Smart way to move between windows |
|
map <C-j> <C-W>j |
|
map <C-k> <C-W>k |
|
map <C-h> <C-W>h |
|
map <C-l> <C-W>l |
|
|
|
" Close the current buffer |
|
map <leader>bd :Bclose<cr>:tabclose<cr>gT |
|
|
|
" Close all the buffers |
|
map <leader>ba :bufdo bd<cr> |
|
|
|
map <leader>l :bnext<cr> |
|
map <leader>h :bprevious<cr> |
|
|
|
" Useful mappings for managing tabs |
|
map <leader>tn :tabnew<cr> |
|
map <leader>to :tabonly<cr> |
|
map <leader>tc :tabclose<cr> |
|
map <leader>tm :tabmove |
|
map <leader>t<leader> :tabnext |
|
|
|
" Let 'tl' toggle between this and the last accessed tab |
|
let g:lasttab = 1 |
|
nmap <Leader>tl :exe "tabn ".g:lasttab<CR> |
|
au TabLeave * let g:lasttab = tabpagenr() |
|
|
|
" Opens a new tab with the current buffer's path |
|
" Super useful when editing files in the same directory |
|
map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/ |
|
|
|
" Switch CWD to the directory of the open buffer |
|
map <leader>cd :cd %:p:h<cr>:pwd<cr> |
|
|
|
" Specify the behavior when switching between buffers |
|
try |
|
set switchbuf=useopen,usetab,newtab |
|
set stal=2 |
|
catch |
|
endtry |
|
|
|
" Return to last edit position when opening files (You want this!) |
|
au BufReadPost * if line("'\"") > 1 && line("'\"") <= line("$") | exe "normal! g'\"" | endif |
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
" => Bracket, parenthesis and comments related |
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
" Stop from repeating comments |
|
set formatoptions-=r |
|
set formatoptions-=o |
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
" => Editing mappings |
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
" Remap VIM 0 to first non-blank character |
|
map 0 ^ |
|
|
|
" Move a line of text using ALT+[jk] or Command+[jk] on mac |
|
nmap <M-j> mz:m+<cr>`z |
|
nmap <M-k> mz:m-2<cr>`z |
|
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z |
|
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z |
|
|
|
" Delete trailing white space on save, useful for some filetypes ;) |
|
fun! CleanExtraSpaces() |
|
let save_cursor = getpos(".") |
|
let old_query = getreg('/') |
|
silent! %s/\s\+$//e |
|
call setpos('.', save_cursor) |
|
call setreg('/', old_query) |
|
endfun |
|
|
|
if has("autocmd") |
|
autocmd BufWritePre *.txt,*.js,*.py,*.wiki,*.sh,*.coffee :call CleanExtraSpaces() |
|
endif |
|
|
|
"===================================================== |
|
"" Tabs / Buffers settings |
|
"===================================================== |
|
tab sball |
|
set switchbuf=useopen |
|
set laststatus=2 |
|
nmap <F9> :bprev<CR> |
|
nmap <F10> :bnext<CR> |
|
nmap <silent> <leader>q :SyntasticCheck # <CR> :bp <BAR> bd #<CR> |
|
|
|
"" Search settings |
|
"===================================================== |
|
set incsearch " incremental search |
|
set hlsearch " highlight search results |
|
|
|
"===================================================== |
|
"" AirLine settings |
|
"===================================================== |
|
let g:airline_theme='badwolf' |
|
let g:airline#extensions#tabline#enabled=1 |
|
let g:airline#extensions#tabline#formatter='unique_tail' |
|
let g:airline_powerline_fonts=1 |
|
|
|
"===================================================== |
|
"" TagBar settings |
|
"===================================================== |
|
let g:tagbar_autofocus=0 |
|
" let g:tagbar_width=42 |
|
autocmd BufEnter *.py :call tagbar#autoopen(0) |
|
autocmd BufWinLeave *.py :TagbarClose |
|
|
|
"===================================================== |
|
"" NERDTree settings |
|
"===================================================== |
|
let NERDTreeIgnore=['\.pyc$', '\.pyo$', '__pycache__$'] " Ignore files in NERDTree |
|
" let NERDTreeWinSize=40 |
|
autocmd VimEnter * if !argc() | NERDTree | endif " Load NERDTree only if vim is run without arguments |
|
nmap <F3> :NERDTreeToggle<CR> |
|
let g:nerdtree_tabs_open_on_console_startup=1 |
|
|
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
" => Helper functions |
|
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" |
|
" Returns true if paste mode is enabled |
|
function! HasPaste() |
|
if &paste |
|
return 'PASTE MODE ' |
|
endif |
|
return '' |
|
endfunction |
|
|
|
" Don't close window, when deleting a buffer |
|
command! Bclose call <SID>BufcloseCloseIt() |
|
function! <SID>BufcloseCloseIt() |
|
let l:currentBufNum = bufnr("%") |
|
let l:alternateBufNum = bufnr("#") |
|
|
|
if buflisted(l:alternateBufNum) |
|
buffer # |
|
else |
|
bnext |
|
endif |
|
|
|
if bufnr("%") == l:currentBufNum |
|
new |
|
endif |
|
|
|
if buflisted(l:currentBufNum) |
|
execute("bdelete! ".l:currentBufNum) |
|
endif |
|
endfunction |
|
|
|
function! CmdLine(str) |
|
call feedkeys(":" . a:str) |
|
endfunction |
|
|
|
function! VisualSelection(direction, extra_filter) range |
|
let l:saved_reg = @" |
|
execute "normal! vgvy" |
|
|
|
let l:pattern = escape(@", "\\/.*'$^~[]") |
|
let l:pattern = substitute(l:pattern, "\n$", "", "") |
|
|
|
if a:direction == 'gv' |
|
call CmdLine("Ack '" . l:pattern . "' " ) |
|
elseif a:direction == 'replace' |
|
call CmdLine("%s" . '/'. l:pattern . '/') |
|
endif |
|
|
|
let @/ = l:pattern |
|
let @" = l:saved_reg |
|
endfunction |
|
|
|
let $NVIM_TUI_ENABLE_CURSOR_SHAPE = 0 |
|
|
|
"===================================================== |
|
"" SnipMate settings |
|
"===================================================== |
|
let g:snippets_dir='~/.vim/vim-snippets/snippets' |
|
|
|
"===================================================== |
|
"" Riv.vim settings |
|
"===================================================== |
|
let g:riv_disable_folding=1 |
|
|
|
"===================================================== |
|
"" Python settings |
|
"===================================================== |
|
|
|
" python executables for different plugins |
|
let g:pymode_python='C:\Program Files (x86)\Python36-32\python' |
|
let g:syntastic_python_python_exec='C:\Program Files (x86)\Python36-32\python' |
|
|
|
" rope |
|
let g:pymode_rope=0 |
|
let g:pymode_rope_completion=0 |
|
let g:pymode_rope_complete_on_dot=0 |
|
let g:pymode_rope_auto_project=0 |
|
let g:pymode_rope_enable_autoimport=0 |
|
let g:pymode_rope_autoimport_generate=0 |
|
let g:pymode_rope_guess_project=0 |
|
|
|
" documentation |
|
let g:pymode_doc=0 |
|
let g:pymode_doc_bind='K' |
|
|
|
" lints |
|
let g:pymode_lint=0 |
|
|
|
" virtualenv |
|
let g:pymode_virtualenv=1 |
|
|
|
" breakpoints |
|
let g:pymode_breakpoint=1 |
|
let g:pymode_breakpoint_key='<leader>b' |
|
|
|
" syntax highlight |
|
let g:pymode_syntax=1 |
|
let g:pymode_syntax_slow_sync=1 |
|
let g:pymode_syntax_all=1 |
|
let g:pymode_syntax_print_as_function=g:pymode_syntax_all |
|
let g:pymode_syntax_highlight_async_await=g:pymode_syntax_all |
|
let g:pymode_syntax_highlight_equal_operator=g:pymode_syntax_all |
|
let g:pymode_syntax_highlight_stars_operator=g:pymode_syntax_all |
|
let g:pymode_syntax_highlight_self=g:pymode_syntax_all |
|
let g:pymode_syntax_indent_errors=g:pymode_syntax_all |
|
let g:pymode_syntax_string_formatting=g:pymode_syntax_all |
|
let g:pymode_syntax_space_errors=g:pymode_syntax_all |
|
let g:pymode_syntax_string_format=g:pymode_syntax_all |
|
let g:pymode_syntax_string_templates=g:pymode_syntax_all |
|
let g:pymode_syntax_doctests=g:pymode_syntax_all |
|
let g:pymode_syntax_builtin_objs=g:pymode_syntax_all |
|
let g:pymode_syntax_builtin_types=g:pymode_syntax_all |
|
let g:pymode_syntax_highlight_exceptions=g:pymode_syntax_all |
|
let g:pymode_syntax_docstrings=g:pymode_syntax_all |
|
|
|
" highlight 'long' lines (>= 80 symbols) in python files |
|
augroup vimrc_autocmds |
|
autocmd! |
|
autocmd FileType python,rst,c,cpp highlight Excess ctermbg=DarkGrey guibg=Black |
|
autocmd FileType python,rst,c,cpp match Excess /\%89v.*/ |
|
autocmd FileType python,rst,c,cpp set nowrap |
|
autocmd FileType python,rst,c,cpp set colorcolumn=88 |
|
augroup END |
|
|
|
" code folding |
|
let g:pymode_folding=1 |
|
|
|
" pep8 indents |
|
let g:pymode_indent=1 |
|
|
|
" code running |
|
let g:pymode_run=1 |
|
let g:pymode_run_bind='<F5>' |
|
|
|
" syntastic |
|
let g:syntastic_always_populate_loc_list=1 |
|
let g:syntastic_auto_loc_list=1 |
|
let g:syntastic_enable_signs=1 |
|
let g:syntastic_check_on_wq=0 |
|
let g:syntastic_aggregate_errors=1 |
|
let g:syntastic_loc_list_height=5 |
|
let g:syntastic_error_symbol='E' |
|
let g:syntastic_style_error_symbol='E' |
|
let g:syntastic_warning_symbol='W' |
|
let g:syntastic_style_warning_symbol='W' |
|
let g:syntastic_python_checkers=['flake8', 'pydocstyle', 'python'] |
|
let g:syntastic_python_checker_args = '--ignore=E501' |
|
|
|
" YouCompleteMe |
|
set completeopt-=preview |
|
|
|
let g:ycm_global_ycm_extra_conf='~/.vim/ycm_extra_conf.py' |
|
let g:ycm_confirm_extra_conf=0 |
|
|
|
nmap <leader>g :YcmCompleter GoTo<CR> |
|
nmap <leader>d :YcmCompleter GoToDefinition<CR> |
|
|
|
autocmd BufWritePre *.py execute ':Black' |