" nvim configuration ~~ rgoncalves.se " vim-plug autoinstall if empty(glob('~/.local/share/nvim/site/autoload/plug.vim')) silent !curl -fLo ~/.local/share/nvim/site/autoload/plug.vim --create-dirs \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim autocmd VimEnter * PlugInstall --sync | source $MYVIMRC endif " system agnostic detection let uname = system('uname')[:-2] " global configuration set encoding=utf-8 set laststatus=2 set scrolloff=3 set viminfo= set mouse=a set title set number set noswapfile set shell=/bin/sh set updatetime=2500 set synmaxcol=300 set lazyredraw set ttyfast set wildoptions= set autochdir let sh_minlines=100 let sh_maxlines=600 " filetypes and colorschemes syntax on filetype on filetype plugin on filetype indent on colorscheme base " keybindings noremap =j :%!python -m json.tool noremap =k :%s/-\|-/-+-/g noremap =l :%s/-+-/-\|-/g noremap :NERDTreeToggle noremap :GitGutterCustomToggle inoremap inoremap inoremap inoremap " keybindings - omnifunc inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? "\" : "\" inoremap pumvisible() ? '' : \ '=pumvisible() ? "\Down>" : ""' inoremap pumvisible() ? '' : \ '=pumvisible() ? "\Down>" : ""' inoremap (pumvisible() ? (col('.') > 1 ? 'i' : 'i') : '') . \ '=pumvisible() ? "\C-n>\C-p>\Down>" : ""' inoremap (pumvisible() ? (col('.') > 1 ? 'i' : 'i') : '') . \ '=pumvisible() ? "\C-n>\C-p>\Down>" : ""' let g:polyglot_disabled = ['autoindent', 'sensible'] " PLUGINS list if !empty(glob('~/.local/share/nvim/site/autoload/plug.vim')) call plug#begin('~/.nvim/plugged/') " core Plug 'scrooloose/nerdtree' " completion Plug 'w0rp/ale' " Plug 'davidhalter/jedi-vim' Plug 'maralla/completor.vim' " fzf Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } Plug 'junegunn/fzf.vim' " indent Plug 'nathanaelkane/vim-indent-guides' Plug 'editorconfig/editorconfig-vim' Plug 'pangloss/vim-javascript' Plug 'pearofducks/ansible-vim' Plug 'sheerun/vim-polyglot' Plug 'dbeniamine/vim-mail' Plug 'ap/vim-css-color' " notes Plug 'dhruvasagar/vim-table-mode' Plug 'jceb/vim-orgmode' " headers and source Plug 'vim-scripts/a.vim' Plug 'majutsushi/tagbar' " git Plug 'airblade/vim-gitgutter' Plug 'tpope/vim-fugitive' Plug 'jreybert/vimagit' Plug 'junegunn/gv.vim' " python Plug 'petobens/poet-v' call plug#end() endif " indentation set smarttab set autoindent set nocompatible set tabstop=8 set shiftwidth=8 set softtabstop=8 set noexpandtab set list lcs=tab:\|\ ". set fillchars+=vert:\ ". set ve+=onemore set list set shortmess=atToOF " plugins settings let g:ale_sign_error = '' let g:ale_sign_warning = '' let g:ale_c_clang_options='-std=gnu99 -Wall' let g:ale_c_gcc_options='-std=gnu99 -Wall' let g:ale_sh_shellcheck_options = '-e SC1090 SC2181 -e SC2155' let g:ale_python_flake8_options = '--ignore=E501' let g:ale_linters = { 'python': ['bandit', 'flake8'], } let g:gitgutter_max_signs = 500 let g:gitgutter_sign_added = '+' let g:gitgutter_sign_modified = '~' let g:gitgutter_sign_removed = '-' let g:gitgutter_sign_modified_removed = '-' let g:indent_guides_enable_on_vim_startup = 0 let g:indent_guides_auto_colors = 0 let g:indent_cuides_exclude_filetypes = [ \'help', \'terminal' \] let g:poetv_executables = ['poetry'] let g:poetv_auto_activate = 1 let g:python_host_prog = system('which python2')[:-2] let g:python3_host_prog = system('which python3')[:-2] let g:jedi#auto_initialization = 1 let g:jedi#popup_on_dot = 0 let g:NERDTreeAutoDeleteBuffer = 1 let g:NERDTreeMinimalUI = 1 let g:NERDTreeDirArrowExpandable = '+' let g:NERDTreeDirArrowCollapsible = '-' let g:EditorConfig_exclude_patterns = ['fugitive://.*', 'scp://.*'] let g:fzf_layout = { 'down': '40%'} let g:magit_default_fold_level = 2 let g:sql_type_default = 'pgsql' let g:table_mode_always_active = 0 if uname == 'OpenBSD' let g:ncm2_pyclang#library_path = '/usr/local/lib/libclang.so.8.1' let g:completor_python_binary = '/usr/bin/python3' endif " netrw let g:netrw_banner = 0 let g:netrw_browse_split = 4 let g:netrw_liststyle = 3 let g:netrw_altv = 1 let g:netrw_winsize = 25 let g:netrw_list_hide = '\(^\|\s\s\)\zs\.\S\+' autocmd BufNewFile,BufReadPost *.{yaml,yml} set filetype=yaml autocmd BufNewFile,BufReadPost */*ssh/config.d/* set syntax=sshconfig autocmd BufNewFile,BufReadPost */*ansible*/**/*.yml set filetype=yaml.ansible autocmd BufNewFile,BufRead ~/.config/i3/config set filetype=i3config autocmd BufNewFile,BufRead ~/.config/sway/config set filetype=i3config autocmd BufNewFile,BufRead ~/.config/polybar/config set filetype=dosini autocmd FileType conf let b:EditorConfig_disable = 1 autocmd FileType gitcommit let b:EditorConfig_disable = 1 autocmd FileType java setlocal omnifunc=javacomplete#Complete autocmd FileType yaml let b:EditorConfig_disable = 1 " statusline set statusline= set statusline+=\ %f set statusline+=%m set statusline+=%= set statusline+=\ %y set statusline+=\ %{&fileencoding?&fileencoding:&encoding} set statusline+=\ [%{&fileformat}\] set statusline+=\ %p%% set statusline+=\ %l:%c set statusline+=\ " completion set omnifunc=syntaxcomplete#Complete set completeopt=longest,menuone " commands command! PlugSync PlugClean | \ PlugInstall | \ UpdateRemotePlugins command! GitGutterCustomToggle GitGutterLineHighlightsToggle | \ GitGutterLineNrHighlightsToggle command! Gblame Git blame " cnoremap :call CommandCallback() function! s:SyncColorcolumnColorscheme() let l:length = '/\%' . string(&colorcolumn + 1) . 'v.\+/' execute 'match' 'OverLength' l:length endfunction function! s:CommandCallback() let l:last_command = @: if l:last_command =~ 'set colorcolumn' call s:SyncColorcolumnColorscheme() endif endfunction function! s:Init() call s:SyncColorcolumnColorscheme() endfunction