Guest User

Untitled

a guest
May 20th, 2018
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.15 KB | None | 0 0
  1. # reset to vim-defaults
  2. if &compatible # only if not set before:
  3. set nocompatible # use vim-defaults instead of vi-defaults (easier, more user friendly)
  4. endif
  5.  
  6. # display settings
  7. set background=dark # enable for dark terminals
  8. set nowrap # dont wrap lines
  9. set scrolloff=2 # 2 lines above/below cursor when scrolling
  10. set number # show line numbers
  11. set showmatch # show matching bracket (briefly jump)
  12. set showmode # show mode in status bar (insert/replace/...)
  13. set showcmd # show typed command in status bar
  14. set ruler # show cursor position in status bar
  15. set title # show file in titlebar
  16. set wildmenu # completion with menu
  17.  
  18. # editor settings
  19. set esckeys # map missed escape sequences (enables keypad keys)
  20. set ignorecase # case insensitive searching
  21. set smartcase # but become case sensitive if you type uppercase characters
  22. set smartindent # smart auto indenting
  23. set smarttab # smart tab handling for indenting
  24. set magic # change the way backslashes are used in search patterns
  25. set bs=indent,eol,start # Allow backspacing over everything in insert mode
  26. set nobackup # no backup~ files.
  27.  
  28. set tabstop=4 # number of spaces a tab counts for
  29. set shiftwidth=4 # spaces for autoindents
  30. #set expandtab # turn a tabs into spaces
  31.  
  32. # misc settings
  33. set fileformat=unix # file mode is unix
  34. #set fileformats=unix,dos # only detect unix file format, displays that ^M with dos files
  35.  
  36. set viminfo='20,"500 # remember copy registers after quitting in the .viminfo file -- 20 jump links, regs up to 500 lines'
  37. set hidden # remember undo after quitting
  38. set history=50 # keep 50 lines of command history
  39.  
  40. set mouse=v # use mouse in visual mode (not normal,insert,command,help mode
  41.  
  42.  
  43. # color settings (if terminal/gui supports it)
  44. if &t_Co > 2 || has("gui_running")
  45. syntax on # enable colors
  46. set hlsearch # highlight search (very useful!)
  47. set incsearch # search incremently (search while typing)
  48. endif
  49.  
  50. # paste mode toggle (needed when using autoindent/smartindent)
  51. map <F10> :set paste<CR>
  52. map <F11> :set nopaste<CR>
  53. imap <F10> <C-O>:set paste<CR>
  54. imap <F11> <nop>
  55. set pastetoggle=<F11>
  56.  
  57. # file type specific settings
  58. if has("autocmd")
  59. # For debugging
  60. #set verbose=9
  61.  
  62. # if bash is sh.
  63. let bash_is_sh=1
  64.  
  65. # change to directory of current file automatically
  66. autocmd BufEnter * lcd %:p:h
  67.  
  68. # Put these in an autocmd group, so that we can delete them easily.
  69. augroup mysettings
  70. au BufReadPre,BufNewFile
  71. *.xsl,*.xml,*.css,*.html,*.js,*.php,*.sql,*.sh,*.conf,*.cc,*.cpp,*.h
  72. set smartindent shiftwidth=2 softtabstop=2 expandtab
  73.  
  74. au BufReadPre,BufNewFile
  75. *.tex
  76. set wrap shiftwidth=2 softtabstop=2 expandtab
  77. augroup END
  78.  
  79. augroup perl
  80. " reset (disable previous 'augroup perl' settings)
  81. au!
  82.  
  83. au BufReadPre,BufNewFile
  84. *.pl,*.pm
  85. set formatoptions=croq smartindent shiftwidth=2 softtabstop=2 cindent cinkeys='0{,0},!^F,o,O,e' " tags=./tags,tags,~/devel/tags,~/devel/C
  86. # formatoption:
  87. # t - wrap text using textwidth
  88. # c - wrap comments using textwidth (and auto insert comment leader)
  89. # r - auto insert comment leader when pressing <return> in insert mode
  90. # o - auto insert comment leader when pressing 'o' or 'O'.
  91. # q - allow formatting of comments with "gq"
  92. # a - auto formatting for paragraphs
  93. # n - auto wrap numbered lists
  94. #
  95. augroup END
  96.  
  97.  
  98. # Always jump to the last known cursor position.
  99. # Don't do it when the position is invalid or when inside
  100. # an event handler (happens when dropping a file on gvim).
  101. autocmd BufReadPost *
  102. if line("'"") > 0 && line("'"") <= line("$") |
  103. exe "normal g`"" |
  104. endif
  105.  
  106. endif # has("autocmd")
  107.  
  108. source /etc/vimrc.local
  109.  
  110. map <silent> <F8> :Explore<CR>
  111. map <silent> <S-F8> :sp +Explore<CR>
  112.  
  113. " delete an un-needed function "
  114. g/someFunction(/ d
  115.  
  116. " add wibble parameter to function foo "
  117. %s/foo(/foo( wibble,/
  118.  
  119. " convert all function calls bar(thing) into method calls thing.bar() "
  120. g/bar(/ normal nmaf(ldi(`aPa.
  121.  
  122. g/bar(/ executes the following command on every line that contains "bar("
  123. normal execute the following text as if it was typed in in normal mode
  124. n goes to the next match of "bar(" (since the :g command leaves the cursor position at the start of the line)
  125. ma saves the cursor position in mark a
  126. f( moves forward to the next opening bracket
  127. l moves right one character, so the cursor is now inside the brackets
  128. di( delete all the text inside the brackets
  129. `a go back to the position saved as mark a (i.e. the first character of "bar")
  130. P paste the deleted text before the current cursor position
  131. a. go into insert mode and add a "."
  132.  
  133. T-O-----C
  134. -E-----S-
  135. --AT--N-L
  136. ---NASO--
  137. ---E-T---
  138. --SPCL---
  139. E-T--OS--
  140. -A-----P-
  141. S-----C-T
  142.  
  143. :!}tr -cd A-Z | sed 's/(.)/1n/g' | sort -u | tr -d 'n'
  144.  
  145. 8-5-----1
  146. -2-----7-
  147. --08--4-3
  148. ---4075--
  149. ---2-8---
  150. --7613---
  151. 2-8--57--
  152. -0-----6-
  153. 7-----1-8
  154.  
  155. :r!cat
  156. **Ctrl-V to paste from the OS clipboard**
  157. ^D
  158.  
  159. :%s
Add Comment
Please, Sign In to add comment