Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- " URL: http://vim.wikia.com/wiki/Example_vimrc
- " Authors: http://vim.wikia.com/wiki/Vim_on_Freenode
- " Description: A minimal, but feature rich, example .vimrc. If you are a
- " newbie, basing your first .vimrc on this file is a good choice.
- " If you're a more advanced user, building your own .vimrc based
- " on this file is still a good idea.
- "------------------------------------------------------------
- " Features {{{1
- "
- " These options and commands enable some very useful features in Vim, that
- " no user should have to live without.
- " Set 'nocompatible' to ward off unexpected things that your distro might
- " have made, as well as sanely reset options when re-sourcing .vimrc
- set nocompatible
- " Attempt to determine the type of a file based on its name and possibly its
- " contents. Use this to allow intelligent auto-indenting for each filetype,
- " and for plugins that are filetype specific.
- filetype indent plugin on
- " Enable syntax highlighting
- syntax on
- "------------------------------------------------------------
- " Must have options {{{1
- "
- " These are highly recommended options.
- " One of the most important options to activate. Allows you to switch from an
- " unsaved buffer without saving it first. Also allows you to keep an undo
- " history for multiple files. Vim will complain if you try to quit without
- " saving, and swap files will keep you safe if your computer crashes.
- set hidden
- " Note that not everyone likes working this way (with the hidden option).
- " Alternatives include using tabs or split windows instead of re-using the same
- " window for multiple buffers, and/or:
- " set confirm
- " set autowriteall
- " Better command-line completion
- set wildmenu
- " Show partial commands in the last line of the screen
- set showcmd
- " Highlight searches (use <C-L> to temporarily turn off highlighting; see the
- " mapping of <C-L> below)
- set hlsearch
- " Use case insensitive search, except when using capital letters
- set ignorecase
- set smartcase
- set wildignorecase
- " Allow backspacing over autoindent, line breaks and start of insert action
- set backspace=indent,eol,start
- " When opening a new line and no filetype-specific indenting is enabled, keep
- " the same indent as the line you're currently on. Useful for READMEs, etc.
- set autoindent
- " Stop certain movements from always going to the first character of a line.
- " While this behaviour deviates from that of Vi, it does what most users
- " coming from other editors would expect.
- set nostartofline
- " Display the cursor position on the last line of the screen or in the status
- " line of a window
- set ruler
- " Always display the status line, even if only one window is displayed
- set laststatus=1
- " Instead of failing a command because of unsaved changes, instead raise a
- " dialogue asking if you wish to save changed files.
- set confirm
- " Use visual bell instead of beeping when doing something wrong
- set visualbell
- " And reset the terminal code for the visual bell. If visualbell is set, and
- " this line is also included, vim will neither flash nor beep. If visualbell
- " is unset, this does nothing.
- set t_vb=
- " Enable use of the mouse for all modes
- set mouse=a
- " Set the command window height to 2 lines, to avoid many cases of having to
- " "press <Enter> to continue"
- set cmdheight=1
- " Display line numbers on the left
- set number
- " Quickly time out on keycodes, but never time out on mappings
- set notimeout ttimeout ttimeoutlen=200
- " Use <F11> to toggle between 'paste' and 'nopaste'
- set pastetoggle=<F11>
- "------------------------------------------------------------
- " Indentation options {{{1
- "
- " Indentation settings according to personal preference.
- " Indentation settings for using 2 spaces instead of tabs.
- " Do not change 'tabstop' from its default value of 8 with this setup.
- set shiftwidth=2
- set softtabstop=2
- set expandtab
- " Indentation settings for using hard tabs for indent. Display tabs as
- " two characters wide.
- set shiftwidth=4
- set tabstop=4
- "------------------------------------------------------------
- " Mappings {{{1
- "
- " Useful mappings
- " Map Y to act like D and C, i.e. to yank until EOL, rather than act as yy,
- " which is the default
- map Y y$
- "------------------------------------------------------------
- " added by Alex
- "
- " do not make equal windows when split
- set noequalalways
- " If in Insert, Replace or Visual mode put a message on the last line.
- set showmode
- " set no wrap text
- set nowrap
- " Change directory to the file directory
- " noremap <S-F5> :cd %:h<CR>
- " split buffer min width is 0
- set wmh=0
- " Automatically cd into the directory that the file is in
- "autocmd BufEnter * execute "chdir ".escape(expand("%:p:h"), ' ')
- " prevent line wrapping
- set tw=0
- " show current line and column number
- set ruler
- " get rid of .swp files
- set noswapfile
- " get rid of tilde (~) files
- set nobackup
- " highlight current line
- :set cursorline
- " menu shell style autocomplete
- set wildmenu
- set wildmode=list:longest
- " use super tab in a reverse order
- let g:SuperTabDefaultCompletionType = "<c-n>"
- "dictionary completion usage: <ctrl><x>+<ctrl><k>
- ":set dictionary=/usr/share/dict/words
- "buffer and tab switching using ctrl + h j k l
- map <C-J> :bnext<CR>
- map <C-K> :bprev<CR>
- map <C-L> :tabn<CR>
- map <C-H> :tabp<CR>
- "remap c-b and c-f to be used as naviate char left/right in command mode
- cnoremap <C-B> <left>
- cnoremap <C-F> <right>
- " map \r to maximize split
- nnoremap <Leader>r :res<CR>
- "------------------------------------------------------------
- " other
- "
- "initate pathogen
- call pathogen#infect()
- "cpp tags
- set nocp
- filetype plugin on
- " change the default supertab key to c-space and c-s-space rather than tab and s-tab
- let g:SuperTabMappingForward = '<c-space>'
- let g:SuperTabMappingBackward = '<s-c-space>'
- " remove the scratch from appearing in the omni cpp completion
- set completeopt=menu
- "" F4: Switch on/off TagList
- "nnoremap <silent> <F4> :TlistToggle<CR>
- " easily close buffer using bbye
- :nnoremap <Leader>q :Bdelete<CR>
- " clear highlight from search
- :nnoremap <Leader>h :nohl<CR>
- " quickly create ctags ctrl-f12
- map <C-F12> :!ctags -R --c++-kinds=+pl --fields=+iaS --extra=+q .<CR>
- " Taglist plugin mapping
- noremap <silent> <Leader>t :TlistToggle<CR>
- " Taglist plugin config
- let Tlist_Use_Right_Window = 1
- let Tlist_Inc_Winwidth = 0
- let Tlist_WinWidth = 45
- let Tlist_GainFocus_On_ToggleOpen= 1
- let Tlist_Ctags_Cmd = 'ctags'
- let Tlist_Show_One_File = 1
- syntax enable
- set background=dark
- colorscheme solarized
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement