dotfiles

Cross platform dotfiles for linux, mac and windows
git clone git@getsh.org:dotfiles.git
Log | Files | Refs

.vimrc (4034B)


      1 syntax on indent off
      2 if has("&viminfofile")
      3     set viminfofile=$XDG_CACHE_DIR/vim/viminfo
      4 endif
      5 
      6 " reject netrw, embrace ls
      7 "let loaded_netrwPlugin = 1
      8 
      9 set complete-=i
     10 set foldmethod=marker
     11 set foldmarker={,}
     12 set foldlevel=20
     13 set foldopen-=search
     14 
     15 " Debug
     16 let g:termdebug_config = {'sign': '>>', 'winbar': 0, 'wide':163}
     17 
     18 " General
     19 set nocompatible
     20 set mouse=
     21 set cursorline
     22 if has('cursorlineopt')
     23 	set cursorlineopt=number
     24 endif
     25 set exrc
     26 
     27 " Turn backup off
     28 set nobackup
     29 set nowb
     30 set noswapfile
     31 
     32 " Map leader to space
     33 nnoremap <space> <Nop>
     34 let mapleader = " "
     35 
     36 " Enable hidden buffers
     37 set hidden
     38 
     39 " Disable auto fixing end of line
     40 " Useful when opening binary files
     41 set nofixendofline
     42 
     43 " Disable vim intro message
     44 set shortmess=Iat
     45 set shortmess-=F
     46 
     47 " Search
     48 set hlsearch
     49 set incsearch
     50 set nowrapscan
     51 
     52 " Pro tab
     53 filetype plugin indent on
     54 set tabstop=4
     55 set shiftwidth=4
     56 set expandtab
     57 
     58 " Netrw customization
     59 let g:netrw_banner = 0
     60 let g:netrw_liststyle = 3
     61 let g:netrw_fastbrowse= 2
     62 
     63 " Disable status
     64 set laststatus=1
     65 
     66 set nolazyredraw
     67 set ttyfast
     68 set nospell
     69 
     70 
     71 " Common vimrc
     72 source $XDG_DATA_HOME/vim/vimrc
     73 
     74 source $XDG_DATA_HOME/vim/keybindings.vim
     75 
     76 set packpath^=$XDG_DATA_HOME/vim
     77 
     78 function! FZYFiles() abort
     79     let l:tempname = tempname()
     80     " fzf | awk '{ print $1":1:0" }' > file
     81     execute 'silent !git ls-files --recurse-submodules | fzf > ' . fnameescape(l:tempname)
     82 	let l:tcontents = join(readfile(l:tempname))
     83     try
     84 		" TODO Add option to add multiple files to argslist
     85 		"execute 'argadd ' . l:tcontents
     86 		 let bufnr = bufadd(l:tcontents)
     87 		call bufload(bufnr)
     88 		"call setbufline(bufnr, 1, ['some', 'text'])
     89         execute 'edit ' . l:tcontents
     90         redraw!
     91     finally
     92         call delete(l:tempname)
     93     endtry
     94 endfunction
     95 let g:lsc_server_commands = {'cpp': 'clangd --log=error'}
     96 let g:lsc_auto_map = {
     97     \ 'GoToDefinition': '<C-]>',
     98     \ 'GoToDefinitionSplit': ['<C-W>]', '<C-W><C-]>'],
     99     \ 'FindReferences': 'gr',
    100     \ 'FindImplementations': 'gI',
    101     \ 'FindCodeActions': 'ga',
    102     \ 'Rename': 'gR',
    103     \ 'ShowHover': v:true,
    104     \ 'DocumentSymbol': 'go',
    105     \ 'WorkspaceSymbol': 'gS',
    106     \ 'SignatureHelp': 'gm',
    107     \ 'Completion': 'completefunc',
    108     \}
    109 let g:lsc_enable_autocomplete  = v:true
    110 let g:lsc_enable_diagnostics   = v:true
    111 let g:lsc_reference_highlights = v:false
    112 let g:lsc_trace_level          = 'off'
    113 
    114 function! s:load_plugins(t) abort
    115 	set synmaxcol=128
    116 	" Use XDG Paths for vim
    117 	" TODO compile hard constants somewhere based on OS
    118 	set runtimepath^='$XDG_CONFIG_HOME/vim'
    119 	set runtimepath+='$XDG_DATA_HOME/vim'
    120 	set runtimepath+='$XDG_CONFIG_HOME/vim/after'
    121 
    122 	let g:netrw_home = $XDG_DATA_HOME . "/vim"
    123 	call mkdir($XDG_DATA_HOME . "/vim/spell", 'p')
    124 	set viewdir=$XDG_DATA_HOME/vim/view | call mkdir(&viewdir, 'p')
    125 
    126 	set backupdir=$XDG_CACHE_HOME/vim/backup | call mkdir(&backupdir, 'p')
    127 	set directory=$XDG_CACHE_HOME/vim/swap   | call mkdir(&directory, 'p')
    128 	set undodir=$XDG_CACHE_HOME/vim/undo     | call mkdir(&undodir,   'p')
    129 	packadd vim-tmux-navigator
    130 	packadd vim-commentary
    131 	packadd vim-surround
    132 	packadd vim-ninja-feet
    133 	packadd vim-fugitive
    134 	packadd vim-unimpaired
    135 	packadd vim-better-whitespace
    136 	packadd notmuch-vim
    137 	packadd vim-dispatch
    138 	packadd termdebug
    139 	let g:termdebug_wide=163
    140 	let g:notmuch_use_fzf = 1
    141 	let g:notmuch_open_command = 'fzf'
    142 	let g:notmuch_fzf_command = 'fzf --reverse'
    143 	let g:notmuch_use_conversation_view = 1
    144 	let sendmail_path = systemlist('sed -n "s/^set sendmail=\(.*\)$/\1/p; $!d" ~/.mailrc')
    145 	if len(sendmail_path) > 0
    146 		let g:notmuch_sendmail=sendmail_path[0]
    147 	endif
    148 endfunction
    149 augroup user_cmds
    150 	autocmd!
    151 	autocmd VimEnter * call timer_start(20, function('s:load_plugins'))
    152 augroup END
    153 
    154 if has("gui")
    155 	set guioptions=
    156 endif
    157 
    158 if has("win32")
    159 set shell=cmd
    160 	set shellquote=\" 
    161 	" shellxquote must be a literal space character.
    162 	set shellxquote=  
    163 else
    164     set shell=sh
    165 endif
    166 
    167 " TODO load this automatically
    168 source $XDG_CONFIG_HOME/vim/ftplugin/cpp.vim
    169 source $XDG_DATA_HOME/vim/plugin.vim
    170 
    171 let g:birck_default_chan="irc.libera.chat"