Skip to content

Instantly share code, notes, and snippets.

@mdragon159
Created January 21, 2015 03:01
Show Gist options
  • Save mdragon159/ceac94317c4d60e94b6f to your computer and use it in GitHub Desktop.
Save mdragon159/ceac94317c4d60e94b6f to your computer and use it in GitHub Desktop.
.vimrc Customization File
" Use pathogen to easily modify the runtime path to include all
" plugins under the ~/.vim/bundle directory
call pathogen#helptags()
call pathogen#infect()
" change the mapleader from \ to ,
let mapleader=","
" Quickly edit/reload the vimrc file
nmap <silent> <leader>ev :e $MYVIMRC<CR>
nmap <silent> <leader>sv :so $MYVIMRC<CR>
"One particularly useful setting is hidden. Its name isn’t too descriptive, though. It hides buffers instead of closing them. This means that you can have unwritten changes to a file and open a new file using :e, without being forced to write or undo your changes first. Also, undo buffers and marks are preserved while the buffer is open. This is an absolute must-have.
set hidden
set nowrap " don't wrap lines
set tabstop=4 " a tab is four spaces
set backspace=indent,eol,start
" allow backspacing over everything in insert mode
set autoindent " always set autoindenting on
set copyindent " copy the previous indentation on autoindenting
set number " always show line numbers
set shiftwidth=4 " number of spaces to use for autoindenting
set shiftround " use multiple of shiftwidth when indenting with '<' and '>'
set showmatch " set show matching parenthesis
set ignorecase " ignore case when searching
set smartcase " ignore case if search pattern is all lowercase,
" case-sensitive otherwise
set smarttab " insert tabs on the start of a line according to
" shiftwidth, not tabstop
set hlsearch " highlight search terms
set incsearch " show search matches as you type
set expandtab " always uses spaces instead of tab characters
set history=1000 " remember more commands and search history
set undolevels=1000 " use many muchos levels of undo
set wildignore=*.swp,*.bak,*.pyc,*.class
set title " change the terminal's title
set visualbell " don't beep
set noerrorbells " don't beep
" Vim can detect file types (by their extension, or by peeking inside the file). This enabled Vim to load plugins, settings or key mappings that are only useful in the context of specific file types. For example, a Python syntax checker plugin only makes sense in a Python file. Finally, indenting intelligence is enabled based on the syntax rules for the file type.
filetype plugin indent on
" Ex: To set some file type specific settings, you can now use the following:
" autocmd filetype python set expandtab
" http://nvie.com/posts/how-i-boosted-my-vim/ for more
" Awesome color scheme
if &t_Co >= 256 || has("gui_running")
colorscheme mustang
endif
" Need that syntax highlighting
if &t_Co > 2 || has("gui_running")
" switch syntax highlighting on, when the terminal has colors
syntax on
endif
" This line will make Vim set out tab characters, trailing whitespace and invisible spaces visually, and additionally use the # sign at the end of lines to mark lines that extend off-screen.
set list
set listchars=tab:>.,trail:.,extends:#,nbsp:.
"In some files, like HTML and XML files, tabs are fine and showing them is really annoying, you can disable them easily using an autocmd declaration
autocmd filetype html,xml set listchars-=tab:>.
" For easy, simple, plain pasting use paste mode with F2
set pastetoggle=<F2>
" Enable the mouse
set mouse=a
" It changes behaviour so that it jumps to the next row in the editor (much more natural)
nnoremap j gj
nnoremap k gk
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment