Advertisement
anjishnu

vimrc

Sep 15th, 2011
343
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 6.05 KB | None | 0 0
  1. " Set vim to be nocompatible, so as not to be compatible with vi
  2. " Highly recommended: Has to be the first line.
  3. set nocompatible
  4.  
  5. "" #### ### For Windows Configuration ### ###
  6. ""
  7. " source $VIMRUNTIME/vimrc_example.vim
  8. ""
  9. "" To use the standard MS-Windows way of CTRL-X, CTRL-C and CTRL-V
  10. "" source $VIMRUNTIME/mswin.vim
  11. ""
  12. "" For Cygwin:
  13. "" -----------
  14. "" In order to have bash as the shell for win32 vim.exe and gvim.exe, you have
  15. "" to do the following:
  16. "
  17. "" Download vim-7.0-extra.tar.gz; Extract the file and change directory to
  18. "" src. Build vimrun.exe in the cygwin environment so that the system() call
  19. "" is executed via bash, not cmd.exe. The command to build vimrun.exe for
  20. "" cygwin is
  21. "
  22. " make -f Make_cyg.mak vimrun.exe
  23. "
  24. "" Rename the old vimrun.exe in $VIMRUNTIME to vimrun_cmd.exe,
  25. "" where $VIMRUNTIME is usually C:\Program Files\path-to-vim-exe
  26. "" Copy the newly created vimrun.exe to $VIMRUNTIME\
  27. "
  28. "" Also set these options in vimrc,
  29. " set shell=bash.exe
  30. " set shellcmdflag=-c
  31. " set shellslash
  32. "
  33. " " ### ### ### ###
  34.  
  35. " For user-defined files
  36. " let $VIM = "$HOME/.vim"
  37.  
  38. " To automatically insert a closing parenthesis when typing an opening
  39. " parenthesis
  40. " :inoremap ( ()<ESC>i
  41. " :inoremap { {}<ESC>i
  42. " :inoremap [ []<ESC>i
  43. " :inoremap < <><ESC>i
  44.  
  45. " MATHEMATICA     *mma.vim* *ft-mma-syntax* *ft-mathematica-syntax*
  46. " Empty *.m files will automatically be presumed to be Matlab files unless
  47. " the following line is in .vimrc:
  48. " let filetype_m = "mma"
  49.  
  50. " To set status line
  51. set laststatus=2
  52.  
  53. " let g:ScreenShellExternal=1
  54.  
  55. " When editing a file, always jump to the last known cursor position.
  56. autocmd BufReadPost *
  57.     \ if line("'\"") > 0 && line("'\"") <= line("$") |
  58.     \   exe "normal g`\"" |
  59.     \ endif
  60.  
  61. " For recognizing specific file types
  62. let file_ext = bufname("%")
  63.  
  64. " Wraps line at the 5th column from the right margin and an <EOL> is inserted
  65. if file_ext =~ '\.txt$' || file_ext =~ '\.tex$' " || file_ext =~ '\.bib$' || file_ext =~ '\.sty$'
  66.     set wrapmargin=5
  67. endif
  68.  
  69. " To wrap long lines
  70. set wrap
  71.  
  72. " if file_ext =~ '\.for$' || file_ext =~ '\.f90$' || file_ext =~ '\.f$'
  73. " highlight WhitespaceEOL ctermbg=white guibg=white
  74. " match WhitespaceEOL /^\ \+/
  75. "    highlight RedundantSpaces ctermbg=white guibg=white
  76. "    match RedundantSpaces /\s\+$\| \+\ze\t/
  77. " endif
  78.  
  79. " To handle common typos
  80. command! Q  quit
  81. command! W  write
  82. command! Wq wq
  83. command! WQ wq
  84.  
  85. " Allow backspacing over everything in insert mode
  86. set backspace=indent,eol,start
  87.  
  88. " To getrid of annoying ~ files
  89. set nobackup
  90.  
  91. " To show current mode
  92. set showmode
  93.  
  94. " Show current uncompleted command
  95. " set showcmd
  96.  
  97. " Show line number,column number always
  98. set ruler
  99.  
  100. " Show report when N lines were changed
  101. " report=0 means "show all changes"!
  102. set report=0
  103.  
  104. " Show title of file
  105. set title
  106. " let &titlestring = hostname()
  107. " :auto BufEnter * let &titlestring = hostname() . ":" . expand("%:p")
  108. " set titlestring=%<%F
  109. " let &titlestring = hostname() . ": " . expand("%P")  
  110. " let &titlestring = hostname() . ": " . expand("%F")
  111. " :set titlestring=%t%(\ %M%)%(\ (%{expand(\"%:~:.:h\")})%)%(\ %a%)
  112.  
  113. " Ignore filename with the following suffixes when using :edit or :sp  
  114. set suffixes=.aux,.log,.pdf,.ps,.tar,.gz,.tgz,.dvi,.bbl,.blg,.eps,.out,
  115.     \.png,.los,.lof,.lot,.dat,.sty,.xml,.toc,.latexmain,.bm,.idx,.ilg,.ind,
  116.     \.fdb_latexmk
  117.  
  118. " call scriptmanager#Activate(["vim-addon-mw-utils"])
  119.  
  120. " Allow usage of cursor keys withing insert mode
  121. " set esckeys
  122.  
  123. " Use fast terminal
  124. " set ttyfast
  125. " Don't use fast terminal
  126. " set nottyfast
  127.  
  128. " Auto indent
  129. set autoindent
  130. " Smart indent
  131. set smartindent
  132.  
  133. " To toggle between set number and set nonumber
  134. nmap <C-N> :set number! <CR>
  135. " To actually put line numbers in a file
  136. " :%!cat -n
  137.         " :nmap <A-N> :%!cat -n<CR>
  138. " OR,
  139. " :%! nl -ba
  140.  
  141. " Use mouse in xterm to scroll
  142. " set mouse=n
  143. " 5 lines before and after the current line when scrolling
  144. set scrolloff=5
  145.  
  146. " To ignore case in search pattern
  147. set ignorecase
  148. set smartcase
  149.  
  150. " To incrementally search pattern
  151. set incsearch
  152.  
  153. " No tabs in the source file
  154. " All tab characters are of 4 space characters
  155. set softtabstop=4
  156. set tabstop=4
  157. set shiftwidth=4
  158. set expandtab
  159.  
  160. " Fortran tabs won't be colored red (Have to loaded before "syntax" command)
  161. let fortran_have_tabs=1
  162.  
  163. " Switch on syntax highlighting if it wasn't on yet.
  164. if !exists("syntax_on")
  165.   syntax on
  166. endif
  167.  
  168. " Allow switching buffers, which have unsaved changes
  169. set hidden
  170.  
  171. " Switch on search pattern highlighting.
  172. set hlsearch
  173.  
  174. " To showmatch of '(), {}, []' parenthesis
  175. " inoremap ) )<left><c-o>%<c-o>:sleep 500m<CR><c-o>%<c-o>a
  176. " inoremap } }<left><c-o>%<c-o>:sleep 500m<CR><c-o>%<c-o>a
  177. " inoremap ] ]<left><c-o>%<c-o>:sleep 500m<CR><c-o>%<c-o>a
  178.  
  179. " Show the matching bracket for the last ')'?
  180. " set showmatch        
  181.  
  182. " For filetype plugins
  183. filetype plugin on
  184.  
  185. " Spelling auto correction: Auto correcting typos
  186. iabbr adn and
  187. iabbr nad and
  188. iabbr teh the
  189. iabbr hte the
  190. iabbr alos also
  191. iabbr aslo also
  192. iabbr qed QED
  193. iabbr qcd QCD
  194.  
  195. " " Vim latex suite
  196. " " IMPORTANT: grep will sometimes skip displaying the file name if you
  197. " " search in a singe file. This will confuse Latex-Suite. Set your grep
  198. " " program to always generate a file-name.
  199. " set grepprg=grep\ -nH\ $*
  200. "
  201. " " OPTIONAL: This enables automatic indentation as you type.
  202. " " filetype indent on
  203. "
  204. " " OPTIONAL: Starting with Vim 7, the filetype of empty .tex files defaults to
  205. " " 'plaintex' instead of 'tex', which results in vim-latex not being loaded.
  206. " " The following changes the default filetype back to 'tex':
  207. " let g:tex_flavor='latex'
  208. "
  209. " let g:Tex_Folding=0
  210. " let g:Tex_DefaultTargetFormat='pdf'
  211. " let g:Tex_UseEditorSettingInDVIViewer = 1
  212. " let g:Tex_ViewRule_pdf = 'okular'
  213. " let g:Tex_ViewRule_dvi = 'okular'
  214. " let g:Tex_ViewRule_ps  = 'okular'
  215. " let g:Tex_CompileRule_pdf = 'pdflatex -synctex=1 -interaction=nonstopmode $*'
  216. " let g:Tex_FormatDependency_ps  = 'dvi,ps'
  217. " let g:Tex_FormatDependency_pspdf = 'dvi,ps,pspdf'
  218. " let g:Tex_FormatDependency_dvipdf = 'dvi,dvipdf'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement