vimrc 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564
  1. """"" My (demuredemeanor) .vimrc
  2. "" Uses tabstop=4; shiftwidth=4; foldmarker={{{,}}};
  3. """"""""vim: set tabstop=4 shiftwidth=4:
  4. "" Above is an attempt at a modeline, which seems to have a issue
  5. "" where long pastes get a new line...
  6. "" https://notabug.org/demure/dotfiles/
  7. "" legacy repo http://github.com/demure/dotfiles
  8. """ Commands at Start """ {{{
  9. "" This one needs to be first
  10. set nocompatible " Choose no comp with legacy vi
  11. if has("syntax")
  12. syntax on " Adds vim color based on file
  13. endif
  14. "" Enable filetype settings
  15. if has("eval")
  16. filetype on
  17. filetype plugin on
  18. filetype indent on
  19. endif
  20. """ Folds Settings """ {{{
  21. if has("folding")
  22. set foldenable " Enable folds
  23. "" These next two would save which folds are open/close, as well
  24. "" as view location, but seems to force set foldmethod=indent...
  25. "au BufWinLeave ?* mkview
  26. "au BufWinEnter ?* silent loadview
  27. set foldmethod=marker
  28. set fillchars=fold:<
  29. highlight Folded ctermfg=Grey ctermbg=Black
  30. "set foldlevelstart=99 " Effectively disable auto folding
  31. """ Foldtext """ {{{
  32. "" Inspired by http://www.gregsexton.org/2011/03/improving-the-text-displayed-in-a-fold/
  33. set foldtext=CustomFoldText()
  34. function! CustomFoldText()
  35. "" Process line
  36. let fs = v:foldstart
  37. let fLinePrep = substitute(getline(fs), '\t\| ', '+---', 'g')
  38. let fLine = substitute(fLinePrep, ' {\{3}', '', 'g')
  39. "" Process line count and fold precentage
  40. let fSize = 1 + v:foldend - v:foldstart
  41. let fSizeStr = " (" . fSize . " lines) "
  42. let fLineCount = line("$")
  43. let fPercent = printf(" [%.1f", (fSize*1.0)/fLineCount*100) . "%] "
  44. "" Process fold level
  45. let fLevel = " {".v:foldlevel."} "
  46. "" Process filler string
  47. let w = winwidth(0) - &foldcolumn - (&number ? 8 : 0)
  48. let expansionString = repeat(".", w - strwidth(fSizeStr.fLine.fPercent.fLevel))
  49. "return fLine . expansionString . fSizeStr . foldPercent . foldLevel
  50. return fLine . fSizeStr . fPercent . fLevel
  51. endfunction
  52. """ End Foldtext """ }}}
  53. endif
  54. """ End Folds Settings """ }}}
  55. "" Stop auto comment on new line
  56. autocmd FileType * setlocal formatoptions-=cro
  57. set shortmess+=atIT " Stop messages at vim launch
  58. runtime macros/matchit.vim " Add '%' matching to if/elsif/else/end
  59. "" Mutt settings
  60. " Support Format-Flowed in email (mutt).
  61. " Because it is a good-ness? http://joeclark.org/ffaq.html
  62. autocmd FileType mail setlocal fo+=aw tw=72
  63. "" vimdiff settings
  64. if &diff
  65. set cursorline
  66. map ] ]c
  67. map [ [c
  68. colorscheme slate
  69. endif
  70. "" Disable cache for pass
  71. autocmd VimEnter
  72. \ /dev/shm/pass.?*/?*.txt
  73. \,$TMPDIR/pass.?*/?*.txt
  74. \,/tmp/pass.?*/?*.txt
  75. \ set nobackup nowritebackup noswapfile noundofile
  76. "" auto resize slits on window resize
  77. autocmd VimResized * wincmd =
  78. "" auto detech csv files
  79. if exists("did_load_csvfiletype")
  80. finish
  81. endif
  82. let did_load_csvfiletype=1
  83. augroup filetypedetect
  84. au! BufRead,BufNewFile *.csv,*.dat setfiletype csv
  85. augroup END
  86. """ End Commands at Start """ }}}
  87. """ Plugins """ {{{
  88. if $USER != 'mobile'
  89. """ Setting up Vundle """ {{{
  90. "" From http://www.erikzaadi.com/2012/03/19/auto-installing-vundle-from-your-vimrc/
  91. let iCanHazVundle=1
  92. let vundle_readme=expand('~/.vim/bundle/Vundle.vim/README.md')
  93. if !filereadable(vundle_readme)
  94. echo "Installing Vundle.."
  95. echo ""
  96. silent !mkdir -p ~/.vim/bundle
  97. "" Disabled for git url
  98. silent !git clone https://github.com/VundleVim/Vundle.vim.git ~/.vim/bundle/Vundle.vim
  99. let iCanHazVundle=0
  100. endif
  101. set rtp+=~/.vim/bundle/Vundle.vim/
  102. """""""call vundle#rc() ""commented out for vundle version bump change??
  103. call vundle#begin()
  104. "" Use git instead of http
  105. "let g:vundle_default_git_proto = 'git'
  106. "" Have vundle first...
  107. Plugin 'VundleVim/Vundle.vim'
  108. """ Bundles """ {{{
  109. ""Add your bundles here
  110. """ Style """ {{{
  111. Plugin 'altercation/vim-colors-solarized' " Solarized theme
  112. Plugin 'syntax-highlighting-for-tintinttpp' " Tintin++ syntax
  113. Plugin 'bling/vim-airline' " Even better than powerline/neatstatus
  114. Plugin 'nathanaelkane/vim-indent-guides' " vim-indent-guides default binding: <Leader>ig
  115. Plugin 'kien/rainbow_parentheses.vim' " Colorize parentheses and similar chars
  116. Plugin 'myusuf3/numbers.vim' " Make num ruler auto switch absolute/rel for insert/norm
  117. Plugin 'mhinz/vim-signify' " Add git diff
  118. Plugin 'mboughaba/i3config.vim' " i3 conf syntax
  119. """ End Style """ }}}
  120. """ Added Interface """ {{{
  121. Plugin 'scrooloose/nerdtree' " File browser
  122. Plugin 'bufexplorer.zip' " buffer browser
  123. Plugin 'sjl/gundo.vim' " Undo history tree
  124. "Plugin 'szw/vim-ctrlspace' " Super buffer controlness, disabled due to never using
  125. Plugin 'haya14busa/incsearch.vim' " Improved incremental searching
  126. Plugin 'spolu/dwm.vim' " dwm like split control
  127. Plugin 'will133/vim-dirdiff' " vimdiff dirs
  128. """ End Interface """ }}}
  129. """ Added Functionality """ {{{
  130. Plugin 'tpope/vim-repeat' " Makes '.' repeat work with plugins
  131. Plugin 'scrooloose/nerdcommenter' " Make commenting easy
  132. Plugin 'YankRing.vim' " Improves copy/paste
  133. Plugin 'tpope/vim-fugitive' " git from vim
  134. Plugin 'scrooloose/syntastic' " Code syntax checker
  135. "Plugin 'SearchComplete' " Disabled due to killing UP arrow in search
  136. Plugin 'Lokaltog/vim-easymotion' " <prefix><prefix>motion
  137. Plugin 'chrisbra/csv.vim' " Good CVS file handling
  138. Plugin 'dhruvasagar/vim-table-mode' " Make easy tables
  139. "Plugin 'vim-scripts/Smart-Tabs' " Use \t for indents, and spaces elsewhere
  140. Plugin 'jamessan/vim-gnupg' " Transparent editing of gpg encrypted files
  141. Plugin 'ConradIrwin/vim-bracketed-paste' " Auto set pastemode when a bracketed paste detected. https://cirw.in/blog/bracketed-paste
  142. """ End Functionality """ }}}
  143. """ Misc """ {{{
  144. Plugin 'uguu-org/vim-matrix-screensaver' " Add unnecessary matrix screen saver
  145. Plugin 'takac/vim-hardtime' " Plugin to break bad movement habits
  146. """ End Misc """ }}}
  147. ""...All your other bundles...
  148. """ End Bundles """ }}}
  149. call vundle#end() " required
  150. if iCanHazVundle == 0
  151. echo "Installing Bundles, please ignore key map error messages"
  152. echo ""
  153. :PluginInstall
  154. endif
  155. """ End Setting Up Vundle """ }}}
  156. """ Plugin Confs """ {{{
  157. """ NERDtree config """ {{{
  158. "" Starts NERDtree if no file is give to vim at start
  159. "autocmd vimenter * if !argc() | NERDTree | endif
  160. """ End NERDtree """ }}}
  161. """ Vim Repeat Conf """ {{{
  162. "" This is to make repeat work for plugins too
  163. silent! call repeat#set("\<Plug>MyWonderfulMap", v:count)
  164. """ End Vim Repeat """ }}}
  165. """ Better Rainbow Parentheses """ {{{
  166. "" https://github.com/kien/rainbow_parentheses.vim
  167. """ Auto Rainbow """ {{{
  168. au VimEnter * RainbowParenthesesToggle
  169. au Syntax * RainbowParenthesesLoadRound
  170. au Syntax * RainbowParenthesesLoadSquare
  171. au Syntax * RainbowParenthesesLoadBraces
  172. """ End Auto """ }}}
  173. nmap <leader>[ :RainbowParenthesesToggle <CR>
  174. """ End Rainbow Parenthesis """ }}}
  175. """ YankRing Conf """ {{{
  176. "" :h yankring-tutorial
  177. nnoremap <silent> <F3> :YRShow<CR>
  178. inoremap <silent> <F3> <ESC>:YRShow<CR>
  179. map <silent> <prefix>y :YRShow<CR>
  180. let g:yankring_history_dir = '~/.vim'
  181. """ End YankRing """ }}}
  182. """ Solarized Theme """ {{{
  183. "call togglebg#map("<F6>")
  184. if has('gui_running')
  185. set background=light
  186. colorscheme solarized
  187. endif
  188. """ End Solarized """ }}}
  189. """ Gundo Conf """ {{{
  190. "" http://sjl.bitbucket.org/gundo.vim/
  191. nnoremap <F4> :GundoToggle<CR>
  192. """ End Gundo """ }}}
  193. """ Numbers.vim Conf""" {{{
  194. "" https://github.com/myusuf3/numbers.vim
  195. nnoremap <leader>n :NumbersToggle<CR>
  196. """ End Nunmbers.vim """ }}}
  197. """ Vim Indent Guides """ {{{
  198. "" https://github.com/nathanaelkane/vim-indent-guides
  199. "" <Leader>ig
  200. let g:indent_guides_auto_colors = 0
  201. "autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=236
  202. autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd guibg=red ctermbg=240
  203. autocmd VimEnter,Colorscheme * :hi IndentGuidesEven guibg=green ctermbg=244
  204. let g:indent_guides_enable_on_vim_startup = 1
  205. "let g:indent_guides_guide_size = 2
  206. let g:indent_guides_start_level = 2
  207. """ End Indent Guides """ }}}
  208. """ Airline Conf """ {{{
  209. "" Added to fix airline (forces status visibility)
  210. set laststatus=2
  211. "" Disable auto echo?
  212. let g:bufferline_echo = 0
  213. "" Remove default mode indicator
  214. set noshowmode
  215. "" Populate powerline symols
  216. let g:airline_powerline_fonts = 1
  217. """ End Airline Conf """ }}}
  218. """ Hardtime Conf """ {{{
  219. let g:hardtime_default_on = 0
  220. let g:hardtime_ignore_buffer_patterns = [ "CustomPatt[ae]rn", "NERD.*", "Task.*" ]
  221. nmap <leader>n :HardTimeToggle<CR>
  222. """ End Hardtime """ }}}
  223. """ Syntastic Conf """ {{{
  224. let g:syntastic_auto_loc_list=1
  225. """ End Syntastic """ }}}
  226. """ Vim-CtrlSpace Conf """ {{{
  227. "" https://github.com/szw/vim-ctrlspace
  228. "" Make work with airline
  229. let g:airline_exclude_preview = 1
  230. """ End Vim-CtrlSpace """ }}}
  231. """ Incsearch.vim Conf """ {{{
  232. "" https://github.com/haya14busa/incsearch.vim
  233. let g:incsearch#magic = '\v'
  234. map / <Plug>(incsearch-forward)
  235. map ? <Plug>(incsearch-backward)
  236. map g/ <Plug>(incsearch-stay)
  237. """ End Incsearch.vim """ }}}
  238. """ DWM.vim Conf """ {{{
  239. nnoremap <silent> <C-b> :call DWM_New()<CR>
  240. """ End DWM.vim Conf """ }}}
  241. """ End Plugin Confs """ }}}
  242. endif
  243. """ End Plugins """ }}}
  244. """ Theming """ {{{
  245. if has('gui_running')
  246. set background=light
  247. colorscheme solarized
  248. else
  249. colorscheme torte
  250. endif
  251. "" fix transparency
  252. hi! Normal ctermbg=NONE guibg=NONE
  253. """ End Theming """ }}}
  254. """ Options """ {{{
  255. """ Assorted """ {{{
  256. set autoread " Reload files changed outside vim
  257. set encoding=utf8 " Sets encoding View
  258. set scrolloff=3 " Show next three lines scrolling
  259. set sidescrolloff=2 " Show next two columns scrolling
  260. set ttyfast " Indicates a fast terminal connection
  261. set splitbelow " New horizontal splits are below
  262. set splitright " New vertical splits are to the right
  263. set history=1000 " Increase command/search history
  264. set confirm " Vim prompts for :q/:qa/:w issues
  265. """ End Assorted """ }}}
  266. """ HUD """ {{{
  267. set number " Adds line numbers
  268. set showcmd " Show incomplete cmds down the bottom
  269. "" Disabled for air-line
  270. "set showmode " Shows input or replace mode at bottom
  271. set ruler " Show position in bottom right
  272. """ End HUD """ }}}
  273. """ Input """ {{{
  274. set virtualedit=block,onemore " Cursor can move one past EOL, and free in Visual mode
  275. " set virtualedit=all " Allow virtual editing, all modes.
  276. set mouse=a " Enable mouse, all modes
  277. set backspace=indent,eol,start " Allow backspace in insert mode
  278. """ End Input """ }}}
  279. """ Mac kill damn bold """ {{{
  280. if has('mac')
  281. set t_Co=256 " FORCE 256 colors in vim
  282. endif
  283. """ End Mac """ }}}
  284. """ Wild Stuffs... """ {{{
  285. set wildmenu " Show list instead of just completing
  286. set wildmode=list:longest,full " Command <Tab> completion, list matches, then longest common part, then all.
  287. "" From http://blog.sanctum.geek.nz/lazier-tab-completion/
  288. if exists("&wildignorecase")
  289. set wildignorecase " Ignore case in file name completion
  290. endif
  291. "" From http://bitbucket.org/sjl/dotfiles/overview
  292. set wildignore+=.hg,.git,.svn " Version control
  293. set wildignore+=*.aux,*.out,*.toc " LaTeX intermediate files
  294. set wildignore+=*.jpg,*.bmp,*.gif,*.png,*.jpeg " binary images
  295. set wildignore+=*.o,*.obj,*.exe,*.dll,*.manifest " compiled object files
  296. set wildignore+=*.spl " compiled spelling word lists
  297. set wildignore+=*.sw? " Vim swap files
  298. set wildignore+=*.DS_Store " OSX bullshit
  299. set wildignore+=*.luac " Lua byte code
  300. set wildignore+=migrations " Django migrations
  301. set wildignore+=*.pyc " Python byte code
  302. set wildignore+=*.orig " Merge resolution files
  303. "" Clojure/Leiningen
  304. set wildignore+=classes
  305. set wildignore+=lib
  306. """ End Wild """ }}}
  307. """ Show Hidden Chars """ {{{
  308. set list " Shows certain hidden chars
  309. set listchars=eol:¬,tab:▶-,trail:~,extends:>,precedes:<,nbsp:·
  310. hi NonText ctermfg=darkgray " Makes trailing darkgray
  311. hi SpecialKey ctermfg=darkgray " Makes Leading darkgray
  312. """ End Hidden Chars """ }}}
  313. """ Spelling """ {{{
  314. set spell " Spelling hilight on
  315. " highlight SpellBad cterm=underline ctermfg=red
  316. hi SpellBad cterm=underline ctermbg=NONE
  317. hi SpellCap cterm=underline ctermbg=NONE
  318. """ End Spelling """ }}}
  319. """ Tab Windows """ {{{
  320. set hidden " Hides buffers, instead of closing, or forcing save
  321. set showtabline=2 " shows the tab bar at all times
  322. set tabpagemax=100 " max num of tabs to open on startup
  323. hi TabLineSel ctermbg=Yellow " Current Tab
  324. hi TabLine ctermfg=Grey ctermbg=DarkGrey " Other Tabs
  325. hi TabLineFill ctermfg=Black " Rest of line
  326. hi Title ctermfg=DarkBlue ctermbg=None " Windows in Tab
  327. """ End Tab Windows """ }}}
  328. """ Tab Key Settings """ {{{
  329. "" prefer tabs now...
  330. set expandtab "" use spaces, not tabs
  331. set tabstop=4 " Set Tab length
  332. set shiftwidth=4 " Affects when you press >>, << or ==. And auto indent.
  333. set shiftround " Uses multiple of shiftwidth when indenting with '<' and '>'
  334. set softtabstop=4 " With space indenting, lets vim delete multiple spaces at once
  335. "" disabled per https://stackoverflow.com/questions/234564/tab-key-4-spaces-and-auto-indent-after-curly-braces-in-vim
  336. " set smarttab " Insert Tabs at ^ per shiftwidth, not tabstop
  337. set autoindent " Always set auto indenting on
  338. set copyindent " Copy prior indentation on autoindent
  339. """ End Tab Key """ }}}
  340. """ Searching """ {{{
  341. " Use real regex search
  342. nnoremap / /\v
  343. vnoremap / /\vi
  344. set hlsearch " Highlight matches
  345. set incsearch " Incremental searching
  346. set ignorecase " Searches are case insensitive...
  347. "" Disabled as was annoying with command completion
  348. "set smartcase " ...unless contains oneplus Cap letter
  349. set showmatch " Show matching brackets/parenthesis
  350. set gdefault " Applies substitutions globally on lines. Append 'g' to invert back.
  351. set synmaxcol=800 " Don't highlight lines longer than 800 chars
  352. set wrapscan " Scan wraps around the file
  353. """ End Searching """ }}}
  354. """ Backup Settings """ {{{
  355. """ Dir Validation """ {{{
  356. if !isdirectory(expand("~/.vim/back/"))
  357. call mkdir(expand("~/.vim/back/"), "p")
  358. endif
  359. if !isdirectory(expand("~/.vim/swap/"))
  360. call mkdir(expand("~/.vim/swap/"), "p")
  361. endif
  362. if !isdirectory(expand("~/.vim/undo/"))
  363. call mkdir(expand("~/.vim/undo/"), "p")
  364. endif
  365. """ End Dir """ }}}
  366. set backup " Enable backups
  367. set undofile " Enable undo file
  368. set undoreload=10000
  369. set backupdir=~/.vim/back// " back files, // for full path
  370. set directory=~/.vim/swap// " swap files, // for full path
  371. set undodir=~/.vim/undo// " undo files, // for full path
  372. """ End Backup Settings """ }}}
  373. """ Timeout Settings """ {{{
  374. set timeout " :mapping time out
  375. set timeoutlen=1000 " :mapping time out length
  376. set ttimeout " Key code time out
  377. set ttimeoutlen=50 " key code time out length
  378. """ End Timeout """ }}}
  379. """ End Options """ }}}
  380. """ Aliases """ {{{
  381. command! BI BundleInstall
  382. """ End Aliases """ }}}
  383. """ Functions """ {{{
  384. """ DiffSaved """ {{{
  385. "" To compare current vs saved version
  386. "" http://vim.wikia.com/wiki/Diff_current_buffer_and_the_original_file
  387. "" To get out of diff view you can use the :diffoff command.
  388. function! s:DiffWithSaved()
  389. let filetype=&ft
  390. diffthis
  391. vnew | r # | normal! 1Gdd
  392. diffthis
  393. exe "setlocal bt=nofile bh=wipe nobl noswf ro ft=" . filetype
  394. endfunction
  395. com! DiffSaved call s:DiffWithSaved()
  396. """End DiffSaved """ }}}
  397. """ HighlightRepeats """ {{{
  398. "" from https://stackoverflow.com/questions/1268032/how-can-i-mark-highlight-duplicate-lines-in-vi-editor
  399. function! HighlightRepeats() range
  400. let lineCounts = {}
  401. let lineNum = a:firstline
  402. while lineNum <= a:lastline
  403. let lineText = getline(lineNum)
  404. if lineText != ""
  405. let lineCounts[lineText] = (has_key(lineCounts, lineText) ? lineCounts[lineText] : 0) + 1
  406. endif
  407. let lineNum = lineNum + 1
  408. endwhile
  409. exe 'syn clear Repeat'
  410. for lineText in keys(lineCounts)
  411. if lineCounts[lineText] >= 2
  412. exe 'syn match Repeat "^' . escape(lineText, '".\^$*[]') . '$"'
  413. endif
  414. endfor
  415. endfunction
  416. command! -range=% HighlightRepeats <line1>,<line2>call HighlightRepeats()<F29>
  417. """ End HighlightRepeats """ }}}
  418. """ End Functions """ }}}
  419. """ Key Bindings """ {{{
  420. let mapleader="," " Change the mapleader from '\' to ','
  421. map <leader>/ :noh<return> " <leader>/ will clear search hilights!
  422. """ Quickly edit/reload the vimrc file """ {{{
  423. "" maps the ,ev and ,sv keys to edit/reload .vimrc.
  424. nmap <silent> <leader>ev :tabedit $MYVIMRC<CR>
  425. nmap <silent> <leader>sv :so $MYVIMRC<CR>
  426. """ End reload """ }}}
  427. """ Paste Toggle, for stopping formating of pastes """ {{{
  428. nnoremap <F2> :set invpaste paste?<CR>
  429. set pastetoggle=<F2>
  430. nmap <leader>p :set invpaste paste?<CR>
  431. """ End Paste Toggle """ }}}
  432. """ Vim Tab Window Keysbindings """ {{{
  433. " nnoremap <C-Left> :tabprevious<CR>
  434. " nnoremap <C-Right> :tabnext<CR>
  435. " nnoremap <silent> <A-Left> :execute 'silent! tabmove ' . (tabpagenr()-2)<CR>
  436. " nnoremap <silent> <A-Right> :execute 'silent! tabmove ' . tabpagenr()<CR>
  437. """ End Tab Window Keys """ }}}
  438. """ Navigate Splits """ {{{
  439. "" uses ',' key first
  440. map <leader>h :wincmd h<CR>
  441. map <leader>j :wincmd j<CR>
  442. map <leader>k :wincmd k<CR>
  443. map <leader>l :wincmd l<CR>
  444. map <leader> <Left> :wincmd h<CR>
  445. map <leader> <Down> :wincmd j<CR>
  446. map <leader> <Up> :wincmd k<CR>
  447. map <leader> <Right> :wincmd l<CR>
  448. """ End Navigate Splits """ }}}
  449. """ Toggle colorcolumn """ {{{
  450. highlight ColorColumn ctermbg=Brown
  451. function! g:ToggleColorColumn()
  452. if &colorcolumn != ''
  453. setlocal colorcolumn&
  454. else
  455. setlocal colorcolumn=77
  456. endif
  457. endfunction
  458. nnoremap <silent> <leader>L :call g:ToggleColorColumn()<CR>
  459. """ End Toggle colorcolumn """ }}}
  460. """ Cross Hairs """ {{{
  461. hi CursorLine cterm=NONE ctermbg=brown ctermfg=white guibg=darkred guifg=white
  462. hi CursorColumn cterm=NONE ctermbg=brown ctermfg=white guibg=darkred guifg=white
  463. nnoremap <Leader>+ :set cursorline! cursorcolumn!<CR>
  464. """ End Cross Hair """ }}}
  465. """ DiffOrig """ {{{
  466. "command DiffOrig let g:diffline = line('.') | vert new | set bt=nofile | r # | 0d_ | diffthis | :exe "norm! ".g:diffline."G" | wincmd p | diffthis | wincmd p
  467. command! DiffOrig let g:diffline = line('.') | vert new | set bt=nofile | r # | 0d_ | diffthis | :exe 'norm! '.g:diffline.'G' | wincmd p | diffthis | wincmd p
  468. nnoremap <Leader>do :DiffOrig<cr>
  469. nnoremap <leader>dc :q<cr>:diffoff<cr>:exe "norm! ".g:diffline."G"<cr>
  470. """ End DiffOrig """ }}}
  471. """ Sudo Save Edit """ {{{
  472. "" Use :W to sudo save, may mess with permissions
  473. command! WW w !sudo tee % > /dev/null
  474. """ End Sudo Save """ }}}
  475. """ Typo Commands """ {{{
  476. "" http://blog.sanctum.geek.nz/vim-command-typos/
  477. if has("user_commands")
  478. command! -bang -nargs=? -complete=file E e<bang> <args>
  479. command! -bang -nargs=? -complete=file W w<bang> <args>
  480. command! -bang -nargs=? -complete=file Wq wq<bang> <args>
  481. command! -bang -nargs=? -complete=file WQ wq<bang> <args>
  482. command! -bang Wa wa<bang>
  483. command! -bang WA wa<bang>
  484. command! -bang Q q<bang>
  485. command! -bang QA qa<bang>
  486. command! -bang Qa qa<bang>
  487. endif
  488. """ End Typo """ }}}
  489. """ End Key Bindings """ }}}
  490. """ Notes To Self """ {{{
  491. "" Consider:
  492. " set foldopen=
  493. """ End Notes """ }}}