Skip to content

Instantly share code, notes, and snippets.

@elena-roff
Last active July 30, 2018 11:59
Show Gist options
  • Save elena-roff/ed5c573b1c90c2464025b26f8a0d0319 to your computer and use it in GitHub Desktop.
Save elena-roff/ed5c573b1c90c2464025b26f8a0d0319 to your computer and use it in GitHub Desktop.
Custom vim config
" Configuration file for vim
" To customize it, copy to ~/.vimrc and edit!
set nocompatible " Use Vim defaults (much better!)
set bs=2 " allow backspacing over everything in insert mode
set history=50 " keep 50 lines of command line history
set textwidth=0 " Don't wrap words by default
set ruler " Show the line and column numbers of the cursor
" Suffixes that get lower priority when doing tab completion for filenames.
" These are files we are not likely to want to edit or read.
set suffixes=.bak,~,.swp,.o,.info,.aux,.log,.dvi,.bbl,.blg,.brf,.cb,.ind,.idx,.ilg,.inx,.out,.toc
" Don't use Ex mode, use Q for formatting
map Q gq
" Make p in Visual mode replace the selected text with the "" register.
vnoremap p <Esc>:let current_reg = @"<CR>gvdi<C-R>=current_reg<CR><Esc>
" Delete key
:if &term =~ "xterm"
set t_kD=^[[3~
:endif
" And colors
:if &term =~ "xterm" || &term =~ "linux"
set background=dark
set t_Co=8
set t_Sf=^[[3%dm
set t_Sb=^[[4%dm
:endif
" gvim
:if has("gui_running")
set background=light
set t_Co=16
:endif
" If you like highlight search, you can also reconfigure the colors
":hi search guifg=black
":set background=light
":hi ErrorMsg guifg=black
":set bg=dark
" Nice syntax
if has("syntax") && filereadable($VIMRUNTIME . "/syntax/syntax.vim") && (&t_Co > 2 || has("gui_running"))
syntax on
endif
" Several maps useful for most terminals
map ^[[A <Up>
map! ^[[A <Up>
map ^[[B <Down>
map! ^[[B <Down>
map ^[[D <Left>
map! ^[[D <Left>
map ^[[C <Right>
map! ^[[C <Right>
map ^[[H <Home>
map! ^[[H <Home>
map ^[OH <Home>
map! ^[OH <Home>
map ^[[F <End>
map! ^[[F <End>
map ^[OF <End>
map! ^[OF <End>
map ^[[3~ <Delete>
map! ^[[3~ <Delete>
set showcmd " Show (partial) command in status line.
set showmatch " Show matching brackets.
set nocompatible
set background=dark
set smartindent
set tabstop=4
set softtabstop=4
set shiftwidth=4
set vb
set expandtab
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment