Advertisement
TankorSmash

_vimrc

Apr 8th, 2013
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 8.11 KB | None | 0 0
  1. filetype off
  2.  
  3. "
  4. "     surrounds a TraceLine with a Verbose check
  5. "     '<,'>g/TraceLine/-1s/^.*$/&\rif (verbose){/ | +2s/^.*$/}\r&/
  6. "
  7. "
  8. " set the starting path
  9. cd c:\Users\Mark\Documents\Visual\ Studio\ 2008\Projects\
  10.  
  11. source $VIMRUNTIME/vimrc_example.vim
  12. source $VIMRUNTIME/mswin.vim
  13. behave mswin
  14. set nocompatible
  15. " changes it so the mouse starts Visual mode not Select mode
  16. set selectmode="key"
  17. " make i_^y do what it is supposed to do
  18. inoremap <c-Y> <c-Y>
  19. " make Y act similar to D or C in that it yanks to end of line
  20. noremap Y y$
  21.  
  22.  
  23.  
  24.  
  25.  
  26.  
  27. "My Custom vimrc stuff
  28. "
  29. "PLugins I've got so far: tcomment, NerdTree, colorschemes from vim.org
  30. " Pathogen, autocorrect, sparkup, vim-taglist, ctags, surround, matching
  31. "
  32. "retab
  33. "
  34. set relativenumber
  35.  
  36. set autoread
  37. set ignorecase
  38. set smartcase
  39. set gdefault
  40. set nohlsearch
  41. set visualbell
  42.  
  43. set lazyredraw
  44.  
  45.  
  46. set nowrap
  47.  
  48. "gui stuff, last one is the default
  49. set guioptions=ac
  50. "set guioptions=egmrLtT
  51.  
  52. set thesaurus+=C:\Users\Mark\Documents\Thesaurus\mthesaur.txt
  53.  
  54. " filetype plugin indent on
  55. filetype plugin on
  56. filetype indent on
  57.  
  58. set cursorline
  59.  
  60. set expandtab
  61. set tabstop=4
  62. set softtabstop=4
  63. set shiftwidth=4
  64. " set smartindent
  65. set autoindent
  66. set textwidth=80
  67.  
  68. " allow editing virtual space only in blocks
  69. set virtualedit=block
  70.  
  71. "draws the line on the textwidth line
  72. set colorcolumn=+1
  73.  
  74. " Allows for undo history after close
  75. set undofile
  76.  
  77. "history edits
  78. set history=1000
  79. set undolevels=1000
  80.  
  81. "ignores certain files for tab completion
  82. set wildignore=*.swp,*.png,*.cd,*.ico,*.jpg,*.ico,*.cs~,*.txt~,*.py~
  83. "
  84. " Allows for having files offscreen without saving first
  85. set hidden
  86.  
  87. " allows for crazy tab menu
  88. set wildmenu
  89.  
  90. " font size
  91. " set guifont=:h20
  92. set guifont=Consolas:h14
  93. " set guifont="Consolas for Powerline/CONSOLAS-Powerline":h15
  94. colorscheme vividchalk
  95.  
  96.  
  97. let g:buftabs_only_basename=1
  98.  
  99. " " " "pathogen "  "  "
  100. call pathogen#infect()
  101. call pathogen#helptags()
  102.  
  103. " " " " Taglist variables "  "  "  
  104.  
  105. let Tlist_Ctags_Cmd = shellescape('E:\Program Files (x86)\Vim\ctags\ctags58\ctags.exe')
  106. map <F4> :TlistToggle<cr>
  107.  
  108. " Display function name in status bar:
  109. let g:ctags_statusline=1
  110. " Automatically start script
  111. let generate_tags=1
  112. " Displays taglist results in a vertical window:
  113. let Tlist_Use_Horiz_Window=0
  114. " Shorter commands to toggle Taglist display
  115. nnoremap TT :TlistToggle<CR>
  116. map <F4> :TlistToggle<CR>
  117. " Various Taglist diplay config:
  118. let Tlist_Use_Right_Window = 1
  119. let Tlist_Compact_Format = 1
  120. let Tlist_Exit_OnlyWindow = 1
  121. let Tlist_GainFocus_On_ToggleOpen = 1
  122. let Tlist_File_Fold_Auto_Close = 1
  123. let Tlist_WinWidth = 40
  124.  
  125.  
  126. " NERDtree stuff
  127. let NERDTreeIgnore=['\.jpg$','\.png$','\.ico$','\.csproj$',    '\.user$', '\.cachefile$','\.cd$','\.jpeg$',   '\.pyc$', '\~$']
  128. noremap <f3> :NERDTreeToggle<cr>
  129.  
  130. " MRU plugin
  131. let MRU_Max_Entries = 1000
  132.  
  133. "full screen
  134. " map <F11> <Esc>:call libcallnr("gvimfullscreen.dll", "ToggleFullScreen", 0)<CR>
  135. map <F11> :simalt ~x<cr>
  136.  
  137. "hard mode for insert mode
  138. inoremap <Esc> <Nop>
  139. inoremap <Backspace> <Nop>
  140. inoremap <c-b> <Del>
  141.  
  142. inoremap ^c <Esc>
  143. vnoremap ^c <Esc>
  144. nnoremap ^c <Esc>
  145.  
  146.  
  147. "change leader key
  148. let mapleader = ","
  149.  
  150. "map keys for next and prev buffer
  151. noremap <Leader>n :bn<cr>
  152. noremap <Leader>p :bp<cr>
  153. noremap <Leader>d :pwd<cr>
  154.  
  155. noremap <Leader>c :lcd %:p:h
  156. noremap <Leader>l :ls<cr>
  157.  
  158. "map keys for running current file in Python
  159. noremap <Leader>z :!python %
  160. noremap <Leader>c :e $myvimrc
  161. noremap <Leader>a :MRU
  162.  
  163. "make it so ,s and ,S enable or disable smart indent
  164. noremap <Leader>s :set nosmartindent<cr>
  165. noremap <Leader>S :set smartindent<cr>
  166.  
  167.  
  168. noremap <Leader>l :ls<cr>
  169. " override windows redo, back to scroll up.
  170. noremap <c-y> <c-y>
  171.  
  172. " map f8 to edit vimrc, but removed because I don't like the F keys
  173. " noremap <F8> :e $myvimrc\
  174. " noremap <F6> :MRU\
  175.  
  176. " noremap <F7> :!python %\
  177.  
  178.  
  179. "makes the cmdline 2 lines high. need to do this for the sake of avoiding
  180. " \"PRESS ENTER TO CONTINUE"
  181. set cmdheight=2
  182.  
  183.  
  184. " sets spell on if it's a .txt file
  185. au BufNewFile,BufRead *.txt set spell  
  186. " sets the cwd to current directory
  187. autocmd BufEnter * silent! lcd %:p:h
  188.  
  189. "end custom
  190.  
  191. set diffexpr=MyDiff()
  192. function MyDiff()
  193.   let opt = '-a --binary '
  194.   if &diffopt =~ 'icase' | let opt = opt . '-i ' | endif
  195.   if &diffopt =~ 'iwhite' | let opt = opt . '-b ' | endif
  196.   let arg1 = v:fname_in
  197.   if arg1 =~ ' ' | let arg1 = '"' . arg1 . '"' | endif
  198.   let arg2 = v:fname_new
  199.   if arg2 =~ ' ' | let arg2 = '"' . arg2 . '"' | endif
  200.   let arg3 = v:fname_out
  201.   if arg3 =~ ' ' | let arg3 = '"' . arg3 . '"' | endif
  202.   let eq = ''
  203.   if $VIMRUNTIME =~ ' '
  204.     if &sh =~ '\<cmd'
  205.       let cmd = '""' . $VIMRUNTIME . '\diff"'
  206.       let eq = '"'
  207.     else
  208.       let cmd = substitute($VIMRUNTIME, ' ', '" ', '') . '\diff"'
  209.     endif
  210.   else
  211.     let cmd = $VIMRUNTIME . '\diff'
  212.   endif
  213.   silent execute '!' . cmd . ' ' . opt . arg1 . ' ' . arg2 . ' > ' . arg3 . eq
  214. endfunction
  215.  
  216. "here is a more exotic version of my original Kwbd script
  217. "delete the buffer; keep windows; create a scratch buffer if no buffers left
  218. function s:Kwbd(kwbdStage)
  219.   if(a:kwbdStage == 1)
  220.     if(!buflisted(winbufnr(0)))
  221.       bd!
  222.       return
  223.     endif
  224.     let s:kwbdBufNum = bufnr("%")
  225.     let s:kwbdWinNum = winnr()
  226.     windo call s:Kwbd(2)
  227.     execute s:kwbdWinNum . 'wincmd w'
  228.     let s:buflistedLeft = 0
  229.     let s:bufFinalJump = 0
  230.     let l:nBufs = bufnr("$")
  231.     let l:i = 1
  232.     while(l:i <= l:nBufs)
  233.       if(l:i != s:kwbdBufNum)
  234.         if(buflisted(l:i))
  235.           let s:buflistedLeft = s:buflistedLeft + 1
  236.         else
  237.           if(bufexists(l:i) && !strlen(bufname(l:i)) && !s:bufFinalJump)
  238.             let s:bufFinalJump = l:i
  239.           endif
  240.         endif
  241.       endif
  242.       let l:i = l:i + 1
  243.     endwhile
  244.     if(!s:buflistedLeft)
  245.       if(s:bufFinalJump)
  246.         windo if(buflisted(winbufnr(0))) | execute "b! " . s:bufFinalJump | endif
  247.       else
  248.         enew
  249.         let l:newBuf = bufnr("%")
  250.         windo if(buflisted(winbufnr(0))) | execute "b! " . l:newBuf | endif
  251.       endif
  252.       execute s:kwbdWinNum . 'wincmd w'
  253.     endif
  254.     if(buflisted(s:kwbdBufNum) || s:kwbdBufNum == bufnr("%"))
  255.       execute "bd! " . s:kwbdBufNum
  256.     endif
  257.     if(!s:buflistedLeft)
  258.       set buflisted
  259.       set bufhidden=delete
  260.       set buftype=
  261.       setlocal noswapfile
  262.     endif
  263.   else
  264.     if(bufnr("%") == s:kwbdBufNum)
  265.       let prevbufvar = bufnr("#")
  266.       if(prevbufvar > 0 && buflisted(prevbufvar) && prevbufvar != s:kwbdBufNum)
  267.         b #
  268.       else
  269.         bn
  270.       endif
  271.     endif
  272.   endif
  273. endfunction
  274.  
  275. command! Kwbd call s:Kwbd(1)
  276. nnoremap <silent> <Plug>Kwbd :<C-u>Kwbd<CR>
  277.  
  278. " Create a mapping (e.g. in your .vimrc) like this:
  279. nmap <f2> <Plug>Kwbd
  280.  
  281.  
  282. if has("gui_running")
  283.   " GUI is running or is about to start.
  284.   " Maximize gvim window.
  285.   set lines=999 columns=999
  286. else
  287.   " This is console Vim.
  288.   if exists("+lines")
  289.     set lines=50
  290.   endif
  291.   if exists("+columns")
  292.     set columns=100
  293.   endif
  294. endif
  295.  
  296. "powerline stuff
  297. set laststatus=2
  298. set encoding=utf-8 " Necessary to show Unicode glyphs
  299. let g:Powerline_symbols = 'compatible'
  300. "let g:Powerline_symbols = 'fancy'
  301. "let g:Powerline_symbols = 'unicode'
  302.  
  303. " Overriding symbols
  304. let g:Powerline_symbols_override = {
  305.     \   'BRANCH': [0x2b60]
  306.     \ , 'RO'    : [0x2b64]
  307.     \ , 'FT'    : [0x2b62, 0x2b63]
  308.     \ , 'LINE'  : [0x2b61]
  309. \}
  310. " Overriding dividers
  311. let g:Powerline_dividers_override = ['', [0x2b81], '', [0x2b83]]
  312.  
  313.  
  314. " custom build files for Orchid
  315. let &makeprg='"C:\Users\Mark\Documents\Visual Studio 2010\Projects\Orchid\Orchid\Orchid\build.bat"'
  316. set errorformat=\ %#%f(%l\\\,%c):\ %m
  317.  
  318. " for switching case of text in visual mode
  319. function! TwiddleCase(str)
  320.   if a:str ==# toupper(a:str)
  321.     let result = tolower(a:str)
  322.   elseif a:str ==# tolower(a:str)
  323.     let result = substitute(a:str,'\(\<\w\+\>\)', '\u\1', 'g')
  324.   else
  325.     let result = toupper(a:str)
  326.   endif
  327.   return result
  328. endfunction
  329. vnoremap ~ ygv"=TwiddleCase(@")<CR>Pgv
  330.  
  331.  
  332.  
  333. " go fullscreen
  334. simalt ~x<cr>
  335. au GUIEnter * simalt ~x
  336.  
  337. " python-mode stuff
  338. let g:pymode_doc_key = '<Leader><Leader>a'
  339. let g:pymode_folding = 0
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement