Skip to content

Instantly share code, notes, and snippets.

@LinuxPanda
Created March 17, 2014 19:11
Show Gist options
  • Save LinuxPanda/9606206 to your computer and use it in GitHub Desktop.
Save LinuxPanda/9606206 to your computer and use it in GitHub Desktop.
set tabstop=4 " Number of spaces that a <Tab> in the file counts for.
set shiftwidth=4 " Number of spaces to use for each step of (auto)indent.
set expandtab " Use the appropriate number of spaces to insert a <Tab>.
" Spaces are used in indents with the '>' and '<' commands
" and when 'autoindent' is on. To insert a real tab when
" 'expandtab' is on, use CTRL-V <Tab>.
set smarttab " When on, a <Tab> in front of a line inserts blanks
" according to 'shiftwidth'. 'tabstop' is used in other
" places. A <BS> will delete a 'shiftwidth' worth of space
" at the start of the line.
set softtabstop=4 " Number of spaces that a <Tab> counts for while performing editing
" operations, like inserting a <Tab> or using <BS>.
set showcmd " Show (partial) command in status line.
set number " Show line numbers.
set showmatch " When a bracket is inserted, briefly jump to the matching
" one. The jump is only done if the match can be seen on the
" screen. The time to show the match can be set with
" 'matchtime'.
set hlsearch " When there is a previous search pattern, highlight all
" its matches.
set incsearch " While typing a search command, show immediately where the
" so far typed pattern matches.
set ignorecase " Ignore case in search patterns.
set smartcase " Override the 'ignorecase' option if the search pattern
" contains upper case characters.
set backspace=2 " Influences the working of <BS>, <Del>, CTRL-W
" and CTRL-U in Insert mode. This is a list of items,
" separated by commas. Each item allows a way to backspace
" over something.
set autoindent " Copy indent from current line when starting a new line
" (typing <CR> in Insert mode or when using the "o" or "O"
" command).
set cindent " Stricter ident rules for C programs.
set formatoptions=c,q,r,t " This is a sequence of letters which describes how
" automatic formatting is to be done.
"
" letter meaning when present in 'formatoptions'
" ------ ---------------------------------------
" c Auto-wrap comments using textwidth, inserting
" the current comment leader automatically.
" q Allow formatting of comments with "gq".
" r Automatically insert the current comment leader
" after hitting <Enter> in Insert mode.
" t Auto-wrap text using textwidth (does not apply
" to comments)
set ruler " Show the line and column number of the cursor position,
" separated by a comma.
set background=dark " When set to "dark", Vim will try to use colors that look
" good on a dark background. When set to "light", Vim will
" try to use colors that look good on a light background.
" Any other value is illegal.
set mouse=a " Enable the use of the mouse.
set wrap " soft-wrap lines
set showbreak=...\ " prefix for soft-wrapped lines (no actual line break character)
set linebreak " soft-wrap lines only at certain characters (see :help breakat)
filetype plugin indent on
syntax on
" Remove highlighting when hitting <Return> after search
nnoremap <CR> :noh<CR><CR>
" in normal mode F4 will save the file
nmap <F5> :w<CR>
" in insert mode F4 will exit insert, save, enters insert again
imap <F5> <ESC>:w<CR>i
" switch between header/source with F6
map <F6> :e %:p:s,.h$,.X123X,:s,.c$,.h,:s,.X123X$,.c,<CR>
" in diff mode we use the spell check keys for merging
if &diff
” diff settings
map <M-Down> ]c
map <M-Up> [c
map <M-Left> do
map <M-Right> dp
map <F9> :new<CR>:read !svn diff<CR>:set syntax=diff buftype=nofile<CR>gg
else
" spell settings
:setlocal spell spelllang=en
" set the spellfile - folders must exist
set spellfile=~/.vim/spellfile.add
map <M-Down> ]s
map <M-Up> [s
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment