Initial commit - dotvim to dotfiles - with install script, yeah

main
Steffen Becker 12 years ago
commit e566b9ec52

2
.gitignore vendored

@ -0,0 +1,2 @@
.netrwhist
yankring_history_v2.txt

3
.gitmodules vendored

@ -0,0 +1,3 @@
[submodule "vim/bundle/mw-utils"]
path = vim/bundle/mw-utils
url = git://github.com/MarcWeber/vim-addon-mw-utils.git

@ -0,0 +1,89 @@
# My dotfiles
This is a collection of my dotfiles. To install on your local machine do:
```
git clone git://github.com/nebelschwade/dotfiles ~/Dotfiles
cd ~/Dotfiles
rake install
```
Thanks a lot to Ryan Bates for his install-script [here](https://github.com/ryanb/dotfiles).
The Vim-config is highly influenced by [janus](https://github.com/carlhuda/janus).
## VIM
### Bundled Plugins
- Pathogen (sits in autoload/ - the only one _not_ in bundle/)
- ack
- browser-refresh
- buffergator
- ctrlp
- easymotion
- fugitive
- gist
- indent-guides
- indent-object
- matchit
- nrrwrgn
- nerdtree
- pasta
- ragtag
- repeat
- snipmate
- sparkup
- supertab
- surround
- syntastic
- tabular
- tagbar
- tcomment
- unimpaired
- yankring
- zoomwin
### Bundled Color Schemes
- jellybeans (one to rule them all)
### Better syntax and indenting for
- javascript
- css3 and scss
- html5
- php
- git
- markdown
### Custom Stuff (see my github profile)
- [typoscript syntax for Vim](https://github.com/nebelschwade/typoscript-vim)
- [a better statusline](https://github.com/nebelschwade/statusline-vim)
- [custom snipmate snippets](https://github.com/nebelschwade/snipmate-snippets)
- remapping ; to :
- \<leader\> is set to comma (,)
- \<tab\> and \<shift-tab\> for switching between buffers
- no arrow-keys, except for indenting, moving blocks of code with \<shift\>
- ,u and ,l (and uppercase) for uppercasing/lowercasing words
- ,w for switching to words
- ,v for a new vertical split
- ,= for resizing splits equally
- ,a for Ack-Search
- ,/ for un/commenting
- ,z for zoomin
- ,r for browser-refreshing-
- ,n for nerdtree toggling
- ,m for easymotion (,mw or ,mf are my favorites here)
- ,y for the yankring
- ,b for toggling buffergator
- ,t for CtrlP
- ,d for changing the working dir to the dir of the current file
- \<F8\> for toggling the tagbar
- \<shift-tab\> in css indents single line to column 31
- autotrailing of whitespace for php, html, css, js, ts, xml, json, inc and vim files
## Bash and aliases
Well, have a look at .profile.

@ -0,0 +1,50 @@
require 'rake'
require 'erb'
desc "install the dot files into user's home directory"
task :install do
replace_all = false
Dir['*'].each do |file|
next if %w[Rakefile README.md].include? file
if File.exist?(File.join(ENV['HOME'], ".#{file.sub('.erb', '')}"))
if File.identical? file, File.join(ENV['HOME'], ".#{file.sub('.erb', '')}")
puts "identical ~/.#{file.sub('.erb', '')}"
elsif replace_all
replace_file(file)
else
print "overwrite ~/.#{file.sub('.erb', '')}? [ynaq] "
case $stdin.gets.chomp
when 'a'
replace_all = true
replace_file(file)
when 'y'
replace_file(file)
when 'q'
exit
else
puts "skipping ~/.#{file.sub('.erb', '')}"
end
end
else
link_file(file)
end
end
end
def replace_file(file)
system %Q{rm -rf "$HOME/.#{file.sub('.erb', '')}"}
link_file(file)
end
def link_file(file)
if file =~ /.erb$/
puts "generating ~/.#{file.sub('.erb', '')}"
File.open(File.join(ENV['HOME'], ".#{file.sub('.erb', '')}"), 'w') do |new_file|
new_file.write ERB.new(File.read(file)).result(binding)
end
else
puts "linking ~/.#{file}"
system %Q{ln -s "$PWD/#{file}" "$HOME/.#{file}"}
end
end

@ -0,0 +1,56 @@
[user]
name = <%= print("Your Name: "); STDOUT.flush; STDIN.gets.chomp %>
email = <%= print("Your Email: "); STDOUT.flush; STDIN.gets.chomp %>
[github]
user = <%= print("GitHub Username: "); STDOUT.flush; STDIN.gets.chomp %>
token = <%= print("GitHub API Token: "); STDOUT.flush; STDIN.gets.chomp %>
[core]
excludesfile = <%= ENV['HOME'] %>/.gitignore
editor = mvim -f
autocrlf = input
eol = lf
whitespace=fix,-indent-with-non-tab,trailing-space,cr-at-eol
[color]
ui = auto
[color "branch"]
current = yellow reverse
local = yellow
remote = green
[color "diff"]
meta = yellow bold
frag = magenta bold
old = red bold
new = green bold
whitespace = red reverse
[color "status"]
added = yellow
changed = green
untracked = cyan
[alias]
st = status
cm = commit
co = checkout
br = branch
ps = push
pl = pull
hub = push origin master
rmall = rm $(git ls-files --deleted)
subup= submodule foreach git pull
rs = reset master --hard
hist = log --pretty=format:\"%h | %ad | %s%d [%an]\" --graph --date=local
lo = log --graph --decorate --pretty=oneline --abbrev-commit --all
type = cat-file -t
dump = cat-file -p
[merge]
tool = sourcetree
summary = true
[difftool "sourcetree"]
cmd = opendiff \"$LOCAL\" \"$REMOTE\"
path =
[mergetool "sourcetree"]
cmd = /Applications/SourceTree.app/Contents/Resources/opendiff-w.sh \"$LOCAL\" \"$REMOTE\" -ancestor \"$BASE\" -merge \"$MERGED\"
trustExitCode = true

@ -0,0 +1,4 @@
*~
.DS_Store
.svn
.tmp_*

@ -0,0 +1,4 @@
set completion-ignore-case on
set completion-query-items -1
set page-completions off

@ -0,0 +1,53 @@
{
"onecase" : false,
"immed" : false,
"debug" : false,
"evil" : false,
"strict" : false,
"multistr" : false,
"wsh" : false,
"couch" : false,
"laxbreak" : false,
"rhino" : false,
"globalstrict" : false,
"supernew" : false,
"laxcomma" : false,
"asi" : false,
"es5" : false,
"scripturl" : false,
"withstmt" : false,
"bitwise" : true,
"eqeqeq" : true,
"shadow" : false,
"expr" : false,
"noarg" : true,
"newcap" : true,
"forin" : false,
"regexdash" : false,
"browser" : true,
"dojo" : false,
"eqnull" : false,
"node" : false,
"mootools" : false,
"iterator" : false,
"undef" : true,
"latedef" : true,
"nonstandard" : false,
"trailing" : true,
"jquery" : true,
"loopfunc" : false,
"boss" : false,
"nonew" : true,
"funcscope" : false,
"regexp" : true,
"lastsemic" : false,
"smarttabs" : false,
"devel" : false,
"esnext" : false,
"sub" : false,
"curly" : true,
"prototypejs" : false,
"proto" : false,
"plusplus" : false,
"noempty" : false
}

@ -0,0 +1,2 @@
#PEAR_Config 0.9
a:2:{s:10:"__channels";a:2:{s:12:"pecl.php.net";a:0:{}s:5:"__uri";a:0:{}}s:7:"php_ini";s:22:"/usr/local/etc/php.ini";}

@ -0,0 +1,82 @@
export PATH=/usr/local/bin:/usr/local/sbin:$HOME/.rvm/bin:$PATH
export MANPATH=/usr/local/share/man:$MANPATH
# disable stupid ._ and dsstore files
export COPY_EXTENDED_ATTRIBUTES_DISABLE=true
export COPYFILE_DISABLE=true
# colors ftw!
export CLICOLOR=1
export LSCOLORS=gxBxhxDxfxhxhxhxhxcxcx
# editor
export EDITOR=mvim
VISUAL=$EDITOR; export VISUAL
# node.js
export NODE_PATH=/usr/local/lib/jsctags/:$NODE_PATH
# aliases for starting apache and mysql
alias apachestart='sudo /usr/sbin/apachectl start'
alias apachestop='sudo /usr/sbin/apachectl stop'
alias mysqlstart='mysql.server start'
alias mysqlstop='mysql.server stop'
alias devstart='apachestart && mysqlstart'
alias devstop='apachestop && mysqlstop'
# dnsflush-shortcut
alias dnsflush='sudo dscacheutil -flushcache'
# all in one homebrew, gem and vim bundles update commands
alias brewup='brew update && brew upgrade && brew cleanup && brew linkapps'
alias vimup='cd ~/.vim/ && git submodule foreach git pull && cd -'
alias gemup='gem update --system && gem update'
alias upall='brewup && gemup && vimup'
# easy hosts-editing
alias hosts='sudo mvim /etc/hosts'
alias vhosts='sudo mvim /etc/apache2/extra/httpd-vhosts.conf'
# Always list everything
alias ls='ls -all'
alias lsd='ls -l | grep "^d"'
# always use mvim
alias vim='mvim'
alias v='mvim'
alias vd='mvimdiff'
alias diff='mvimdiff'
alias emptytrash='sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl'
# Easier navigation: .., ..., ~ and -
alias ..='cd ..'
alias ...='cd ../..'
# Shortcuts
alias dr='cd ~/Dropbox && ls'
alias w='cd ~/Sites && ls'
alias r='cd ~/Repositories && ls'
alias d='cd ~/Dotfiles && ls'
# Gitty gitgit
alias gti='git'
alias g='git'
alias deploy='dandelion deploy'
alias status='dandelion status'
# use ffmpeg to create nice web-videos and a jpg-still
ffencode () {
ffmpeg -i $1 -vcodec libx264 -vprofile high -preset slow -vb 1000k -maxrate 1000k -bufsize 2000k -vf scale="854:trunc(ow/a/2)*2" -threads 0 -ab 128k video-low.mp4;
ffmpeg -i $1 -vcodec libx264 -vprofile high -preset slower -vb 1800k -vf scale="1280:trunc(ow/a/2)*2" -threads 0 -ab 224k video-high.mp4
ffmpeg -i $1 -vcodec libvpx -quality good -cpu-used 0 -vb 1000k -maxrate 1000k -bufsize 2000k -qmin 10 -qmax 42 -vf scale="854:trunc(ow/a/2)*2" -threads 0 -acodec libvorbis -ab 128k video-low.webm;
ffmpeg -i $1 -vcodec libvpx -quality good -cpu-used 0 -vb 1800k -maxrate 1800k -bufsize 3600k -qmin 10 -qmax 42 -vf scale="1280:trunc(ow/a/2)*2" -threads 0 -acodec libvorbis -ab 224k video-high.webm;
ffmpeg -i $1 -ss 00:00:05.01 -y -f image2 -vcodec mjpeg -vframes 1 -s hd720 video-high.jpg
ffmpeg -i $1 -ss 00:00:05.01 -y -f image2 -vcodec mjpeg -vframes 1 -s hd480 video-low.jpg
mp4box -inter 500 -hint video-high.mp4
mp4box -inter 500 -hint video-low.mp4
}
# rvm ftw!
[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm"

@ -0,0 +1,245 @@
" pathogen.vim - path option manipulation
" Maintainer: Tim Pope <http://tpo.pe/>
" Version: 2.0
" Install in ~/.vim/autoload (or ~\vimfiles\autoload).
"
" For management of individually installed plugins in ~/.vim/bundle (or
" ~\vimfiles\bundle), adding `call pathogen#infect()` to your .vimrc
" prior to `filetype plugin indent on` is the only other setup necessary.
"
" The API is documented inline below. For maximum ease of reading,
" :set foldmethod=marker
if exists("g:loaded_pathogen") || &cp
finish
endif
let g:loaded_pathogen = 1
" Point of entry for basic default usage. Give a directory name to invoke
" pathogen#runtime_append_all_bundles() (defaults to "bundle"), or a full path
" to invoke pathogen#runtime_prepend_subdirectories(). Afterwards,
" pathogen#cycle_filetype() is invoked.
function! pathogen#infect(...) abort " {{{1
let source_path = a:0 ? a:1 : 'bundle'
if source_path =~# '[\\/]'
call pathogen#runtime_prepend_subdirectories(source_path)
else
call pathogen#runtime_append_all_bundles(source_path)
endif
call pathogen#cycle_filetype()
endfunction " }}}1
" Split a path into a list.
function! pathogen#split(path) abort " {{{1
if type(a:path) == type([]) | return a:path | endif
let split = split(a:path,'\\\@<!\%(\\\\\)*\zs,')
return map(split,'substitute(v:val,''\\\([\\,]\)'',''\1'',"g")')
endfunction " }}}1
" Convert a list to a path.
function! pathogen#join(...) abort " {{{1
if type(a:1) == type(1) && a:1
let i = 1
let space = ' '
else
let i = 0
let space = ''
endif
let path = ""
while i < a:0
if type(a:000[i]) == type([])
let list = a:000[i]
let j = 0
while j < len(list)
let escaped = substitute(list[j],'[,'.space.']\|\\[\,'.space.']\@=','\\&','g')
let path .= ',' . escaped
let j += 1
endwhile
else
let path .= "," . a:000[i]
endif
let i += 1
endwhile
return substitute(path,'^,','','')
endfunction " }}}1
" Convert a list to a path with escaped spaces for 'path', 'tag', etc.
function! pathogen#legacyjoin(...) abort " {{{1
return call('pathogen#join',[1] + a:000)
endfunction " }}}1
" Remove duplicates from a list.
function! pathogen#uniq(list) abort " {{{1
let i = 0
let seen = {}
while i < len(a:list)
if (a:list[i] ==# '' && exists('empty')) || has_key(seen,a:list[i])
call remove(a:list,i)
elseif a:list[i] ==# ''
let i += 1
let empty = 1
else
let seen[a:list[i]] = 1
let i += 1
endif
endwhile
return a:list
endfunction " }}}1
" \ on Windows unless shellslash is set, / everywhere else.
function! pathogen#separator() abort " {{{1
return !exists("+shellslash") || &shellslash ? '/' : '\'
endfunction " }}}1
" Convenience wrapper around glob() which returns a list.
function! pathogen#glob(pattern) abort " {{{1
let files = split(glob(a:pattern),"\n")
return map(files,'substitute(v:val,"[".pathogen#separator()."/]$","","")')
endfunction "}}}1
" Like pathogen#glob(), only limit the results to directories.
function! pathogen#glob_directories(pattern) abort " {{{1
return filter(pathogen#glob(a:pattern),'isdirectory(v:val)')
endfunction "}}}1
" Turn filetype detection off and back on again if it was already enabled.
function! pathogen#cycle_filetype() " {{{1
if exists('g:did_load_filetypes')
filetype off
filetype on
endif
endfunction " }}}1
" Checks if a bundle is 'disabled'. A bundle is considered 'disabled' if
" its 'basename()' is included in g:pathogen_disabled[]' or ends in a tilde.
function! pathogen#is_disabled(path) " {{{1
if a:path =~# '\~$'
return 1
elseif !exists("g:pathogen_disabled")
return 0
endif
let sep = pathogen#separator()
return index(g:pathogen_disabled, strpart(a:path, strridx(a:path, sep)+1)) != -1
endfunction "}}}1
" Prepend all subdirectories of path to the rtp, and append all 'after'
" directories in those subdirectories.
function! pathogen#runtime_prepend_subdirectories(path) " {{{1
let sep = pathogen#separator()
let before = filter(pathogen#glob_directories(a:path.sep."*"), '!pathogen#is_disabled(v:val)')
let after = filter(pathogen#glob_directories(a:path.sep."*".sep."after"), '!pathogen#is_disabled(v:val[0:-7])')
let rtp = pathogen#split(&rtp)
let path = expand(a:path)
call filter(rtp,'v:val[0:strlen(path)-1] !=# path')
let &rtp = pathogen#join(pathogen#uniq(before + rtp + after))
return &rtp
endfunction " }}}1
" For each directory in rtp, check for a subdirectory named dir. If it
" exists, add all subdirectories of that subdirectory to the rtp, immediately
" after the original directory. If no argument is given, 'bundle' is used.
" Repeated calls with the same arguments are ignored.
function! pathogen#runtime_append_all_bundles(...) " {{{1
let sep = pathogen#separator()
let name = a:0 ? a:1 : 'bundle'
if "\n".s:done_bundles =~# "\\M\n".name."\n"
return ""
endif
let s:done_bundles .= name . "\n"
let list = []
for dir in pathogen#split(&rtp)
if dir =~# '\<after$'
let list += filter(pathogen#glob_directories(substitute(dir,'after$',name,'').sep.'*[^~]'.sep.'after'), '!pathogen#is_disabled(v:val[0:-7])') + [dir]
else
let list += [dir] + filter(pathogen#glob_directories(dir.sep.name.sep.'*[^~]'), '!pathogen#is_disabled(v:val)')
endif
endfor
let &rtp = pathogen#join(pathogen#uniq(list))
return 1
endfunction
let s:done_bundles = ''
" }}}1
" Invoke :helptags on all non-$VIM doc directories in runtimepath.
function! pathogen#helptags() " {{{1
let sep = pathogen#separator()
for dir in pathogen#split(&rtp)
if (dir.sep)[0 : strlen($VIMRUNTIME)] !=# $VIMRUNTIME.sep && filewritable(dir.sep.'doc') == 2 && !empty(filter(split(glob(dir.sep.'doc'.sep.'*'),"\n>"),'!isdirectory(v:val)')) && (!filereadable(dir.sep.'doc'.sep.'tags') || filewritable(dir.sep.'doc'.sep.'tags'))
helptags `=dir.'/doc'`
endif
endfor
endfunction " }}}1
command! -bar Helptags :call pathogen#helptags()
" Like findfile(), but hardcoded to use the runtimepath.
function! pathogen#runtime_findfile(file,count) "{{{1
let rtp = pathogen#join(1,pathogen#split(&rtp))
return fnamemodify(findfile(a:file,rtp,a:count),':p')
endfunction " }}}1
" Backport of fnameescape().
function! pathogen#fnameescape(string) " {{{1
if exists('*fnameescape')
return fnameescape(a:string)
elseif a:string ==# '-'
return '\-'
else
return substitute(escape(a:string," \t\n*?[{`$\\%#'\"|!<"),'^[+>]','\\&','')
endif
endfunction " }}}1
function! s:find(count,cmd,file,lcd) " {{{1
let rtp = pathogen#join(1,pathogen#split(&runtimepath))
let file = pathogen#runtime_findfile(a:file,a:count)
if file ==# ''
return "echoerr 'E345: Can''t find file \"".a:file."\" in runtimepath'"
elseif a:lcd
let path = file[0:-strlen(a:file)-2]
execute 'lcd `=path`'
return a:cmd.' '.pathogen#fnameescape(a:file)
else
return a:cmd.' '.pathogen#fnameescape(file)
endif
endfunction " }}}1
function! s:Findcomplete(A,L,P) " {{{1
let sep = pathogen#separator()
let cheats = {
\'a': 'autoload',
\'d': 'doc',
\'f': 'ftplugin',
\'i': 'indent',
\'p': 'plugin',
\'s': 'syntax'}
if a:A =~# '^\w[\\/]' && has_key(cheats,a:A[0])
let request = cheats[a:A[0]].a:A[1:-1]
else
let request = a:A
endif
let pattern = substitute(request,'\'.sep,'*'.sep,'g').'*'
let found = {}
for path in pathogen#split(&runtimepath)
let path = expand(path, ':p')
let matches = split(glob(path.sep.pattern),"\n")
call map(matches,'isdirectory(v:val) ? v:val.sep : v:val')
call map(matches,'expand(v:val, ":p")[strlen(path)+1:-1]')
for match in matches
let found[match] = 1
endfor
endfor
return sort(keys(found))
endfunction " }}}1
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Ve :execute s:find(<count>,'edit<bang>',<q-args>,0)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vedit :execute s:find(<count>,'edit<bang>',<q-args>,0)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vopen :execute s:find(<count>,'edit<bang>',<q-args>,1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vsplit :execute s:find(<count>,'split',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vvsplit :execute s:find(<count>,'vsplit',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vtabedit :execute s:find(<count>,'tabedit',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vpedit :execute s:find(<count>,'pedit',<q-args>,<bang>1)
command! -bar -bang -range=1 -nargs=1 -complete=customlist,s:Findcomplete Vread :execute s:find(<count>,'read',<q-args>,<bang>1)
" vim:set ft=vim ts=8 sw=2 sts=2:

271
vimrc

@ -0,0 +1,271 @@
" Load pathogen, switch on filetype and syntax afterwards
call pathogen#infect()
filetype plugin indent on
syntax on
set nocompatible " activate vim awesomeness
set ruler " show where you are in the document
set cursorline " highligh current line
set ttyfast " faster terminal usage
set ttyscroll=3 " faster terminal scrolling
set showcmd " show me what im doing. helps alot
set showmode " show active mode
set hidden " allows for switching buffers without writing
set relativenumber " relative line numbers are mothereffin awesome -- see how far your commands will go
set nowrap " dont wrap lines around
set sidescroll=10 " smoother side-scrolling
set sidescrolloff=5
" nice Whitespace chars
set list!
set listchars=extends,precedes,tab:▸\ ,eol,trail
" add the dash to keywords -- makes better css/js search
set iskeyword+=-
" Syntax coloring lines that are too long just slows down the world "
" set synmaxcol=256
set lazyredraw " to avoid scrolling problems
" Tabs and Whitespace
set tabstop=2
set softtabstop=2
set shiftwidth=2
set shiftround
set smarttab
set expandtab
set autoindent
set guifont=MesloLGSDZ:h12 " a nice font here
set guioptions-=T " no toolbar
set guioptions-=L " no left scrollbar
set guioptions-=r " no right scrollbar
color jellybeans
set fillchars=""
" Automatically read a file that has changed on disk
set autoread
set encoding=utf-8 " Yeah. UTF-8 FTW!
set fileformat=unix
set virtualedit=all " every mode active from v V to StrgV
" always put a status line in and make the command line 2 lines high
set laststatus=2
set ch=2
" Add a $ to the end of a selection vor easier overwriting vizualisation
set cpoptions+=$
" Searching
set ignorecase
set smartcase
set gdefault
set incsearch
set showmatch
set hlsearch
set wrapscan " set the search scan to wrap lines
set backspace=indent,eol,start " Allow backspacing over everything in insert mode
" Tab completion, and ignore some filetypes
set wildmode=list:longest,list:full
set wildignore+=.git,.svn,*.swp,*.bak,*.tmp,*.old
set wildmenu
set nobackup " no backups
set nowritebackup
set noswapfile " no swp-files
" Better folding
set foldmethod=indent
set foldnestmax=20 " max 20 levels of folding
set nofoldenable " dont fold by default - let me do it
set foldlevelstart=1 " deactivate folding on fileload
set noerrorbells " don't beep
set visualbell " don't beep
" ========== Custom Keymappings ==========
" set the leader to comma , and ; == : -- faster commands
let mapleader = ","
nnoremap ; :
nnoremap : ;
" jk nice behaviour (screen lines vs. shown lines)
nnoremap j gj
nnoremap k gk
nnoremap / /\v
vnoremap / /\v
" Switch between windows
nnoremap <tab> <C-w><C-w>
nnoremap <S-tab> <C-w>W
" custom shift-tab mapping -- opens new { } and blank line
imap <S-Tab> <Esc>$a {<CR><CR>}<Esc>k0lli
" Search mappings: These will make it so that going to the next one in a
" search will center on the line it's found in.
nnoremap N Nzz
nnoremap n nzz
" Adjust viewports to the same size
nnoremap <Leader>= <C-w>=
inoremap <Leader>= <Esc> <C-w>=
" reset search
nnoremap <Leader><space> :noh<cr>
" open new vertical split and change to split
nnoremap <leader>v <C-w>v<C-w>l
nnoremap <leader>s <C-w>s<C-w>j
" Opens an edit command with the path of the currently edited file filled in
nnoremap <Leader>e :e <C-R>=expand("%:p:h") . "/" <CR>
" dont use the arrow keys. LEARN VIM
nnoremap <up> <nop>
nnoremap <down> <nop>
inoremap <up> <nop>
inoremap <down> <nop>
inoremap <left> <nop>
inoremap <right> <nop>
" but use them for usefull stuff -- switching buffers
nnoremap <left> :bp<cr>
nnoremap <right> :bn<cr>
" Bubble lines using unimpaired
nmap <C-up> [e
nmap <C-down> ]e
vmap <C-up> [egv
vmap <C-down> ]egv
" in/outdent Keymappings
nmap <C-left> <<
nmap <C-right> >>
imap <C-left> <Esc><<i
imap <C-right> <Esc>>>i
vmap <C-left> <gv
vmap <C-right> >gv
set pastetoggle=<F2> " toggle paste-mode for c&p with F2
" no HELP while mishitting ESC - awesome
inoremap <F1> <ESC>
nnoremap <F1> <ESC>
vnoremap <F1> <ESC>
" upper/lower word
nmap <leader>U mQviwU`Q
nmap <leader>L mQviwu`Q
" upper/lower first CHAR of word
nmap <leader>u mQgewvU`Q
nmap <leader>l mQgewvu`Q
" Swap two words
nmap <leader>w :s/\(\%#\w\+\)\(\_W\+\)\(\w\+\)/\3\2\1/<CR>`'
" ========== PLugins leaders and other config ==========
"
" search using ack
nnoremap <leader>a :Ack
" Nerdtree toggle
nnoremap <leader>n :NERDTreeToggle<cr>
" let NERDTreeMinimalUI=1
let NERDTreeWinSize=50
let NERDTreeShowBookmarkset=1
" ZoomWin configuration
nnoremap <Leader>z :ZoomWin<CR>
" TComment
nnoremap <leader>/ :TComment<CR>
vnoremap <leader>/ :TComment<CR>
inoremap <leader>/ <Esc>:TComment<CR>i
" refresh browser mapping
nnoremap <silent><leader>r :wall<CR> :RRB<CR>
" Browser-Refresh config -- only use chrome
let g:RefreshRunningBrowserDefault = 'chrome'
" easymotion config leader m
let g:EasyMotion_leader_key = '<Leader>m'
" Enable syntastic syntax checking
" no checking for xhtml/html -- because of fluidtemplate for TYPO3
" and no checking for scss.css because of CSS3 and SASS-Variable
" errors for included files - let codekit handle this
let g:syntastic_auto_jump=0
let g:syntastic_mode_map = { 'mode': 'active',
\ 'active_filetypes': ['ruby', 'php', 'javascript'],
\ 'passive_filetypes': ['xhtml', 'html', 'scss', 'scss.css'] }
" Yankring
nnoremap <leader>y :YRShow<CR>
inoremap <leader>y :YRShow<CR>
" Prevent YankRing.vim from polluting $HOME:
let g:yankring_history_dir = '$VIM'
let g:yankring_window_height = 12
" Buffergator
let g:buffergator_display_regime='filepath'
" no default keymappings -- needing for command-t to work
let g:buffergator_suppress_keymaps=1
let g:buffergator_viewport_split_policy='B'
let g:buffergator_split_size=12
nnoremap <leader>b :BuffergatorToggle<cr>
" Tagbar config and keyboard toggler
nmap <F8> :TagbarToggle<CR>
let g:tagbar_autofocus=1
let g:tagbar_autoclose=1
let g:tagbar_compact=1
nnoremap <leader>d :cd %:p:h<CR>:pwd<CR>
" CtrlP
let g:ctrlp_map = '<Leader>t'
let g:ctrlp_working_path_mode = 0
let g:ctrlp_max_height = 12
let g:ctrlp_custom_ignore = '\.git$\|\.hg$\|\.svn$\|\.sass-cache$'
" ========== Custom Pseudofunctions ==========
"
" add json syntax highlighting
au BufNewFile,BufRead *.json set ft=javascript
" typoscript syntax
au BufNewFile,BufRead *.ts set ft=typoscript
" scss
au BufNewFile,BufRead *.scss set ft=scss.css
" Remember last location in file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal g'\"" | endif
endif
" ========== On Save ==========
"
" A function for stripping Whitespace when saving
function! <SID>StripTrailingWhitespaces()
" Preparation: save last search, and cursor position.
let _s=@/
let l = line(".")
let c = col(".")
" Do the business:
%s/\s\+$//e
" Clean up: restore previous search history, and cursor position
let @/=_s
call cursor(l, c)
endfunction
" Don't strip whitespace for files like md,txt or csv/sql - define files here
au BufWritePre *.{php,html,scss,css,js,ts,xml,json,inc,vim,rb} :call <SID>StripTrailingWhitespaces()
Loading…
Cancel
Save