Guest User

Untitled

a guest
Apr 26th, 2018
241
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 9.51 KB | None | 0 0
  1. " ===========================================================================
  2. " General settings
  3. " ===========================================================================
  4.  
  5. set nu
  6. set ic
  7. set ai
  8. set ruler
  9. set bs=2
  10. set shiftwidth=4
  11. set softtabstop=4
  12. set smarttab
  13. set laststatus=2
  14. set showmatch
  15. set expandtab
  16. set visualbell
  17. set incsearch
  18. set hlsearch
  19. set nocompatible
  20.  
  21. syntax on
  22. filetype on
  23. filetype plugin on
  24. filetype indent on
  25. filetype plugin indent on
  26. syntax sync fromstart
  27.  
  28. let mapleader = ","
  29. map <silent> <leader>x :x<cr>
  30. map <silent> <leader>q :q<cr>
  31.  
  32. "set wildmode=full,list
  33. "set wildmode=list:full
  34. set wildmode=longest,list
  35. set wildignore+=*.o,*.a,*.so,*.obj,*.exe,*.lib,*.ncb,*.opt,*.plg,.svn,.git
  36.  
  37. " on/off in corbasic
  38. vmap n :s/\%VOFF /ON /i<cr>
  39. vmap f :s/\%VON /OFF /i<cr>
  40.  
  41. " indent
  42. nmap <tab> V>
  43. nmap <s-tab> V<
  44. xmap <tab> >gv
  45. xmap <s-tab> <gv
  46.  
  47. " folding
  48. au FileType c FoldMatching #ifdef\ DEBUG #endif 0
  49.  
  50. " vimrc
  51. if has("gui_running")
  52. autocmd! bufwritepost .vimrc source ~/.gvimrc
  53. else
  54. autocmd! bufwritepost .vimrc source ~/.vimrc
  55. endif
  56.  
  57. " move to next/previous the same indent
  58. nn <M-,> k:call search ("^". matchstr (getline (line (".")+ 1), '\(\s*\)') ."\\S", 'b')<CR>^
  59. nn <M-.> :call search ("^". matchstr (getline (line (".")), '\(\s*\)') ."\\S")<CR>^
  60.  
  61. " grep
  62. command! GT :execute 'vimgrep '.expand('<cword>').' '.expand('%') | :copen | :cc
  63. command! GTA :execute 'vimgrep '.expand('<cword>').' '.expand('%:p:h').'/*' | :copen | :cc
  64. command! GA :execute 'vimgrep '.expand('<cword>').' '.'*' | :copen | :cc
  65.  
  66. " ===========================================================================
  67. " Toogle quickfix window
  68. " ===========================================================================
  69. "
  70. com! -bang -nargs=? QFix cal QFixToggle(<bang>0)
  71. fu! QFixToggle(forced)
  72. if exists("g:qfix_win") && a:forced == 0
  73. cclose
  74. unlet g:qfix_win
  75. else
  76. copen 10
  77. let g:qfix_win = bufnr("$")
  78. en
  79. endf
  80. nn <leader>qf :QFix<cr>
  81.  
  82. " ===========================================================================
  83. " GUI related
  84. " ===========================================================================
  85.  
  86. colo metacosm
  87. hi Search term=reverse cterm=bold ctermbg=12 gui=bold guifg=white guibg=red
  88.  
  89. set guioptions-=T "no toolbar
  90. set guioptions+=l "left scroll bar
  91. set guioptions-=e "no gui mode tab
  92. set guioptions+=c "use console dialogs
  93. set guioptions+=M "menu.vim isn't soured
  94.  
  95. " ===========================================================================
  96. " Userful commands
  97. " ===========================================================================
  98. " :h pattern
  99. " :TOhtml
  100. " :set ff=unix
  101. " <C-W>s => horizontal split
  102. " <C-W>[+|-] => resize h-split
  103. " <C-W>v => vertical split
  104. " <C-W>[<|>] => resize h-split
  105. " <C-W>o => close all except current one
  106. " <C-W>n => new file in split window
  107. " <C-W><C-W> => next window
  108. " copen => open quickfix window
  109. " cclose => close quickfix window
  110. " :so % to extract it => extract vim ball
  111.  
  112. " ===========================================================================
  113. " Plugins
  114. " ===========================================================================
  115.  
  116. " --------------------------
  117. " shellinsidevim.vim
  118. " --------------------------
  119. map <CR> :Shell
  120. let g:ShowOutputWindowWhenVimLaunched=0
  121.  
  122. " --------------------------
  123. " mru.vim
  124. " --------------------------
  125. map <silent> <leader>m :MRU<cr>
  126. let MRU_Max_Entries = 20
  127.  
  128. " --------------------------
  129. " vimbuddy.vim
  130. " --------------------------
  131. " can't use with search complete together
  132. " set statusline=%{VimBuddy()}\ %F%m%r%h%w\ [%{&ff}]\ [%Y]
  133.  
  134. " --------------------------
  135. " ZoomWin
  136. " --------------------------
  137. " <C-W> z => toggle single window <=> multiple windows
  138. map <silent> <leader>z :ZoomWin<cr>
  139.  
  140. " --------------------------
  141. " SearchComplete
  142. " --------------------------
  143. " search something then presss tab
  144.  
  145. " --------------------------
  146. " yankring
  147. " --------------------------
  148. " :YRShow
  149. " h yankring.txt
  150. map <silent> <leader>y :YRShow<cr>
  151. let g:yankring_history_file = '.vim/.yankring_history'
  152.  
  153. " --------------------------
  154. " timestamp.vim
  155. " --------------------------
  156. " add
  157. " Created: uc(timestamp)
  158. " Modifed: uc(timestamp)
  159. " in the file then save it
  160. let g:timestamp_regexp = '\v\C%(<%(Last%([cC]hanged?|modified)|Modified|MODIFIED)\s*: )@<=.*$|TIMESTAMP'
  161. "let g:timestamp_rep = '%w %d/%m/%Y %H:%M:%S #u@#h:#f'
  162. map <silent> <leader>ts :r ~/.vim/plugin/timestamp.template<cr>
  163.  
  164. " --------------------------
  165. " GetLastestVimScripts
  166. " --------------------------
  167. " modified GetLastestVimScripts.dat and then
  168. " :GetLastestVimScripts
  169.  
  170. " --------------------------
  171. " minibufexpl.vim
  172. " --------------------------
  173. " <C-Tab>
  174. let g:miniBufExplMapWindowNavVim = 1
  175. let g:miniBufExplMapWindowNavArrows = 1
  176. let g:miniBufExplMapCTabSwitchBufs = 1
  177. let g:miniBufExplModSelTarget = 1
  178.  
  179. " --------------------------
  180. " tabbar
  181. " --------------------------
  182. " <C-Tab>
  183. " <A-#>: minibufexpl.vim doesn't have!
  184. map <silent> <leader>b :TbToggle<cr>
  185.  
  186. " --------------------------
  187. " bufexplorer
  188. " --------------------------
  189. " ,be => open BufExplorer
  190. " ,bs => open in split window
  191. " ,bv => open in vertical split window
  192.  
  193. " --------------------------
  194. " DrawIt!
  195. " --------------------------
  196. " ,di to start
  197. " ,ds to stop
  198. " :h drawit
  199.  
  200. " --------------------------
  201. " utl
  202. " --------------------------
  203. " :h utl-start
  204.  
  205. " --------------------------
  206. " NERD tree
  207. " --------------------------
  208. map <silent> <leader>n :NERDTreeToggle<cr>
  209.  
  210. " --------------------------
  211. " NERD Commenter
  212. " --------------------------
  213. " ,c<space> => NERDComToggleComment
  214.  
  215. " --------------------------
  216. " taglist
  217. " --------------------------
  218. map <silent> <leader>t :TlistToggle<cr>
  219. let tlist_corbasic_settings = 'corbasic;o:io;T:topcells;t:template_blocks;c:corbasic;p:python_modules;f:functions;F:files;g:groups;G:globals;i:includes'
  220. let Tlist_WinWidth = 27
  221.  
  222. " --------------------------
  223. " calendar
  224. " --------------------------
  225. let g:calendar_diary = '~/.vim/diary'
  226. map <silent> <leader>c :Calendar<cr>
  227. map <silent> <leader>ch :CalendarH<cr>
  228.  
  229. " --------------------------
  230. " project
  231. " --------------------------
  232. " :h project
  233. " \c create new project
  234. " \C create new project, recursively
  235. map <silent> <Leader>p <Plug>ToggleProject
  236. let g:proj_window_width = 30
  237. let g:proj_window_increment = 50
  238.  
  239. " --------------------------
  240. " fuzzyfinder
  241. " --------------------------
  242. " :h fuzzyfinder
  243. nnoremap <Leader>ff :FuzzyFinderFile! <CR>
  244. nnoremap <Leader>fd :FuzzyFinderDir! <CR>
  245. nnoremap <Leader>fb :FuzzyFinderBuffer! <CR>
  246. nnoremap <Leader>fm :FuzzyFinderMruFile! <CR>
  247. nnoremap <Leader>ft :FuzzyFinderTag! <CR>
  248.  
  249. " --------------------------
  250. " MultipleSearch
  251. " --------------------------
  252. " :Search <pattern>
  253. map <silent> <Leader>sr :SearchReset<cr>
  254.  
  255. " --------------------------
  256. " Align
  257. " --------------------------
  258. " :h align.txt
  259. " ,tsp => align by space
  260.  
  261. " --------------------------
  262. " DiffDir
  263. " --------------------------
  264. " :DiffDir dir-a dir-b
  265.  
  266. " --------------------------
  267. " grep.vim
  268. " --------------------------
  269. " :Grep
  270.  
  271. " --------------------------
  272. " vimcommander.vim
  273. " --------------------------
  274. map <silent> <Leader>vc :cal VimCommanderToggle()<cr>
  275.  
  276. " --------------------------
  277. " perl-support.vim
  278. " --------------------------
  279. let g:Perl_PerlcriticSeverity = 1
  280. map <leader>pc :call Perl_Perlcritic()<cr>:redraw<cr>
  281.  
  282. " --------------------------
  283. " snippetsEmu
  284. " --------------------------
  285. let g:snip_start_tag = "«"
  286. let g:snip_end_tag = "»"
  287.  
  288. " --------------------------
  289. " snippetsEmu
  290. " --------------------------
  291.  
  292. let g:Lua_AuthorName = 'Yen-Liang Chen'
  293. let g:Lua_Email = 'ylchenzr@tsmc.com'
  294. let g:Lua_Company = 'TSMC'
  295.  
  296.  
  297. "source /ban/ylchenzr/.vim/.vimrc.copyright
  298.  
  299. " ===========================================================================
  300. " Best Vim Tips
  301. " ===========================================================================
  302.  
  303. " --------------------------
  304. " Exploring
  305. " --------------------------
  306. " :Ex : file explorer note capital Ex
  307. " \be : builtin buffer explorer
  308. " :ls : list of buffers(eg following)
  309. " :cd .. : move to parent directory
  310.  
  311. " --------------------------
  312. " Great
  313. " --------------------------
  314. " guu : lowercase line
  315. " gUU : uppercase line
  316. " ~ : invert case (upper->lower; lower->upper) of current character
  317. " gf : open file name under cursor (SUPER)
  318. " ga : display hex, ascii value of character under cursor
  319. " ggg?G : rot13 whole file
  320. " xp : swap next two characters around
  321. " CTRL-A,CTRL-X : increment, decrement next number on same line as the cursor
  322. " CTRL-R=5*5 : insert 25 into text
  323. " = : (re)indent the text on the current line or on the area selected (SUPER)
  324.  
  325. " --------------------------
  326. " Recording (BEST TIP of ALL)
  327. " --------------------------
  328. " qq : record keystrokes to register q
  329. " your commands
  330. " q : quit recording
  331. " @q : execute commands again
  332. " @@ : repeat
  333. " # editing a register/recording
  334. " "qp
  335. " <you can now see register contents, edit as required>
  336. " "add
  337. " @a
  338. " :%normal @q #execute the macro recorded in register q on all lines of the current file.
  339. " #or, with a visually selected set of lines:
  340. " :normal @q
  341.  
  342. " --------------------------
  343. " Global command
  344. " --------------------------
  345. " :g/^\s*$/d : delete all blank lines
  346. " :g!/^dd/d : delete lines not containing string
  347. " :v/^dd/d : delete lines not containing string
  348. " :g/fred/,/joe/d : not line based
  349. " :v/./.,/./-1join : compress empty lines
  350. " :'a,'b g/^Error/ . w >> errors.txt
  351. " :g/cmap\|form/p : ORing
Add Comment
Please, Sign In to add comment