Advertisement
Guest User

Untitled

a guest
Apr 12th, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 6.56 KB | None | 0 0
  1. " URL: http://vim.wikia.com/wiki/Example_vimrc
  2. " Authors: http://vim.wikia.com/wiki/Vim_on_Freenode
  3. " Description: A minimal, but feature rich, example .vimrc. If you are a
  4. "              newbie, basing your first .vimrc on this file is a good choice.
  5. "              If you're a more advanced user, building your own .vimrc based
  6. "              on this file is still a good idea.
  7.  
  8. "------------------------------------------------------------
  9. " Features {{{1
  10. "
  11. " These options and commands enable some very useful features in Vim, that
  12. " no user should have to live without.
  13.  
  14. " Set 'nocompatible' to ward off unexpected things that your distro might
  15. " have made, as well as sanely reset options when re-sourcing .vimrc
  16. set nocompatible
  17.  
  18. " Attempt to determine the type of a file based on its name and possibly its
  19. " contents. Use this to allow intelligent auto-indenting for each filetype,
  20. " and for plugins that are filetype specific.
  21. filetype indent plugin on
  22.  
  23. " Enable syntax highlighting
  24. syntax on
  25.  
  26.  
  27. "------------------------------------------------------------
  28. " Must have options {{{1
  29. "
  30. " These are highly recommended options.
  31.  
  32. " One of the most important options to activate. Allows you to switch from an
  33. " unsaved buffer without saving it first. Also allows you to keep an undo
  34. " history for multiple files. Vim will complain if you try to quit without
  35. " saving, and swap files will keep you safe if your computer crashes.
  36. set hidden
  37.  
  38. " Note that not everyone likes working this way (with the hidden option).
  39. " Alternatives include using tabs or split windows instead of re-using the same
  40. " window for multiple buffers, and/or:
  41. " set confirm
  42. " set autowriteall
  43.  
  44. " Better command-line completion
  45. set wildmenu
  46.  
  47. " Show partial commands in the last line of the screen
  48. set showcmd
  49.  
  50. " Highlight searches (use <C-L> to temporarily turn off highlighting; see the
  51. " mapping of <C-L> below)
  52. set hlsearch
  53.  
  54.  
  55. " Use case insensitive search, except when using capital letters
  56. set ignorecase
  57. set smartcase
  58. set wildignorecase
  59.  
  60. " Allow backspacing over autoindent, line breaks and start of insert action
  61. set backspace=indent,eol,start
  62.  
  63. " When opening a new line and no filetype-specific indenting is enabled, keep
  64. " the same indent as the line you're currently on. Useful for READMEs, etc.
  65. set autoindent
  66.  
  67. " Stop certain movements from always going to the first character of a line.
  68. " While this behaviour deviates from that of Vi, it does what most users
  69. " coming from other editors would expect.
  70. set nostartofline
  71.  
  72. " Display the cursor position on the last line of the screen or in the status
  73. " line of a window
  74. set ruler
  75.  
  76. " Always display the status line, even if only one window is displayed
  77. set laststatus=1
  78.  
  79. " Instead of failing a command because of unsaved changes, instead raise a
  80. " dialogue asking if you wish to save changed files.
  81. set confirm
  82.  
  83. " Use visual bell instead of beeping when doing something wrong
  84. set visualbell
  85.  
  86. " And reset the terminal code for the visual bell. If visualbell is set, and
  87. " this line is also included, vim will neither flash nor beep. If visualbell
  88. " is unset, this does nothing.
  89. set t_vb=
  90.  
  91. " Enable use of the mouse for all modes
  92. set mouse=a
  93.  
  94. " Set the command window height to 2 lines, to avoid many cases of having to
  95. " "press <Enter> to continue"
  96. set cmdheight=1
  97.  
  98. " Display line numbers on the left
  99. set number
  100.  
  101. " Quickly time out on keycodes, but never time out on mappings
  102. set notimeout ttimeout ttimeoutlen=200
  103.  
  104. " Use <F11> to toggle between 'paste' and 'nopaste'
  105. set pastetoggle=<F11>
  106.  
  107.  
  108. "------------------------------------------------------------
  109. " Indentation options {{{1
  110. "
  111. " Indentation settings according to personal preference.
  112.  
  113. " Indentation settings for using 2 spaces instead of tabs.
  114. " Do not change 'tabstop' from its default value of 8 with this setup.
  115. set shiftwidth=2
  116. set softtabstop=2
  117. set expandtab
  118.  
  119. " Indentation settings for using hard tabs for indent. Display tabs as
  120. " two characters wide.
  121. set shiftwidth=4
  122. set tabstop=4
  123.  
  124.  
  125. "------------------------------------------------------------
  126. " Mappings {{{1
  127. "
  128. " Useful mappings
  129.  
  130. " Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy,
  131. " which is the default
  132. map Y y$
  133.  
  134.  
  135. "------------------------------------------------------------
  136. " added by Alex
  137. "
  138.  
  139. " do not make equal windows when split
  140. set noequalalways
  141.  
  142. " If in Insert, Replace or Visual mode put a message on the last line.
  143. set showmode
  144.  
  145. " set no wrap text
  146. set nowrap
  147.  
  148. " Change directory to the file directory
  149. " noremap <S-F5> :cd %:h<CR>
  150.  
  151. " split buffer min width is 0
  152. set wmh=0
  153.  
  154. " Automatically cd into the directory that the file is in
  155. "autocmd BufEnter * execute "chdir ".escape(expand("%:p:h"), ' ')
  156.  
  157. " prevent line wrapping
  158. set tw=0
  159.  
  160. " show current line and column number
  161. set ruler
  162.  
  163. " get rid of .swp files
  164. set noswapfile
  165. " get rid of tilde (~) files
  166. set nobackup
  167.  
  168. " highlight current line
  169. :set cursorline
  170.  
  171. " menu shell style autocomplete
  172. set wildmenu
  173. set wildmode=list:longest
  174.  
  175. " use super tab in a reverse order
  176. let g:SuperTabDefaultCompletionType = "<c-n>"
  177.  
  178. "dictionary completion usage: <ctrl><x>+<ctrl><k>
  179. ":set dictionary=/usr/share/dict/words
  180.  
  181. "buffer and tab switching using ctrl + h j k l
  182. map <C-J> :bnext<CR>
  183. map <C-K> :bprev<CR>
  184. map <C-L> :tabn<CR>
  185. map <C-H> :tabp<CR>
  186.  
  187. "remap c-b and c-f to be used as naviate char left/right in command mode
  188. cnoremap <C-B> <left>
  189. cnoremap <C-F> <right>
  190.  
  191. " map \r to maximize split
  192. nnoremap <Leader>r :res<CR>
  193. "------------------------------------------------------------
  194. " other
  195. "
  196.  
  197. "initate pathogen
  198. call pathogen#infect()
  199.  
  200. "cpp tags
  201. set nocp
  202. filetype plugin on
  203.  
  204. " change the default supertab key to c-space and c-s-space rather than tab and s-tab
  205. let g:SuperTabMappingForward = '<c-space>'
  206. let g:SuperTabMappingBackward = '<s-c-space>'
  207.  
  208. " remove the scratch from appearing in the omni cpp completion
  209. set completeopt=menu
  210.  
  211. "" F4: Switch on/off TagList
  212. "nnoremap <silent> <F4> :TlistToggle<CR>
  213.  
  214. " easily close buffer using bbye
  215. :nnoremap <Leader>q :Bdelete<CR>
  216.  
  217. " clear highlight from search
  218. :nnoremap <Leader>h :nohl<CR>
  219.  
  220. " quickly create ctags ctrl-f12
  221. map <C-F12> :!ctags -R --c++-kinds=+pl --fields=+iaS --extra=+q .<CR>
  222.  
  223. " Taglist plugin mapping
  224. noremap <silent> <Leader>t :TlistToggle<CR>
  225.  
  226. " Taglist plugin config
  227. let Tlist_Use_Right_Window = 1
  228. let Tlist_Inc_Winwidth = 0
  229. let Tlist_WinWidth = 45
  230. let Tlist_GainFocus_On_ToggleOpen= 1
  231. let Tlist_Ctags_Cmd = 'ctags'
  232. let Tlist_Show_One_File = 1
  233.  
  234. syntax enable
  235. set background=dark
  236. colorscheme solarized
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement