let $VIMHOME = expand('~/.vim') let s:sep = has('win32') ? '\' : '/' " check if in tty let g:is_tty = system('case $(tty) in (/dev/tty[0-9]) echo 1;; (*) echo 0;; esac') " set user_dir if has('nvim') let s:user_dir = stdpath('config') else let s:user_dir = has('win32') ? expand('~/vimfiles') : expand('~/.vim') endif """ Set python3 path let g:python3_host_prog = "/usr/bin/python" let g:python_host_prog='/usr/bin/python' """ source " all other includes are in alphabetical order source $VIMHOME/config/ale.vim source $VIMHOME/config/fzf.vim source $VIMHOME/config/indent.vim source $VIMHOME/config/language-client.vim source $VIMHOME/config/mucomplete.vim source $VIMHOME/config/nerdtree.vim source $VIMHOME/config/powerline.vim source $VIMHOME/config/redir.vim source $VIMHOME/config/rg.vim source $VIMHOME/config/theme.vim " this sets the colorscheme source $VIMHOME/config/vim-go.vim source $VIMHOME/config/vim-rooter.vim """ general filetype plugin indent on set nospell " restore screen after quitting " au VimLeave * :!clear syntax on packloadall silent! helptags ALL " Enable persistent undo set undodir=$VIMHOME/.undo/ set undofile set undolevels=1000 "maximum number of changes that can be undone set undoreload=10000 "maximum number lines to save for undo on a buffer reload " Automatically re-open files after they have changed without prompting. " This can be a little more destructive, but a lot less annoying. set autoread set autoindent set showmatch " Put all special files in the right place set backupdir=$VIMHOME/.backup/ set directory=$VIMHOME/.swp/ " Draw tabs and trailing spaces. " set listchars=tab:<-> let g:indent_guides_enable_on_vim_startup = 1 let g:indent_guides_start_level = 2 let g:indent_guides_guide_size = 1 set listchars=tab:›\ ,trail:•,extends:#,nbsp:. "set listchars=tab:-->,trail:$,extends:#,nbsp:. hi IndentGuidesOdd ctermbg=white hi IndentGuidesEven ctermbg=lightgrey set list " Set the right margin. set colorcolumn=89 " Automatically split words at the margin. " set wrap " Default to spaces instead of tabs set expandtab " Set tab width to 4. set tabstop=4 set shiftwidth=4 " Setting this will make backspace delete space indents set softtabstop=4 " Disable automatic wrapping. set textwidth=0 " Enable highlight on search patterns matches set hlsearch hi Search guibg=Purple " define line highlight color highlight LineHighlight ctermbg=darkgray guibg=Purple " Make :Q and :W work like :q and :w command! W w command! Q q command! QA qa command! WQ wq command! Wq wq command! Wqa wqa command! WQA wqa command! WW w ! sudo tee %:t " Make completion smarter. set ignorecase set smartcase " viminfo settings " '100 : Remember marks for 100 previously edited files. " <50 : ??? " s10 : ??? " h : ??? " "100 : Save 100 lines for each register " :50 : Remember 50 lines of command history set viminfo='100,<50,s10,h,\"100,:50 " Jump at last opened cursor position position, if valid if has("autocmd") au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") \| exe "normal! g'\"" | endif endif " Warn about not being able to write to .viminfo, which messes up restoring " the cursor position when editing. let s:info_filename = expand('~/.viminfo') if !empty(glob(s:info_filename)) && !filewritable(s:info_filename) echoerr 'The .viminfo file cannot be written to!' endif """ keybindings let mapleader = ',' noremap ad :ALEGoToDefinition nnoremap af :ALEFix nnoremap ah :ALEHover noremap ar :ALEFindReferences nnoremap r :ALENextWrap nnoremap R :ALEPreviousWrap nnoremap :bd nnoremap e :NERDTree nnoremap r :redo nnoremap nnoremap nnoremap nnoremap nnoremap b :Gblame nnoremap :FZF nnoremap f :Buffers nnoremap :Files nnoremap :Rg nnoremap s :call Fzf_dev() nnoremap c :Commits nnoremap b :Gblame nnoremap :silent! nohls:call clearmatches() nnoremap :bnext nnoremap \ :bprev nnoremap L :call LightOrDarkness() map y (operator-poweryank-osc52) " Following three from here: https://github.com/vim/vim/issues/5157#issue-516033639 xnoremap "+y y:call system("wl-copy", @") nnoremap "+p :let @"=substitute(system("wl-paste --no-newline"), '', '', 'g')p nnoremap "*p :let @"=substitute(system("wl-paste --no-newline --primary"), '', '', 'g')p nnoremap u :UndotreeShow:UndotreeFocus " highlight the current line nnoremap l :call matchadd('LineHighlight', '\%'.line('.').'l') nnoremap :m .+1== nnoremap :m .-2== inoremap :m .+1==gi inoremap :m .-2==gi vnoremap :m '>+1gv=gv vnoremap :m '<-2gv=gv " vim: set et sw=0 ts=4 sts=0: