|
" The Basics |
|
set nocompatible |
|
set background=light |
|
set expandtab " spaces over tabs |
|
set tabstop=4 |
|
set softtabstop=4 |
|
set shiftwidth=4 |
|
|
|
" ignorecase and smartcase together make search intelligently. |
|
" all-lowercase string: case-insensitive |
|
" one or more characters uppercase: case-sensitive |
|
set ignorecase |
|
set smartcase |
|
" incsearch, showmatch and hlsearch work together to highlight search results (as you type). |
|
set incsearch |
|
set showmatch |
|
set hlsearch |
|
" pathogen |
|
execute pathogen#infect() |
|
|
|
" what is the difference between on and enable? |
|
syntax enable |
|
|
|
syntax on " syntax highlighing |
|
filetype on " try to detect filetypes |
|
filetype plugin indent on " enable loading indent file for filetype |
|
|
|
colorscheme morning |
|
|
|
" Bind for easy pasting |
|
set pastetoggle=<F12> |
|
|
|
" No annoying sound on errors |
|
set noerrorbells |
|
set novisualbell |
|
set t_vb= |
|
set tm=500 |
|
|
|
" Window display |
|
set showcmd ruler laststatus=2 |
|
|
|
" , is easier to type than \. I use leader commands constantly so it’s worth changing. |
|
let mapleader = "," |
|
let g:mapleader = "," |
|
|
|
" Map "follow link"-command to simpler key |
|
map <F11> <C-]> |
|
|
|
" I like to bind Ctrl+<movement> keys to move around the windows, |
|
" instead of using Ctrl+w + <movement>: |
|
map <c-j> <c-w>j |
|
map <c-k> <c-w>k |
|
map <c-l> <c-w>l |
|
map <c-h> <c-w>h |
|
|
|
" Treat long lines as break lines (useful when moving around in them) |
|
map j gj |
|
map k gk |
|
|
|
" Give a shortcut key to NERD Tree |
|
" I rarely use NERD Tree anymore. Command-T is usually all you'll need. |
|
" It is useful when you are getting to know a new codebase for the first time though |
|
map <leader>n :NERDTreeToggle<CR> |
|
map <C-n> :NERDTreeToggle<CR> |
|
|
|
" http://vimcasts.org/episodes/the-edit-command/ |
|
" trigger edit|split|tab with path of current file |
|
" %% - in the commandline expands to directory path of current file |
|
cnoremap %% <C-R>=expand('%:h').'/'<cr> |
|
map <leader>ew :e %% |
|
map <leader>es :sp %% |
|
map <leader>ev :vsp %% |
|
map <leader>et :tabe %% |
|
|
|
" This turns off Vim’s crazy default regex characters and makes searches use Perl/Python compatible regex formatting |
|
nnoremap / /\v |
|
vnoremap / /\v |
|
|
|
" Easy saving with CTLR+u |
|
nnoremap <C-u> :w<CR> |
|
inoremap <C-u> <ESC>:w<CR> |
|
vnoremap <C-u> <ESC>:w<CR> |
|
" use jj to exit back to normal mode |
|
inoremap jj <ESC> |
|
" make . do the same thing as : — it’s one less key to hit every time I want to save a file |
|
" (on the german keyboard it is . for |
|
nnoremap . : |
|
" Quit like in bash |
|
nnoremap <C-d> :q<CR> |
|
" Shortcut to rapidly toggle `set list`, show invisible chars |
|
nmap <leader>l :set list!<CR> |
|
" clear out a search by typing ,<space>. This gets rid of the distracting highlighting once I’ve found what I’m looking for. |
|
nnoremap <leader><space> :noh<cr> |
|
" make the tab key match bracket pairs. I use this to move around all the time and <tab> is a hell of a lot easier to type than %. |
|
nnoremap <tab> % |
|
vnoremap <tab> % |
|
|
|
" ,a - Ack |
|
nnoremap <leader>a :Ack |
|
|
|
" Vimux |
|
" Prompt for a command to run map |
|
map <leader>vp :VimuxPromptCommand<CR> |
|
" Run last command executed by VimuxRunCommand |
|
map <leader>vl :VimuxRunLastCommand<CR> |
|
" Inspect runner pane |
|
map <leader>vi :VimuxInspectRunner<CR> |
|
" Close vim tmux runner opened by VimuxRunCommand |
|
map <leader>vq :VimuxCloseRunner<CR> |
|
" Interrupt any command running in the runner pane |
|
map <Leader>vx :VimuxInterruptRunner<CR> |
|
|
|
" use vimux to send code to a REPL. |
|
function! VimuxSlime() |
|
call VimuxSendText(@v) |
|
call VimuxSendKeys("Enter") |
|
endfunction |
|
|
|
" If text is selected, save it in the v buffer and send that buffer it to tmux |
|
vmap <leader>sl "vy :call VimuxSlime()<CR> |
|
|
|
" Select current paragraph and send it to tmux |
|
nmap <leader>sl vip<leader>sl<CR> |
|
|
|
" Zen coding |
|
" let g:user_zen_expandabbr_key = '<c-e>' |
|
let g:use_zen_complete_tag = 1 |
|
let g:user_zen_settings = { |
|
\ 'indentation': " ", |
|
\ 'lang': "de", |
|
\ 'scss': { |
|
\ 'extends': 'css', |
|
\ 'filters': 'fc', |
|
\ }, |
|
\ 'html': { |
|
\ 'extends': 'html', |
|
\ 'snippets': { |
|
\ 'lorem': "Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet." |
|
\ } |
|
\ }, |
|
\} |
|
|
|
" some interesting stuff from https://dl.dropbox.com/u/7627133/vimrc.html (Max) |
|
autocmd FileType sql let b:surround_45 = "/* \r */" |
|
|
|
" vim as a python ide http://sontek.net/turning-vim-into-a-modern-python-ide |
|
" folding |
|
set foldmethod=indent |
|
set foldlevel=99 |
|
|
|
" configure SuperTab to be context sensitive and to enable omni code completion |
|
au FileType python set omnifunc=pythoncomplete#Complete |
|
let g:SuperTabDefaultCompletionType = "context" |
|
" enable the menu and pydoc preview to get the most useful information out of the code completion |
|
set completeopt=menuone,longest,preview |
|
|
|
" http://stevelosh.com/blog/2010/09/coming-home-to-vim/ |
|
" This will disable the arrow keys while you’re in normal mode to help you learn to use hjkl. |
|
" Trust me, you want to learn to use hjkl. Playing a lot of Nethack also helps. |
|
"nnoremap <up> <nop> |
|
"nnoremap <down> <nop> |
|
"nnoremap <left> <nop> |
|
"nnoremap <right> <nop> |
|
" disables the arrow keys in insert mode to force you to get back into |
|
" normal mode the instant you’re done inserting text, which is the “right way” to do things. |
|
"inoremap <up> <nop> |
|
"inoremap <down> <nop> |
|
"inoremap <left> <nop> |
|
"inoremap <right> <nop> |
|
" ,ft - mapped to a "fold tag" for HTML - not working |
|
" nnoremap <leader>ft Vatzf |
|
" ,S - sort CSS Properties - not working |
|
" nnoremap <leader>S ?{<CR>jV/^\s*\}?$<CR>k:sort<CR>:noh<CR> |
|
|
|
" camelCase => camel_case functioniert irgendwie nicht so richtig |
|
" vnoremap <leader>case :s/\v\C(([a-z]+)([A-Z]))/\2_\l\3/g<CR> |
|
|
|
"highlight DiffAdd term=reverse cterm=bold ctermbg=green ctermfg=white |
|
"highlight DiffChange term=reverse cterm=bold ctermbg=cyan ctermfg=black |
|
"highlight DiffText term=reverse cterm=bold ctermbg=gray ctermfg=black |
|
"highlight DiffDelete term=reverse cterm=bold ctermbg=red ctermfg=black |