diff options
| author | Horus3 | 2015-01-30 01:51:06 +0100 |
|---|---|---|
| committer | Horus3 | 2015-01-30 01:51:06 +0100 |
| commit | 335fac46fa9a8b0eee6665dbbc38cfec6ad101e3 (patch) | |
| tree | 62ba2a0782bbd81be0400ea4b6c2be787b68df4b | |
| parent | b1ebf046fb4780fdb90a30b670dc13b5f62b37d1 (diff) | |
| download | dotfiles-335fac46fa9a8b0eee6665dbbc38cfec6ad101e3.tar.gz | |
Added vundle
| -rw-r--r-- | vim/.vim/.netrwhist | 5 | ||||
| m--------- | vim/.vim/bundle/Vundle.vim | 0 | ||||
| m--------- | vim/.vim/bundle/emmet-vim | 0 | ||||
| m--------- | vim/.vim/bundle/vim-go | 0 | ||||
| -rw-r--r-- | vim/.vim/plugin/autoclose.vim | 189 | ||||
| -rw-r--r-- | vim/.vimrc | 19 | ||||
| -rw-r--r-- | zsh/.zsh_aliases | 7 |
7 files changed, 218 insertions, 2 deletions
diff --git a/vim/.vim/.netrwhist b/vim/.vim/.netrwhist new file mode 100644 index 0000000..e33e416 --- /dev/null +++ b/vim/.vim/.netrwhist @@ -0,0 +1,5 @@ +let g:netrw_dirhistmax =10 +let g:netrw_dirhist_cnt =3 +let g:netrw_dirhist_1='/home/horus/test' +let g:netrw_dirhist_2='/home/horus/golang/src/golang/gists/app/controllers' +let g:netrw_dirhist_3='/home/horus/golang/src/revel/notes/app/module/controller' diff --git a/vim/.vim/bundle/Vundle.vim b/vim/.vim/bundle/Vundle.vim new file mode 160000 +Subproject 0b28e334e65b6628b0a61c412fcb45204a2f2ba diff --git a/vim/.vim/bundle/emmet-vim b/vim/.vim/bundle/emmet-vim new file mode 160000 +Subproject e1f2f00a5ce5c60c13b38e89f31fae30ebb8df8 diff --git a/vim/.vim/bundle/vim-go b/vim/.vim/bundle/vim-go new file mode 160000 +Subproject f3b757d4150cbe018a8a02ef1c484f161dde968 diff --git a/vim/.vim/plugin/autoclose.vim b/vim/.vim/plugin/autoclose.vim new file mode 100644 index 0000000..957399e --- /dev/null +++ b/vim/.vim/plugin/autoclose.vim @@ -0,0 +1,189 @@ +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" AutoClose.vim - Automatically close pair of characters: ( with ), [ with ], { with }, etc. +" Version: 1.1 +" Author: Thiago Alves <thiago.salves@gmail.com> +" Maintainer: Thiago Alves <thiago.salves@gmail.com> +" URL: http://thiagoalves.org +" Licence: This script is released under the Vim License. +" Last modified: 08/25/2008 +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" + +let s:debug = 1 + +" check if script is already loaded +if s:debug == 0 && exists("g:loaded_AutoClose") + finish "stop loading the script" +endif +let g:loaded_AutoClose = 1 + +let s:global_cpo = &cpo " store compatible-mode in local variable +set cpo&vim " go into nocompatible-mode + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Functions +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +function! s:GetNextChar() + if col('$') == col('.') + return "\0" + endif + return strpart(getline('.'), col('.')-1, 1) +endfunction + +function! s:GetPrevChar() + if col('.') == 1 + return "\0" + endif + return strpart(getline('.'), col('.')-2, 1) +endfunction + +function! s:IsEmptyPair() + let l:prev = s:GetPrevChar() + let l:next = s:GetNextChar() + if l:prev == "\0" || l:next == "\0" + return 0 + endif + return get(s:charsToClose, l:prev, "\0") == l:next +endfunction + +function! s:GetCurrentSyntaxRegion() + return synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') +endfunction + +function! s:GetCurrentSyntaxRegionIf(char) + let l:origin_line = getline('.') + let l:changed_line = strpart(l:origin_line, 0, col('.')-1) . a:char . strpart(l:origin_line, col('.')-1) + call setline('.', l:changed_line) + let l:region = synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name') + call setline('.', l:origin_line) + return l:region +endfunction + +function! s:IsForbidden(char) + let l:result = index(s:protectedRegions, s:GetCurrentSyntaxRegion()) >= 0 + if l:result + return l:result + endif + let l:region = s:GetCurrentSyntaxRegionIf(a:char) + let l:result = index(s:protectedRegions, l:region) >= 0 + return l:result && l:region == 'Comment' +endfunction + +function! s:InsertPair(char) + let l:next = s:GetNextChar() + let l:result = a:char + if s:running && !s:IsForbidden(a:char) && (l:next == "\0" || l:next !~ '\w') + let l:result .= s:charsToClose[a:char] . "\<Left>" + endif + return l:result +endfunction + +function! s:ClosePair(char) + if s:running && s:GetNextChar() == a:char + let l:result = "\<Right>" + else + let l:result = a:char + endif + return l:result +endfunction + +function! s:CheckPair(char) + let l:lastpos = 0 + let l:occur = stridx(getline('.'), a:char, l:lastpos) == 0 ? 1 : 0 + + while l:lastpos > -1 + let l:lastpos = stridx(getline('.'), a:char, l:lastpos+1) + if l:lastpos > col('.')-2 + break + endif + if l:lastpos >= 0 + let l:occur += 1 + endif + endwhile + + if l:occur == 0 || l:occur%2 == 0 + " Opening char + return s:InsertPair(a:char) + else + " Closing char + return s:ClosePair(a:char) + endif +endfunction + +function! s:Backspace() + if s:running && s:IsEmptyPair() + return "\<BS>\<Del>" + endif + return "\<BS>" +endfunction + +function! s:ToggleAutoClose() + let s:running = !s:running + if s:running + echo "AutoClose ON" + else + echo "AutoClose OFF" + endif +endfunction + +function! s:SetVEAll() + let s:save_ve = &ve + set ve=all + return "" +endfunction + +function! s:RestoreVE() + exec "set ve=" . s:save_ve + unlet s:save_ve + return "" +endfunction + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" Configuration +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" let user define which character he/she wants to autocomplete +if exists("g:AutoClosePairs") && type(g:AutoClosePairs) == type({}) + let s:charsToClose = g:AutoClosePairs + unlet g:AutoClosePairs +else + let s:charsToClose = {'(': ')', '{': '}', '[': ']', '"': '"', "'": "'"} +endif + +" let user define in which regions the autocomplete feature should not occur +if exists("g:AutoCloseProtectedRegions") && type(g:AutoCloseProtectedRegions) == type([]) + let s:protectedRegions = g:AutoCloseProtectedRegions + unlet g:AutoCloseProtectedRegions +else + let s:protectedRegions = ["Comment", "String", "Character"] +endif + +" let user define if he/she wants the plugin turned on when vim start. Defaul is YES +if exists("g:AutoCloseOn") && type(g:AutoCloseOn) == type(0) + let s:running = g:AutoCloseOn + unlet g:AutoCloseOn +else + let s:running = 1 +endif + +" create appropriate maps to defined open/close characters +for key in keys(s:charsToClose) + if key == '"' + let open_func_arg = '"\""' + let close_func_arg = '"\""' + else + let open_func_arg = '"' . key . '"' + let close_func_arg = '"' . s:charsToClose[key] . '"' + endif + + if key == s:charsToClose[key] + exec "inoremap <silent> " . key . " <C-R>=<SID>SetVEAll()<CR><C-R>=<SID>CheckPair(" . open_func_arg . ")<CR><C-R>=<SID>RestoreVE()<CR>" + else + exec "inoremap <silent> " . s:charsToClose[key] . " <C-R>=<SID>SetVEAll()<CR><C-R>=<SID>ClosePair(" . close_func_arg . ")<CR><C-R>=<SID>RestoreVE()<CR>" + exec "inoremap <silent> " . key . " <C-R>=<SID>SetVEAll()<CR><C-R>=<SID>InsertPair(" . open_func_arg . ")<CR><C-R>=<SID>RestoreVE()<CR>" + endif +endfor +exec "inoremap <silent> <BS> <C-R>=<SID>SetVEAll()<CR><C-R>=<SID>Backspace()<CR><C-R>=<SID>RestoreVE()<CR>" + +" Define convenient commands +command! AutoCloseOn :let s:running = 1 +command! AutoCloseOff :let s:running = 0 +command! AutoCloseToggle :call s:ToggleAutoClose() @@ -1,3 +1,17 @@ +set nocompatible " be iMproved, required +filetype off " required + +" set the runtime path to include Vundle and initialize +set rtp+=~/.vim/bundle/Vundle.vim +call vundle#begin()" + +Plugin 'gmarik/Vundle.vim' +Plugin 'fatih/vim-go' +Plugin 'mattn/emmet-vim' + +call vundle#end() " required +filetype plugin indent on " required + set number set ruler set ignorecase @@ -11,12 +25,13 @@ set matchpairs=(:),{:},[:],<:> set background=dark syntax enable -syntax on -set background=dark set encoding=utf8 "map! jj <ESC> + command W w command Q q command WQ wq command Wq wq + + diff --git a/zsh/.zsh_aliases b/zsh/.zsh_aliases index a330ec7..a8af444 100644 --- a/zsh/.zsh_aliases +++ b/zsh/.zsh_aliases @@ -18,3 +18,10 @@ alias down='sudo shutdown -hP now' alias df='df -h' alias dus='du -s' alias lll='ls -lisa' +alias undopush="git push -f origin HEAD^:master" +alias timer='echo "Timer started. Stop with Ctrl-D." && date && time cat && date' +# View HTTP traffic +alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'" +alias httpdump="sudo tcpdump -i en1 -n -s 0 -w - | grep -a -o -E \"Host\: .*|GET \/.*\"" +alias g="git" +alias v="vim" |
