Skip to content

Instantly share code, notes, and snippets.

@H2so4
Last active January 4, 2016 09:09
Show Gist options
  • Select an option

  • Save H2so4/8600463 to your computer and use it in GitHub Desktop.

Select an option

Save H2so4/8600463 to your computer and use it in GitHub Desktop.
" Base file borrowed from JOHN KUGELMAN (Thanks much)
" -------This allows you to paste without the auto-indent craziness---
let &t_SI .= "\<Esc>[?2004h"
let &t_EI .= "\<Esc>[?2004l"
inoremap <special> <expr> <Esc>[200~ XTermPasteBegin()
function! XTermPasteBegin()
set pastetoggle=<Esc>[201~
set paste
return ""
endfunction
" --------------------------------------------------------------------
syntax enable
" Show line numbers
set nu
" Incremental search without highlighting.
set incsearch
set nohlsearch
" Show ruler.
set ruler
" Try to keep 2 lines above/below the current line in view for context.
set scrolloff=2
" Other file types.
autocmd BufReadPre,BufNew *.xml set filetype=xml
" Flag problematic whitespace (trailing spaces, spaces before tabs).
highlight BadWhitespace term=standout ctermbg=red guibg=red
2match BadWhitespace /[^* \t]\zs\s\+$\| \+\ze\t/
" If using ':set list' show things nicer.
execute 'set listchars=tab:' . nr2char(187) . '\ '
set list
highlight Tab ctermfg=lightgray guifg=lightgray
2match Tab /\t/
" Indent settings for code: 4 spaces, do not use tab character.
"set tabstop=4 shiftwidth=4 autoindent smartindent shiftround
"autocmd FileType c,cpp,java,xml,python,cs setlocal expandtab softtabstop=4
"autocmd FileType c,cpp,java,xml,python,cs 2match BadWhitespace /[^\t]\zs\t/
set tabstop=8 shiftwidth=4 autoindent smartindent shiftround
set expandtab softtabstop=4
match BadWhitespace /[^\t]\zs\t\+/
" Automatically show matching brackets.
set showmatch
" Auto-complete file names after <TAB> like bash does.
set wildmode=longest,list
set wildignore=.svn,CVS,*.swp
" Show current mode and currently-typed command.
set showmode
set showcmd
" Use mouse if possible.
" set mouse=a
" Use Ctrl-N and Ctrl-P to move between files.
nnoremap <C-N> :confirm next<Enter>
nnoremap <C-P> :confirm prev<Enter>
" Confirm saving and quitting.
set confirm
" So yank behaves like delete, i.e. Y = D.
map Y y$
" Toggle paste mode with F5.
set pastetoggle=<F5>
" Don't exit visual mode when shifting.
vnoremap < <gv
vnoremap > >gv
" Move up and down by visual lines not buffer lines.
nnoremap <Up> gk
vnoremap <Up> gk
nnoremap <Down> gj
vnoremap <Down> gj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment