Advertisement
Guest User

Dreynsen's additions to a basic .vimrc

a guest
Feb 22nd, 2011
217
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VIM 2.27 KB | None | 0 0
  1. " prevents vim from emulating the original vi's bugs and limitations
  2. set nocompatible               " enabled when (g)vimrc is found
  3.  
  4. set backspace=start,indent,eol " make backspace work like 'normal' text editors
  5. set number                     " show line numbers
  6. set showcmd                    " show the command being typed
  7. set ruler                      " always show current position
  8. set tabstop=4                  " width of a tab character in spaces
  9. set softtabstop=4              " defines number of spaces for when adding/remving tabs
  10. set shiftwidth=4               " number of spaces to use for autoindent
  11. set expandtab                  " use spaces instead of tab characters
  12. set autoindent
  13. set smartindent
  14. set hidden                     " allow buffer to be changed without writing to disk
  15. set showmode                   " If in Insert, Replace or Visual mode put a message on the last line
  16. set wildmenu                   " better command autocompletion
  17. set laststatus=2               " always show statusline
  18.  
  19. " searching related
  20. set incsearch
  21. set hlsearch
  22. set smartcase
  23.  
  24. syntax enable                  " enable syntax highlighting
  25. set t_Co=256                   " use 256 colours in terminal vim
  26.  
  27. filetype plugin indent on      " let vim detect filetype and load appropriate scripts
  28.  
  29. " When editing a file, always jump to the last cursor position
  30. if has("autocmd")
  31.   autocmd BufReadPost *
  32.   \ if line("'\"") > 0 && line ("'\"") <= line("$") |
  33.   \   exe "normal! g'\"" |
  34.   \ endif
  35. endif
  36.  
  37. " Useful default mappings
  38.  
  39. "Change directory to the dir of the current buffer
  40. noremap \cd :cd %:p:h<CR>  
  41.  
  42. " clear highlighting on <esc> press
  43. nnoremap <esc> :noh<return><esc>
  44.  
  45. " Window switching
  46. noremap <c-h> <c-w>h
  47. noremap <c-j> <c-w>j
  48. noremap <c-k> <c-w>k
  49. noremap <c-l> <c-w>l
  50.  
  51. " Make C-BS and C-Del work like they do in most text editors for the sake of muscle memory
  52. imap <C-BS> <C-W>
  53. imap <C-Del> <esc>Ea<C-W>
  54.  
  55. " Windows-like copy/cut/paste mappings
  56. " CTRL-V is Paste in insert mode
  57. imap <C-V>              "+gpa  
  58. " CTRL-C is Copy, CTRL-X is Cut, in visual mode
  59. vmap <C-C>              "+y
  60. vmap <C-x>              "+d
  61. " Use CTRL-Q to do what CTRL-V used to do
  62. noremap <C-Q>           <C-V>
  63.  
  64. " best mapping ever - swap ; and :
  65. noremap ; :
  66. noremap : ;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement