Last active
December 14, 2015 07:29
-
-
Save phistep/5051199 to your computer and use it in GitHub Desktop.
My Vim config
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" """"" | |
" .vimrc | |
" v1.4.1 | |
" | |
set nocompatible " be iMproved | |
" """ | |
" Vundle | |
" | |
filetype off | |
set rtp+=~/.vim/bundle/vundle/ | |
call vundle#rc() | |
Bundle 'gmarik/vundle' | |
" bundles | |
Bundle 'Raimondi/delimitMate' | |
Bundle 'plasticboy/vim-markdown' | |
Bundle 'msanders/snipmate.vim' | |
"Bundle 'FredKSchott/CoVim' | |
Bundle 'jeffkreeftmeijer/vim-numbertoggle' | |
let g:NumberToggleTrigger="<C-1>" | |
Bundle 'mrtazz/simplenote.vim' | |
source ~/.simplenoterc | |
"let g:SimplenoteVertical=1 | |
"g:SimplenoteFiletype=mkd | |
Bundle 'nathanaelkane/vim-indent-guides' | |
if has('gui_running') | |
let g:indent_guides_enable_on_vim_startup=1 | |
endif | |
let g:indent_guides_start_level=1 | |
let g:indent_guides_color_change_percent=5 | |
Bundle 'ervandew/supertab' | |
let g:SuperTabNoCompleteAfter=['^', ',', '\s'] | |
"Bundle 'altercation/vim-colors-solarized' | |
"let g:solarized_termcolors=256 | |
Bundle 'Lokaltog/vim-powerline' | |
let g:Powerline_symbols='compatible' | |
call Pl#Theme#RemoveSegment('fileencoding') | |
call Pl#Theme#RemoveSegment('fileformat') | |
call Pl#Theme#InsertSegment('filesize', 'after', 'filename') | |
call Pl#Theme#InsertSegment('spell:lang', 'before', 'filetype') | |
"Bundle 'scrooloose/nerdtree' | |
filetype plugin indent on " required by vundle | |
" """ | |
" general | |
" | |
" appearance | |
set background=dark | |
colorscheme smyck | |
set cursorline | |
set ruler | |
set number | |
set laststatus=2 " vim-powerline | |
" indentation | |
set tabstop=4 | |
set shiftwidth=4 | |
set guifont=Menlo:h12 | |
" change cursor to vertical bar in insert-mode | |
let &t_SI = "\<Esc>]50;CursorShape=1\x7" | |
let &t_EI = "\<Esc>]50;CursorShape=0\x7" | |
" enable mouse | |
if has('mouse') | |
set mouse=a | |
endif | |
" colors | |
if &t_Co > 2 || has("gui_running") | |
syntax on | |
endif | |
" search | |
set showmatch | |
set ignorecase | |
set nohlsearch | |
set hlsearch | |
set incsearch | |
" folding | |
set foldmethod=syntax | |
set foldcolumn=4 | |
"set nofoldenable | |
" invisible characres | |
"set list | |
set listchars=tab:▸\ ,eol:¬,extends:❯,precedes:❮,nbsp:␣ | |
" line wrapping | |
set nowrap | |
set linebreak nolist | |
set showbreak=… | |
" spelling and encoding | |
set encoding=utf-8 | |
set nospell | |
set spelllang=en_us | |
" """ | |
" key bindings | |
" | |
" change <Leader> | |
let mapleader = ',' | |
" move within wrapped lines | |
nnoremap j gj | |
nnoremap k gk | |
vnoremap j gj | |
vnoremap k gk | |
vnoremap ^ g^ | |
vnoremap $ g$ | |
" use capitals to perfom til end of line | |
nnoremap Y y$ | |
nnoremap D d$ | |
" toggle folds with space | |
nnoremap <Space> za | |
" toggle all folds | |
nnoremap <Leader><Space> zR | |
" save buffer on <F5> | |
inoremap <F5> <C-O>:write<CR> | |
nnoremap <F5> :write<CR> | |
" toggle line wrapping | |
nnoremap <silent> <Leader>w :setlocal wrap!<CR> | |
" toggle invisible characters | |
nnoremap <silent> <Leader>i :setlocal list!<CR> | |
nnoremap <silent> <Leader>I :set list!<CR> | |
" toggle paste mode | |
nnoremap <silent> <Leader>p :set paste!<CR> | |
" permanently toggle search highlighting | |
nnoremap <silent> <Leader>Q :setlocal hlsearch!<CR> | |
" remove search highlighting for this search | |
nnoremap <silent> <Leader>q :nohlsearch<CR> | |
" toggle spell checking | |
nnoremap <silent> <Leader>s :setlocal spell!<CR> | |
nnoremap <silent> <Leader>S :set spell!<CR> | |
" the NERDTree | |
noremap <silent> <C-N> :NERDTreeToggle<CR> | |
nnoremap <silent> <Leader>n :NERDTreeToggle<CR> | |
"noremap <silent> <S-C-N> :NERDTreeFind<CR> | |
"nnoremap <silent> <Leader>N :NERDTreeFind<CR> | |
" toggle language | |
function! ToggleSpellLang() | |
if &spelllang == 'en_us' | |
setlocal spelllang=de_de | |
else " de_de | |
setlocal spelllang=en_us | |
endif | |
endfunction | |
nnoremap <silent> <Leader>l :call ToggleSpellLang()<CR> | |
" native clipboard copy/paste | |
vnoremap <C-C> "*y | |
inoremap <C-V> <Esc>mo:set paste<CR>"*p:set nopaste<CR>`oa | |
" remove whitespace | |
nnoremap <silent> <Leader>x<Space> :%s/\s\+$<CR> | |
" Emacs bindings in command line mode | |
"cnoremap <M-F> <S-Right> | |
"cnoremap <M-B> <S-Left> | |
"inoremap <M-F> <C-O>b | |
" Panic Button | |
" nnoremap <F9> mzggg?G`z | |
" """ | |
" misc | |
" | |
" update the window title | |
set title | |
" don't beep on errors | |
set noerrorbells | |
set visualbell | |
" curser scrolling margin so that it is not in the last line on screen | |
set scrolloff=2 | |
set sidescrolloff=2 | |
" disable automatic comment insertation | |
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o | |
" allow backspacing over indentation, end-of-line, and start-of-line. | |
set backspace=indent,eol,start | |
" move swap files to one directory | |
set backupdir=~/.vimtmp,. | |
set directory=~/.vimtmp,. | |
" highlight unwanted whitespace | |
highlight ExtraWhitespace ctermbg=red guibg=red | |
autocmd Syntax * syn match ExtraWhitespace /\s\+$\| \+\ze\t/ | |
" automatically reload the vim file after saving it. | |
"if has("autocmd") | |
" autocmd BufWritePost .vimrc source $MYVIMRC | |
"endif | |
" Restore cursor position | |
if has("autocmd") | |
autocmd BufReadPost * | |
\ if line("'\"") > 1 && line("'\"") <= line("$") | | |
\ exe "normal! g`\"" | | |
\ endif | |
end | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ~/.vim/ftplugin/gitcommit.vim | |
" enable english spell checking | |
set spell | |
set spelllang=en_us |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ~/.vim/ftplugin/latex.vim | |
" use line wrapping | |
setlocal wrap | |
" use hard wrapping | |
"setlocal textwidth=0 | |
"setlocal formatoptions=ta | |
" use more text like list chars, also $ is reserved in LaTeX | |
"set list | |
set listchars=eol:¶ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ~/.vim/ftplugin/mkd.vim | |
" Render preview in browser | |
" requires defunkt/brower (https://gist.github.com/defunkt/318247/) | |
inoremap <buffer> <F6> <Esc>:write<CR>:!markdown % \| ( echo "<\!DOCTYPE html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<title>% Markdown Preview</title>\n\t</head>\n\t<body>\n"; cat; echo "\n\t</body>\n</html>" ) \| browser<CR><CR>a | |
nnoremap <buffer> <F6> :write<CR>:!markdown % \| ( echo "<\!DOCTYPE html>\n<html>\n\t<head>\n\t\t<meta charset=\"utf-8\">\n\t\t<title>% Markdown Preview</title>\n\t</head>\n\t<body>\n"; cat; echo "\n\t</body>\n</html>" ) \| browser<CR><CR> | |
" use soft indentation | |
setlocal expandtab | |
setlocal shiftwidth=4 | |
setlocal softtabstop=4 | |
" use line wrapping | |
setlocal wrap | |
" use more text like list chars | |
"set list | |
set listchars=eol:¶ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" ~/.vim/ftplugin/ruby.vim | |
inoremap <buffer> <F6> <Esc>:w<CR>:!ruby %<CR> | |
nnoremap <buffer> <F6> :!ruby %<CR> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment