public
Last active

My .vimrc

  • Download Gist
vimrc.vim
VimL
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137
" Basics
set t_Co=256
colorscheme symfony
set guifont=Monospace\ 8
set number
 
let g:superTabDefaultCompletionType = "context"
 
" Filetype stuff
filetype on
filetype plugin on
set ofu=syntaxcomplete#Complete
 
" Smart tabbing / autoindenting
set undolevels=150
set nocompatible
set autoindent
set smarttab
set backspace=2
set shiftwidth=4
set tabstop=4
set expandtab
set nowrap
set equalalways
set mouse=a
set backspace=eol,start,indent
 
" Search and Highlighting
set wrapscan
set showmatch
set hlsearch
set incsearch
set ignorecase smartcase
set enc=utf-8
set nofoldenable
 
" General Options
set ch=2
set cpoptions+=$
set virtualedit=all
set laststatus=2
set hidden
set nolazyredraw
set stl=%f\ %m\ %r\ Line:%l/%L[%p%%]\ Col:%c\ Buf:%n\ [%b][0x%B]
set scrolloff=4
set wildmenu
set fillchars=""
set clipboard=unnamed
set shortmess+=I
 
" No backups
set nobackup
set nowb
set noswapfile
 
" Text options
set textwidth=0
set formatoptions=roqm1
 
" Mappings
nnoremap <silent> <F5> :let _s=@/<Bar>:%s/\s\+$//e<Bar>:let @/=_s<Bar>:nohl<CR>
nnoremap <silent> <F4> :nohl<CR>
nnoremap <silent> <F7> :NERDTreeToggle<CR>
nnoremap <silent> <F2> :so ~/.vimrc<CR>
inoremap ß {<CR>}<ESC>ko<Tab>
noremap! <silent> § <ESC>
vnoremap <silent> § <ESC>
snoremap <silent> § <ESC>
nnoremap <silent> <c-o> o<ESC>k
nnoremap <silent> ü '.
 
" MiniBuf
let g:miniBufExplModSelTarget = 1
let g:miniBufExplorerMoreThanOne = 2
let g:miniBufExplModSelTarget = 0
let g:miniBufExplUseSingleClick = 1
let g:miniBufExplMapWindowNavVim = 1
 
let g:bufExplorerSortBy = "name"
 
autocmd BufRead,BufNew :call UMiniBufExplorer
 
" Strip trailing whitespace on save
fun! <SID>StripTrailingWhitespaces()
let l = line(".")
let c = col(".")
%s/\s\+$//e
call cursor(l, c)
endfun
 
" Move lines
function! s:swap_lines(n1, n2)
let line1 = getline(a:n1)
let line2 = getline(a:n2)
call setline(a:n1, line2)
call setline(a:n2, line1)
endfunction
 
function! s:swap_up()
let n = line('.')
if n == 1
return
endif
 
call s:swap_lines(n, n - 1)
exec n - 1
endfunction
 
function! s:swap_down()
let n = line('.')
if n == line('$')
return
endif
 
call s:swap_lines(n, n + 1)
exec n + 1
endfunction
 
nnoremap <silent> ä :call <SID>swap_up()<CR>
nnoremap <silent> ö :call <SID>swap_down()<CR>
 
" Truncate Lines on write
autocmd BufWritePre *.js :call <SID>StripTrailingWhitespaces()
 
" Execute via Shebang
map <C-X> :call CallInterpreter()<CR>
 
au BufEnter *
\ if match (getline(1) , '^\#!') == 0 |
\ execute("let b:interpreter = getline(1)[2:]") |
\ endif
 
fun! CallInterpreter()
if exists("b:interpreter")
exec("! ".b:interpreter." %")
endif
endfun

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.