" =========== " VARIABLES " =========== " Needs to be enabled before ALE is loaded let g:ale_completion_enabled = 1 runtime bundle/vim-pathogen/autoload/pathogen.vim execute pathogen#infect('bundle-active/{}') set nocompatible " Style highlight Pmenu ctermfg=0 ctermbg=7 guibg=Magenta " Tabs set tabstop=8 set softtabstop=8 set shiftwidth=8 set noexpandtab "Disable bell set vb set t_vb= set ttimeoutlen=10 " Flashy statusline let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#branch#enabled = 1 "let g:airline#extensions#whitespace#enabled = 1 let g:airline#extensions#ale#enabled = 1 let g:airline_powerline_fonts = 1 let g:airline_highlighting_cache = 1 " Enable colored brackets let g:rainbow_active = 1 " ALE config "set omnifunc=ale#completion#OmniFunc "let g:ale_completion_autoimport = 1 let g:ale_set_highlights = 1 "Highlights are annoying let g:ale_set_signs = 1 "let g:ale_virtualtext_cursor = 1 " Only use one of the following let g:ale_cursor_detail = 1 let g:ale_close_preview_on_insert = 1 let g:ale_floating_preview = 1 "let g:ale_hover_to_floating_preview = 1 let g:ale_floating_window_border = [] let g:ale_linters = {'rust': [ 'analyzer']} highlight ALEWarning cterm=underline,italic ctermfg=yellow highlight ALEError cterm=underline,italic ctermfg=red " let g:zig_fmt_autosave = 0 "All things cursor set guicursor+=a:blinkon0 "disable blinking if &term =~ "xterm\\|rxvt" " 1 or 0 -> blinking block " 2 -> solid block " 3 -> blinking underscore " 4 -> solid underscore " 5 -> blinking vertical bar " 6 -> solid vertical bar let &t_SI .= "\[6 q" " Normal let &t_EI .= "\[2 q" " Insert endif "show line endings and tabs set listchars=tab:>\ ,trail:~,extends:>,precedes:< set list " leader let mapleader = "-" let leader = "-" let maplocalleader = "-" syntax enable filetype plugin indent on "Line number Highlight set nu rnu highlight LineNr term=bold cterm=NONE ctermfg=DarkGrey ctermbg=NONE gui=NONE guifg=DarkGrey guibg=NONE "set foldmethod=syntax " ============== " SHORTCUTS " ============== "Switch windows with keys "nmap :wincmd k "nmap :wincmd j "nmap :wincmd h "nmap :wincmd l " Completion inoremap Tab_Or_Complete() nmap :vsplit:e . nmap :e . " Fold nnoremap @=(foldlevel('.')?'za':"\") vnoremap zf nmap :Runbuffer au filetype c* nmap :Make au filetype *tex nmap :Makelatex au filetype *tex nmap :Openpdf nmap :NERDTreeToggle nmap :TlistToggle "Tab mgmt nmap gc :tabclose nmap gn :tabnew:e . "tmap " Smart brackets inoremap "" "" inoremap '' '' inoremap () () inoremap [] [] inoremap {} {} inoremap { {}O inoremap {; {};O " vterminal nmap :Newterm nmap :VTermToggle tnoremap :VTermSwitch nnoremap :VTermSwitch "let g:vterminal_coverage = '0.33' " reload vimrc nmap :so $MYVIMRC " =========== " COMMANDS " =========== command -bar Suw :w !SUDO_ASKPASS="/usr/lib/ssh/ssh-askpass" sudo -A tee % "^] Jump to tag, ^t jump back command! MakeTags !ctags -R . command -bar Newterm call Run_in_terminal("") command -bar Runbuffer call Run_in_terminal(expand("%:p")) command -bar Make call Run_in_terminal("make run") command -bar Fileheader call Insert_Header(expand("%")) command -bar Makelatex silent! execute "!(pdflatex % > /dev/null 2>&1 && killall -s SIGHUP mupdf)&" | redraw! command Openpdf silent! execute "!mupdf " . (join(split(expand("%"), '\.')[:-2], ".") . ".pdf") . " > /dev/null 2>&1 &" | redraw! " =========== " FUNCTIONS " =========== function Insert_Header(name) let l:name=systemlist("git config --global --get user.name")[0] let l:mail=systemlist("git config --global --get user.email")[0] call append("0", ["/*", " * ".a:name, " * (c) ".strftime("%Y")." ".l:name." <".l:mail.">", " * License: All rights reserved.", " */"]) startinsert endfunction function Run_in_terminal(prog) let l:args = " " if !has('nvim') if !has('terminal') return endif let l:args='++curwin' endif tabnew execute "terminal " . l:args . " " . a:prog startinsert endfunction " if we are in the middle of typing, complete, " otherwise just type TAB function! Tab_Or_Complete() abort if pumvisible() return "\" elseif col('.')>1 && strpart( getline('.'), col('.')-2, 3 ) =~ '^[[:keyword:][:ident:]]' return "\" else return "\" endif endfunction