From 54024171b119464fd413a7b10b07d3e89abba68e Mon Sep 17 00:00:00 2001 From: hellerve Date: Thu, 6 Dec 2018 14:23:33 +0100 Subject: [PATCH] all: clean up everything --- gitconfig | 9 +-- pythonrc | 20 +------ vimrc | 167 +----------------------------------------------------- zshrc | 56 ------------------ 4 files changed, 4 insertions(+), 248 deletions(-) diff --git a/gitconfig b/gitconfig index 57244d1..323982f 100644 --- a/gitconfig +++ b/gitconfig @@ -2,10 +2,8 @@ br = branch ca = commit -a cam = commit -am - changes = diff --name-status -r cl = clone co = checkout - contains = branch --contains cr = codereview df = diff exclude = !sh -c 'echo "$1" >> .git/info/exclude' - @@ -15,23 +13,18 @@ lgp = log --pretty=format:'%Cred%h%Creset -- %cn, %cr\t%Cgreen%s%Creset' lol = log --graph --decorate --pretty=oneline --abbrev-commit lola = log --graph --decorate --pretty=oneline --abbrev-commit --all - mnc = merge --no-commit - oneline = log --oneline --decorate pr = "!f() { git fetch origin pull/$1/head && git checkout FETCH_HEAD; }; f" pl = pull ps = push repourl = config --get remote.origin.url shallow = clone --depth=1 st = status - staged = diff --cached tags = for-each-ref --sort='*authordate' --format='%(tag)' refs/tags undo = reset --soft HEAD^ - unpushed = cherry -v update-sub = submodule foreach git pull wdiff = diff --color-words - whatrelease = name-rev --name-only who = shortlog -s -- - wlog = log -p --word-diff=colo + wlog = log -p --word-diff=color [apply] whitespace = fix diff --git a/pythonrc b/pythonrc index 2efec88..83442bb 100644 --- a/pythonrc +++ b/pythonrc @@ -22,22 +22,4 @@ else: sys.ps1 = "2>>> " sys.ps2 = "2... " -def hijack_prompt(): - old_except = sys.excepthook - - def new_except(type, value, traceback): - name_ = type is NameError and value.args[0] in ["name 'q' is not defined", - "name 'e' is not defined"] - syntax_ = type is SyntaxError and value.text in [":q\n", ":e\n"] - - if name_ or syntax_: - print("Moriturus te saluto.") - exit() - - old_except(type, value, traceback) - - sys.excepthook = new_except - -hijack_prompt() - -del readline, histfile, atexit, write_history, sys, os, hijack_prompt +del readline, histfile, atexit, write_history, sys, os diff --git a/vimrc b/vimrc index 98c8531..1f12e55 100644 --- a/vimrc +++ b/vimrc @@ -1,9 +1,5 @@ " General {{{ -if has('python3') - silent! python3 1 -endif - " use indentation for folds set foldmethod=indent set foldnestmax=5 @@ -34,9 +30,6 @@ set formatprg="PARINIT='rTbgqR B=.,?_A_a Q=_s>|' par\ -w72" " Use stylish haskell instead of par for haskell buffers autocmd FileType haskell let &formatprg="stylish-haskell" -" Find custom built ghc-mod, codex etc -let $PATH = $PATH . ':' . expand("~/.haskell-vim-now/bin") - " Kill the damned Ex mode. nnoremap Q @@ -90,16 +83,11 @@ Bundle 'eagletmt/neco-ghc' Bundle 'Twinside/vim-hoogle' " Other programming languages -Bundle 'digitaltoad/vim-jade' Bundle 'zepto-lang/zepto-vim' Bundle 'hellerve/carp-vim' -Bundle 'hellerve/luna-vim' Bundle 'tikhomirov/vim-glsl' Plugin 'rust-lang/rust.vim' -Plugin 'kchmck/vim-coffee-script' Plugin 'isRuslan/vim-es6' -Plugin 'zig-lang/zig.vim' -Plugin 'tpope/vim-fireplace' " Extra Plugin 'editorconfig/editorconfig-vim' @@ -141,7 +129,7 @@ set whichwrap+=<,>,h,l " Ignore case when searching set ignorecase -" When searching try to be smart about cases +" When searching try to be smart about cases set smartcase " Highlight search results @@ -258,11 +246,6 @@ augroup sourcing autocmd bufwritepost .vimrc source $MYVIMRC augroup END -" Map Ctrl-S to save -noremap :update -vnoremap :update -inoremap :update - " Open file prompt with current path nmap e :e =expand("%:p:h") . '/' @@ -323,15 +306,6 @@ noremap k noremap j noremap l -" Disable highlight when is pressed -" but preserve cursor coloring -nmap :noh\|hi Cursor guibg=red -augroup haskell - autocmd! - autocmd FileType haskell map :noh:GhcModTypeClear:SyntasticReset - autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc -augroup END - " Return to last edit position when opening files (You want this!) augroup last_edit autocmd! @@ -343,33 +317,9 @@ augroup END " Remember info about open buffers on close set viminfo^=% -" Open window splits in various places -nmap sh :leftabove vnew -nmap sl :rightbelow vnew -nmap sk :leftabove new -nmap sj :rightbelow new - -" Manually create key mappings (to avoid rebinding C-\) -let g:tmux_navigator_no_mappings = 1 - -nnoremap :TmuxNavigateLeft -nnoremap :TmuxNavigateDown -nnoremap :TmuxNavigateUp -nnoremap :TmuxNavigateRight - " don't close buffers when you aren't displaying them set hidden -" previous buffer, next buffer -nnoremap bp :bp -nnoremap bn :bn - -" delete buffer without closing pane -noremap bd :Bd - -" fuzzy find buffers -noremap b :CtrlPBuffer - " }}} " Status line {{{ @@ -433,14 +383,6 @@ endfunction " }}} -" Slime {{{ - -vmap rs SendSelectionToTmux -nmap rs NormalModeSendToTmux -nmap rv SetTmuxVars - -" }}} - " NERDTree {{{ " Close nerdtree after a file is selected @@ -486,60 +428,6 @@ let g:haskell_tabular = 1 set tags=tags;/,codex.tags;/ -let g:tagbar_type_haskell = { - \ 'ctagsbin' : 'hasktags', - \ 'ctagsargs' : '-x -c -o-', - \ 'kinds' : [ - \ 'm:modules:0:1', - \ 'd:data: 0:1', - \ 'd_gadt: data gadt:0:1', - \ 't:type names:0:1', - \ 'nt:new types:0:1', - \ 'c:classes:0:1', - \ 'cons:constructors:1:1', - \ 'c_gadt:constructor gadt:1:1', - \ 'c_a:constructor accessors:1:1', - \ 'ft:function types:1:1', - \ 'fi:function implementations:0:1', - \ 'o:others:0:1' - \ ], - \ 'sro' : '.', - \ 'kind2scope' : { - \ 'm' : 'module', - \ 'c' : 'class', - \ 'd' : 'data', - \ 't' : 'type' - \ }, - \ 'scope2kind' : { - \ 'module' : 'm', - \ 'class' : 'c', - \ 'data' : 'd', - \ 'type' : 't' - \ } -\ } - -" Generate haskell tags with codex and hscope -map tg :!codex update --force:call system("git hscope -X TemplateHaskell"):call LoadHscope() - -map tt :TagbarToggle - -set csprg=~/.haskell-vim-now/bin/hscope -set csto=1 " search codex tags first -set cst -set csverb -nnoremap :cs find c =expand("") -" Automatically make cscope connections -function! LoadHscope() - let db = findfile("hscope.out", ".;") - if (!empty(db)) - let path = strpart(db, 0, match(db, "/hscope.out$")) - set nocscopeverbose " suppress 'duplicate connection' error - exe "cs add " . db . " " . path - set cscopeverbose - endif -endfunction -au BufEnter /*.hs call LoadHscope() - " }}} " Git {{{ @@ -554,13 +442,6 @@ function! NonintrusiveGitGrep(term) execute "redraw!" endfunction -command! -nargs=1 GGrep call NonintrusiveGitGrep() -nmap gs :Gstatus -nmap gg :copen:GGrep -nmap gl :Extradite! -nmap gd :Gdiff -nmap gb :Gblame - function! CommittedFiles() " Clear quickfix list let qf_list = [] @@ -574,9 +455,6 @@ function! CommittedFiles() call setqflist(qf_list, '') endfunction -" Show list of last-committed files -nnoremap g? :call CommittedFiles():copen - " }}} " Haskell Interrogation {{{ @@ -586,43 +464,10 @@ set completeopt+=longest " Use buffer words as default tab completion let g:SuperTabDefaultCompletionType = '' -" But provide (neco-ghc) omnicompletion -if has("gui_running") - imap =SuperTabAlternateCompletion("\c-x>\c-o>") -else " no gui - if has("unix") - inoremap =SuperTabAlternateCompletion("\c-x>\c-o>") - endif -endif - -" Show types in completion suggestions -let g:necoghc_enable_detailed_browse = 1 - -" Type of expression under cursor -nmap ht :GhcModType -" Insert type of expression under cursor -nmap hT :GhcModTypeInsert -" GHC errors and warnings -nmap hc :SyntasticCheck ghc_mod " Haskell Lint let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['haskell'] } nmap hl :SyntasticCheck hlint -" Hoogle the word under the cursor -nnoremap hh :Hoogle - -" Hoogle and prompt for input -nnoremap hH :Hoogle - -" Hoogle for detailed documentation (e.g. "Functor") -nnoremap hi :HoogleInfo - -" Hoogle for detailed documentation and prompt for input -nnoremap hI :HoogleInfo - -" Hoogle, close the Hoogle window -nnoremap hz :HoogleClose - " }}} " Conversion {{{ @@ -639,13 +484,5 @@ vnoremap h> :call Pointful() " }}} -" Customization {{{ - -if filereadable(expand("~/.vimrc.local")) - source ~/.vimrc.local -endif - -" }}} - let g:syntastic_carp_checkers = ['carp'] -" command Cr !carp -x % +command Cr !carp -x % diff --git a/zshrc b/zshrc index 6a2e6b3..ef90524 100644 --- a/zshrc +++ b/zshrc @@ -38,8 +38,6 @@ export CARP_DIR=$GH_HOME/carp/Carp/ export EDITOR=/usr/bin/vim alias dob="git branch --merged | grep -vE '(\*)|(master)|(dev)' | xargs -n 1 git branch -d" alias vi="stty stop '' -ixoff ; stty erase '^?'; vim" -#alias gcc="gcc-8" -#alias g++="g++-8" alias mk="make" alias g="git" alias virtualenv2="python2.7 /usr/local/lib/python2.7/site-packages/virtualenv.py" @@ -58,7 +56,6 @@ alias cdgo="cd ~/.go/src" alias emptytrash="sudo rm -rfv /Volumes/*/.Trashes; sudo rm -rfv ~/.Trash; sudo rm -rfv /private/var/log/asl/*.asl" alias loc="cloc --read-lang-def=/Users/veitheller/.scripts/cloc.txt *" alias ls="ls -a" -alias quit="exit" alias pbclear="echo -n '' | pbcopy" PROMPT="%{$fg[red]%}%n%{$fg[white]%} at %{$fg[green]%}%m%{$fg[white]%}"$'\n'"=> " @@ -73,12 +70,6 @@ bindkey "Î" expand-or-complete-with-dots precmd () {print -Pn "\e]2; %~/ \a"} preexec () {print -Pn "\e]2; %~/ \a"} -insert_sudo () { - zle beginning-of-line; zle -U "sudo " -} -zle -N insert-sudo insert_sudo -bindkey "^[s" insert-sudo - case $TERM in xterm*) precmd(){print -Pn "\e]0;%m: %~\a"} @@ -119,41 +110,6 @@ function rprompt-git-current-branch { RPROMPT='`rprompt-git-current-branch`' RPROMPT+="%{$fg[white]%}in %{$fg[yellow]%}%~%{$reset_color%}" -extract(){ - if [ -f $1 ] ; then - case $1 in - *.tar.bz2) tar xjf $1 ;; - *.tar.gz) tar xzf $1 ;; - *.tar.xz) tar xzf $1 ;; - *.bz2) bunzip2 $1 ;; - *.rar) unrar x $1 ;; - *.gz) gunzip $1 ;; - *.tar) tar xf $1 ;; - *.tbz2) tar xjf $1 ;; - *.tgz) tar xzf $1 ;; - *.zip) if [ -n $2 ] ; then - unzip $1 -d $2 - else - unzip $1 - fi;; - *.Z) uncompress $1 ;; - *.7z) 7z x $1 ;; - *) echo "'$1' cannot be extracted via extract()" ;; - esac - else - echo "'$1' is not a valid file" - fi -} - -mcd(){ - mkdir -p $1 - cd $1 -} - -pinfo(){ - top -pid `pgrep $1 | tr "\\n" "," | sed 's/,$//' | sed -e's/,/ -pid /g'` -} - save_dotfiles(){ local DOTPATH=~/Documents/Code/Github/.dotfiles/ cp -r ~/.scripts ${DOTPATH} @@ -183,18 +139,6 @@ massif() { valgrind --tool=massif --massif-out-file=massif.prof $1 && ms_print massif.prof | less } -upgrade() { - if [ -x /usr/local/bin/brew ] ; then - brew update - brew upgrade --all - brew cleanup - fi -} - -function tree(){ - find . | sed -e 's/[^\/]*\//|--/g' -e 's/-- |/ |/g' | $PAGER -} - ###-begin-npm-completion-### # # npm command completion script