" ===== hasufell's vimrc )))) " no ATTENTION messages when swap file is already found set shortmess+=A let g:pymode_python = 'python3' let g:python_host_prog = '/usr/bin/python2' let g:python3_host_prog = '/usr/bin/python3' " plugin stuff filetype plugin on set backspace=indent,eol,start " backspace through everything in insert mode set cmdheight=1 " if has("gui_running") " autocmd GUIEnter * set vb t_vb= " endif set belloff=all set wildmenu " set wildmode=longest,list,full " plugins if &compatible set nocompatible " Be iMproved endif " Required: set runtimepath+=~/.cache/dein/repos/github.com/Shougo/dein.vim let s:toml = $HOME . '/.vim/plugins.toml' let g:dein#lazy_rplugins = v:false " Required: if dein#load_state($HOME . '/.cache/dein') call dein#begin($HOME . '/.cache/dein', [$HOME . '/.vim/vimrc', $HOME . '/.vim/plugins.toml']) call dein#add('wsdjeg/dein-ui.vim') call dein#load_toml(s:toml) " Let dein manage dein " Required: call dein#add($HOME . '/.cache/dein/repos/github.com/Shougo/dein.vim') " Required: call dein#end() call dein#save_state() endif filetype plugin indent on " ===== further plugin initialization and default config ===== so ~/.vim/plugged/cmdalias.vim/plugin/cmdalias.vim so ~/.vim/autoload/log-autocmds.vim " lustyexplorer set hidden " ==== conque ==== " command aliases call CmdAlias('t','tabnew') " call CmdAlias('cmd','ConqueTermSplit') " call CmdAlias('bash','ConqueTermSplit bash<CR>') call CmdAlias('openall','tab sball') call CmdAlias('stripw','call StripTrailingWhitespaces()<CR>') call CmdAlias('hotkeys', 'tabnew ~/.vim/hotkeys') call CmdAlias('TC', 'call ToggleComment()<CR>') call CmdAlias('TF', 'call ToggleFoldText()<CR>') call CmdAlias('ctags', '!/usr/bin/ctags -R --langmap=c:.c.h --c++-kinds=+p --c-kinds=+p+x --fields=+i+a+S+t+l+m+n --extra=+q .<CR>') call CmdAlias('Nf', 'Neoformat') call CmdAlias('NF', 'Neoformat') call CmdAlias('nf', 'Neoformat') call CmdAlias('LS', 'LanguageClientStart') call CmdAlias('LspLog', 'lua vim.cmd("e"..vim.lsp.get_log_path())<CR>') " global settings if has('gui_running') set guioptions -=T " disable gvim tab set guioptions-=e set winaltkeys=no set guiheadroom=0 else set termguicolors endif set foldmethod=syntax "fold based on indent set foldnestmax=10 "deepest fold is 10 levels set nofoldenable "dont fold by default set foldlevel=1 "this is just what i useset directory=~/.vimtmp set mouse=a set autoread set number set encoding=utf8 set guifont=Hack\ Nerd\ Font\ Mono\ 16 set clipboard=unnamedplus set textwidth=0 set tabstop=4 set shiftwidth=4 set directory=~/.vimtmp set modeline set modelines=1 set autoindent set laststatus=2 let g:nickID = 'hasufell' " don't yank to buffer on deletion " vnoremap d "_d " nnoremap d "_d vnoremap x "_x nnoremap x "_x " Syntax syntax on " pane navigation " Use ctrl-[hjkl] to select the active split! let g:C_Ctrl_j = 'off' let g:BASH_Ctrl_j = 'off' try lang en_US catch endtry " =========================== " Disable annoying auto line break fu! DisableBr() set wrap set linebreak set nolist " list disables linebreak set textwidth=0 set wrapmargin=0 set formatoptions-=t endfu " Disable line breaks for all file types au BufNewFile,BufRead *.* call DisableBr() " ==========copy/paste=========== function! Paste(mode) if a:mode == 'v' normal gv normal "_d normal "+gP normal l elseif a:mode == 'i' set virtualedit=all normal `^"+gP let &virtualedit = '' endif endfunction " ======select all======= function! Select() set virtualedit=all normal `^ggVG let &virtualedit = '' endfunction " ======================= " ====== traling whitespace ===== fun! ShowTrailingWhitespace(pattern) if &ft == 'conque_term' call clearmatches() return endif if &ft == 'diff' call clearmatches() return endif let str=a:pattern if str == '1' match ExtraWhitespace /\s\+$/ elseif str == '2' call clearmatches() " match ExtraWhitespace /\s\+\%#\@<!$/ elseif str == '3' match ExtraWhitespace /\s\+$/ endif endfun highlight ExtraWhitespace ctermbg=red guibg=red match ExtraWhitespace /\s\+$/ autocmd BufWinEnter * call ShowTrailingWhitespace('1') autocmd InsertEnter * call ShowTrailingWhitespace('2') autocmd InsertLeave * call ShowTrailingWhitespace('3') autocmd BufWinLeave * call clearmatches() fun! StripTrailingWhitespaces() let l = line(".") let c = col(".") %s/\s\+$//e call cursor(l, c) endfun function! ComIfGit(com1, com2) silent! !git rev-parse --is-inside-work-tree if v:shell_error == 0 execute a:com1 else execute a:com2 endif endfunction " =========================== " comment hiding func! IsComment( lnum ) return synIDattr(synID(a:lnum, match(getline(a:lnum),'\S')+1, 1),'name') =~? 'comment' endfun "set fdm=expr set fde=IsComment(v:lnum)?1:IsComment(prevnonblank(v:lnum))?1:IsComment(nextnonblank\(v:lnum))?1:0 " light #073642 dark #002b36 grey #586e75 highlight Folded gui=NONE guifg=#586e75 guibg=#002b36 set foldtext='\ ' let g:folded = 0 function! ToggleComment() if (g:folded == 0) highlight Comment guifg=#002b36 let g:folded=1 else highlight Comment guifg=#586e75 let g:folded=0 endif endfunction let g:myfoldtext = 0 function! ToggleFoldText() if (g:myfoldtext == 0) set foldtext='--'.v:folddashes.'\ '.getline(v:foldstart).'\ ' let g:myfoldtext=1 else set foldtext='\ ' let g:myfoldtext=0 endif endfunction """""""""""""""""""""""""""""" " vim macro to jump to devhelp topics. """""""""""""""""""""""""""""" function! DevHelpCurrentWord() let word = expand('<cword>') exe '!devhelp -s ' . word . ' &' endfunction function! ManCurrentWord() let word = expand('<cword>') exe '!man 3 ' . word endfunction """""""""""""""""""""""""""""" " Close preview after typing """""""""""""""""""""""""""""" autocmd WinEnter * call ClosePreviewWindow() function ClosePreviewWindow() if getwinvar(winnr("#"), "&pvw") == 1 pclose endif endfunction set title autocmd BufEnter * set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:h\")})%)%(\ %a%) " vim:foldmethod=marker:foldlevel=0