Major rework on vim and zsh
This commit is contained in:
4
Makefile
4
Makefile
@@ -4,6 +4,7 @@ bash:
|
||||
cp bash_profile ~/.bash_profile
|
||||
|
||||
ghc:
|
||||
cp -r cabal ~/.cabal
|
||||
cp ghci ~/.ghci
|
||||
|
||||
git:
|
||||
@@ -21,7 +22,8 @@ valgrind:
|
||||
cp valgrindrc ~/.valgrindrc
|
||||
|
||||
vim:
|
||||
cp vimrc ~/.vimrc
|
||||
cp vimrc ~/.vimrc.local
|
||||
cp -r vim ~/.vim
|
||||
|
||||
zsh:
|
||||
cp zshrc ~/.zshrc
|
||||
|
1
ghci
1
ghci
@@ -7,3 +7,4 @@ let ghciEscapeShellArg arg = "'" ++ concatMap (\c -> if c == '\'' then "'\"'\"'"
|
||||
|
||||
:def! h return . (":! hoogle --color --count=20 " ++) . ghciEscapeShellArg
|
||||
:def! doc return . (":! hoogle --info " ++) . ghciEscapeShellArg
|
||||
:def! hlint const . return $":! hlint \"src\""
|
||||
|
1
pythonrc
1
pythonrc
@@ -14,4 +14,5 @@ def write_history(readline=readline, histfile=histfile):
|
||||
except IOError:
|
||||
pass
|
||||
atexit.register(write_history)
|
||||
|
||||
del readline, histfile, atexit, write_history, sys, os
|
||||
|
677
vimrc
677
vimrc
@@ -1,131 +1,388 @@
|
||||
set clipboard=unnamed
|
||||
set enc=utf-8
|
||||
set fileencoding=utf-8
|
||||
set fileencodings=ucs-bom,utf8,prc
|
||||
set guifont=Monaco:h11
|
||||
set guifontwide=NSimsun:h12
|
||||
" General {{{
|
||||
|
||||
" use indentation for folds
|
||||
set foldmethod=indent
|
||||
set foldnestmax=5
|
||||
set foldlevelstart=99
|
||||
set foldcolumn=0
|
||||
|
||||
|
||||
" Sets how many lines of history VIM has to remember
|
||||
set history=700
|
||||
filetype plugin on
|
||||
filetype indent on
|
||||
|
||||
" Set to auto read when a file is changed from the outside
|
||||
set autoread
|
||||
|
||||
" With a map leader it's possible to do extra key combinations
|
||||
" like <leader>w saves the current file
|
||||
let mapleader = ","
|
||||
let g:mapleader = ","
|
||||
nmap <leader>w :w!<cr>
|
||||
|
||||
" Leader key timeout
|
||||
set tm=2000
|
||||
|
||||
" Allow the normal use of "," by pressing it twice
|
||||
noremap ,, ,
|
||||
|
||||
" Use par for prettier line formatting
|
||||
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 <nop>
|
||||
|
||||
" }}}
|
||||
|
||||
" Vundle {{{
|
||||
|
||||
set nocompatible
|
||||
filetype off
|
||||
set rtp+=~/.vim/bundle/vundle/
|
||||
call vundle#rc()
|
||||
|
||||
" let Vundle manage Vundle
|
||||
" required!
|
||||
Bundle 'gmarik/vundle'
|
||||
|
||||
" Support bundles
|
||||
Bundle 'jgdavey/tslime.vim'
|
||||
Bundle 'Shougo/vimproc.vim'
|
||||
Bundle 'ervandew/supertab'
|
||||
Bundle 'scrooloose/syntastic'
|
||||
Bundle 'moll/vim-bbye'
|
||||
Bundle 'nathanaelkane/vim-indent-guides'
|
||||
Bundle 'vim-scripts/gitignore'
|
||||
|
||||
" Git
|
||||
Bundle 'tpope/vim-fugitive'
|
||||
Bundle 'int3/vim-extradite'
|
||||
|
||||
" Bars, panels, and files
|
||||
Bundle 'scrooloose/nerdtree'
|
||||
Bundle 'bling/vim-airline'
|
||||
Bundle 'kien/ctrlp.vim'
|
||||
Bundle 'majutsushi/tagbar'
|
||||
|
||||
" Text manipulation
|
||||
Bundle 'vim-scripts/Align'
|
||||
Bundle 'vim-scripts/Gundo'
|
||||
Bundle 'tpope/vim-commentary'
|
||||
Bundle 'godlygeek/tabular'
|
||||
Bundle 'michaeljsmith/vim-indent-object'
|
||||
|
||||
" Allow pane movement to jump out of vim into tmux
|
||||
Bundle 'christoomey/vim-tmux-navigator'
|
||||
|
||||
" Haskell
|
||||
Bundle 'raichoo/haskell-vim'
|
||||
Bundle 'enomsg/vim-haskellConcealPlus'
|
||||
Bundle 'eagletmt/ghcmod-vim'
|
||||
Bundle 'eagletmt/neco-ghc'
|
||||
Bundle 'Twinside/vim-hoogle'
|
||||
|
||||
" Custom bundles
|
||||
if filereadable(expand("~/.vim.local/bundles.vim"))
|
||||
source ~/.vim.local/bundles.vim
|
||||
endif
|
||||
|
||||
" }}}
|
||||
|
||||
" VIM user interface {{{
|
||||
|
||||
" Set 7 lines to the cursor - when moving vertically using j/k
|
||||
set so=7
|
||||
|
||||
" Turn on the WiLd menu
|
||||
set wildmenu
|
||||
set wildignore=*.o,*~,*.pyc
|
||||
" Tab-complete files up to longest unambiguous prefix
|
||||
set wildmode=list:longest,full
|
||||
|
||||
" Always show current position
|
||||
set ruler
|
||||
set cmdheight=2
|
||||
set hid
|
||||
|
||||
" Show trailing whitespace
|
||||
set list
|
||||
" But only interesting whitespace
|
||||
if &listchars ==# 'eol:$'
|
||||
set listchars=tab:>\ ,trail:-,extends:>,precedes:<,nbsp:+
|
||||
endif
|
||||
|
||||
" Height of the command bar
|
||||
set cmdheight=1
|
||||
|
||||
" Configure backspace so it acts as it should act
|
||||
set backspace=eol,start,indent
|
||||
set whichwrap+=<,>,h,l
|
||||
|
||||
" Ignore case when searching
|
||||
set ignorecase
|
||||
|
||||
" When searching try to be smart about cases
|
||||
set smartcase
|
||||
|
||||
" Highlight search results
|
||||
set hlsearch
|
||||
|
||||
" Makes search act like search in modern browsers
|
||||
set incsearch
|
||||
|
||||
" Don't redraw while executing macros (good performance config)
|
||||
set lazyredraw
|
||||
|
||||
" For regular expressions turn magic on
|
||||
set magic
|
||||
|
||||
" Show matching brackets when text indicator is over them
|
||||
set showmatch
|
||||
" How many tenths of a second to blink when matching brackets
|
||||
set mat=2
|
||||
|
||||
" No annoying sound on errors
|
||||
set noerrorbells
|
||||
set novisualbell
|
||||
set t_vb=
|
||||
set tm=500
|
||||
syntax enable
|
||||
set vb t_vb=
|
||||
|
||||
if &term =~ '256color'
|
||||
" disable Background Color Erase (BCE) so that color schemes
|
||||
" render properly when inside 256-color tmux and GNU screen.
|
||||
" see also http://snk.tuxfamily.org/log/vim-256color-bce.html
|
||||
set t_ut=
|
||||
endif
|
||||
|
||||
" Force redraw
|
||||
map <silent> <leader>r :redraw!<CR>
|
||||
|
||||
" Turn mouse mode on
|
||||
nnoremap <leader>ma :set mouse=a<cr>
|
||||
|
||||
" Turn mouse mode off
|
||||
nnoremap <leader>mo :set mouse=<cr>
|
||||
|
||||
" Default to mouse mode on
|
||||
set mouse=a
|
||||
" }}}
|
||||
|
||||
" Colors and Fonts {{{
|
||||
|
||||
Bundle 'vim-scripts/wombat256.vim'
|
||||
try
|
||||
colorscheme desert
|
||||
set background=dark
|
||||
catch
|
||||
endtry
|
||||
|
||||
" Enable syntax highlighting
|
||||
syntax enable
|
||||
|
||||
" Adjust signscolumn and syntastic to match wombat
|
||||
hi! link SignColumn LineNr
|
||||
hi! link SyntasticErrorSign ErrorMsg
|
||||
hi! link SyntasticWarningSign WarningMsg
|
||||
|
||||
" Use pleasant but very visible search hilighting
|
||||
hi Search ctermfg=white ctermbg=173 cterm=none guifg=#ffffff guibg=#e5786d gui=none
|
||||
hi! link Visual Search
|
||||
|
||||
" Enable filetype plugins
|
||||
filetype plugin on
|
||||
filetype indent on
|
||||
|
||||
" Match wombat colors in nerd tree
|
||||
hi Directory guifg=#8ac6f2
|
||||
|
||||
" Searing red very visible cursor
|
||||
hi Cursor guibg=red
|
||||
|
||||
" Use same color behind concealed unicode characters
|
||||
hi clear Conceal
|
||||
|
||||
" Don't blink normal mode cursor
|
||||
set guicursor=n-v-c:block-Cursor
|
||||
set guicursor+=n-v-c:blinkon0
|
||||
|
||||
" Set extra options when running in GUI mode
|
||||
if has("gui_running")
|
||||
set guioptions-=T
|
||||
set guioptions+=e
|
||||
set t_Co=256
|
||||
set guioptions-=e
|
||||
set guitablabel=%M\ %t
|
||||
endif
|
||||
set t_Co=256
|
||||
|
||||
" Set utf8 as standard encoding and en_US as the standard language
|
||||
set encoding=utf8
|
||||
|
||||
" Use Unix as the standard file type
|
||||
set ffs=unix,dos,mac
|
||||
|
||||
" Use large font by default in MacVim
|
||||
set gfn=Monaco:h19
|
||||
|
||||
" }}}
|
||||
|
||||
" Files, backups and undo {{{
|
||||
|
||||
" Turn backup off, since most stuff is in Git anyway...
|
||||
set nobackup
|
||||
set nowb
|
||||
set noswapfile
|
||||
|
||||
" Source the vimrc file after saving it
|
||||
augroup sourcing
|
||||
autocmd!
|
||||
autocmd bufwritepost .vimrc source $MYVIMRC
|
||||
augroup END
|
||||
|
||||
" Open file prompt with current path
|
||||
nmap <leader>e :e <C-R>=expand("%:p:h") . '/'<CR>
|
||||
|
||||
" Show undo tree
|
||||
nmap <silent> <leader>u :GundoToggle<CR>
|
||||
|
||||
" Fuzzy find files
|
||||
nnoremap <silent> <Leader><space> :CtrlP<CR>
|
||||
let g:ctrlp_max_files=0
|
||||
let g:ctrlp_show_hidden=1
|
||||
let g:ctrlp_custom_ignore = { 'dir': '\v[\/](.git)$' }
|
||||
|
||||
" }}}
|
||||
|
||||
" Text, tab and indent related {{{
|
||||
|
||||
" Use spaces instead of tabs
|
||||
set expandtab
|
||||
|
||||
" Be smart when using tabs ;)
|
||||
set smarttab
|
||||
set shiftwidth=4
|
||||
set tabstop=4
|
||||
|
||||
" 1 tab == 2 spaces
|
||||
set shiftwidth=2
|
||||
set tabstop=2
|
||||
|
||||
" Linebreak on 500 characters
|
||||
set lbr
|
||||
set tw=500
|
||||
|
||||
set ai "Auto indent
|
||||
set si "Smart indent
|
||||
set wrap "Wrap lines
|
||||
cnoreabbrev hex %!xxd
|
||||
vnoremap <silent> * :call VisualSelection('f')<CR>
|
||||
vnoremap <silent> # :call VisualSelection('b')<CR>
|
||||
map j gj
|
||||
map k gk
|
||||
map <space> /
|
||||
map <c-space> ?
|
||||
map <silent> <leader><cr> :noh<cr>
|
||||
map <C-j> <C-W>j
|
||||
map <C-k> <C-W>k
|
||||
map <C-h> <C-W>h
|
||||
map <C-l> <C-W>l
|
||||
map <leader>bd :Bclose<cr>
|
||||
map <leader>ba :1,1000 bd!<cr>
|
||||
map <leader>tn :tabnew<cr>
|
||||
map <leader>to :tabonly<cr>
|
||||
map <leader>tc :tabclose<cr>
|
||||
map <leader>tm :tabmove
|
||||
map <leader>te :tabedit <c-r>=expand("%:p:h")<cr>/
|
||||
map <leader>cd :cd %:p:h<cr>:pwd<cr>
|
||||
try
|
||||
set switchbuf=useopen,usetab,newtab
|
||||
set stal=2
|
||||
catch
|
||||
endtry
|
||||
|
||||
" Pretty unicode haskell symbols
|
||||
let g:haskell_conceal_wide = 1
|
||||
let g:haskell_conceal_enumerations = 1
|
||||
|
||||
" }}}
|
||||
|
||||
" Visual mode related {{{
|
||||
|
||||
" Visual mode pressing * or # searches for the current selection
|
||||
" Super useful! From an idea by Michael Naumann
|
||||
vnoremap <silent> * :call VisualSelection('f', '')<CR>
|
||||
vnoremap <silent> # :call VisualSelection('b', '')<CR>
|
||||
|
||||
" }}}
|
||||
|
||||
" Moving around, tabs, windows and buffers {{{
|
||||
|
||||
" Treat long lines as break lines (useful when moving around in them)
|
||||
nnoremap j gj
|
||||
nnoremap k gk
|
||||
|
||||
noremap <c-h> <c-w>h
|
||||
noremap <c-k> <c-w>k
|
||||
noremap <c-j> <c-w>j
|
||||
noremap <c-l> <c-w>l
|
||||
|
||||
" Disable highlight when <leader><cr> is pressed
|
||||
" but preserve cursor coloring
|
||||
nmap <silent> <leader><cr> :noh\|hi Cursor guibg=red<cr>
|
||||
augroup haskell
|
||||
autocmd!
|
||||
autocmd FileType haskell map <silent> <leader><cr> :noh<cr>:GhcModTypeClear<cr>:SyntasticReset<cr>
|
||||
autocmd FileType haskell setlocal omnifunc=necoghc#omnifunc
|
||||
augroup END
|
||||
|
||||
" Return to last edit position when opening files (You want this!)
|
||||
augroup last_edit
|
||||
autocmd!
|
||||
autocmd BufReadPost *
|
||||
\ if line("'\"") > 0 && line("'\"") <= line("$") |
|
||||
\ exe "normal! g`\"" |
|
||||
\ endif
|
||||
augroup END
|
||||
" Remember info about open buffers on close
|
||||
set viminfo^=%
|
||||
|
||||
" Open window splits in various places
|
||||
nmap <leader>sh :leftabove vnew<CR>
|
||||
nmap <leader>sl :rightbelow vnew<CR>
|
||||
nmap <leader>sk :leftabove new<CR>
|
||||
nmap <leader>sj :rightbelow new<CR>
|
||||
|
||||
" Manually create key mappings (to avoid rebinding C-\)
|
||||
let g:tmux_navigator_no_mappings = 1
|
||||
|
||||
nnoremap <silent> <C-h> :TmuxNavigateLeft<cr>
|
||||
nnoremap <silent> <C-j> :TmuxNavigateDown<cr>
|
||||
nnoremap <silent> <C-k> :TmuxNavigateUp<cr>
|
||||
nnoremap <silent> <C-l> :TmuxNavigateRight<cr>
|
||||
|
||||
" don't close buffers when you aren't displaying them
|
||||
set hidden
|
||||
|
||||
" previous buffer, next buffer
|
||||
nnoremap <leader>bp :bp<cr>
|
||||
nnoremap <leader>bn :bn<cr>
|
||||
|
||||
" delete buffer without closing pane
|
||||
noremap <leader>bd :Bd<cr>
|
||||
|
||||
" fuzzy find buffers
|
||||
noremap <leader>b<space> :CtrlPBuffer<cr>
|
||||
|
||||
" }}}
|
||||
|
||||
" Status line {{{
|
||||
|
||||
" Always show the status line
|
||||
set laststatus=2
|
||||
set statusline=\ %{HasPaste()}%F%m%r%h\ %w\ \ CWD:\ %r%{getcwd()}%h\ \ \ Line:\ %l/%L\ \ Column:\ %c
|
||||
map 0 ^
|
||||
nmap <M-j> mz:m+<cr>`z
|
||||
nmap <M-k> mz:m-2<cr>`z
|
||||
vmap <M-j> :m'>+<cr>`<my`>mzgv`yo`z
|
||||
vmap <M-k> :m'<-2<cr>`>my`<mzgv`yo`z
|
||||
if has("mac") || has("macunix")
|
||||
nmap <D-j> <M-j>
|
||||
nmap <D-k> <M-k>
|
||||
vmap <D-j> <M-j>
|
||||
vmap <D-k> <M-k>
|
||||
endif
|
||||
|
||||
" }}}
|
||||
|
||||
" Editing mappings {{{
|
||||
|
||||
" Delete trailing white space on save
|
||||
func! DeleteTrailingWS()
|
||||
exe "normal mz"
|
||||
%s/\s\+$//ge
|
||||
exe "normal `z"
|
||||
endfunc
|
||||
autocmd BufWrite *.py :call DeleteTrailingWS()
|
||||
autocmd BufWrite *.coffee :call DeleteTrailingWS()
|
||||
vnoremap <silent> gv :call VisualSelection('gv')<CR>
|
||||
map <leader>g :vimgrep // **/*.<left><left><left><left><left><left><left>
|
||||
map <leader><space> :vimgrep // <C-R>%<C-A><right><right><right><right><right><right><right><right><right>
|
||||
vnoremap <silent> <leader>r :call VisualSelection('replace')<CR>
|
||||
map <leader>cc :botright cope<cr>
|
||||
map <leader>co ggVGy:tabnew<cr>:set syntax=qf<cr>pgg
|
||||
map <leader>n :cn<cr>
|
||||
map <leader>p :cp<cr>
|
||||
|
||||
augroup whitespace
|
||||
autocmd!
|
||||
autocmd BufWrite *.hs :call DeleteTrailingWS()
|
||||
augroup END
|
||||
|
||||
" }}}
|
||||
|
||||
" Spell checking {{{
|
||||
|
||||
" Pressing ,ss will toggle and untoggle spell checking
|
||||
map <leader>ss :setlocal spell!<cr>
|
||||
map <leader>sn ]s
|
||||
map <leader>sp [s
|
||||
map <leader>sa zg
|
||||
map <leader>s? z=
|
||||
noremap <Leader>m mmHmt:%s/<C-V><cr>//ge<cr>'tzt'm
|
||||
map <leader>q :e ~/buffer<cr>
|
||||
map <leader>pp :setlocal paste!<cr>
|
||||
|
||||
" }}}
|
||||
|
||||
" Helper functions {{{
|
||||
|
||||
function! CmdLine(str)
|
||||
exe "menu Foo.Bar :" . a:str
|
||||
emenu Foo.Bar
|
||||
unmenu Foo
|
||||
endfunction
|
||||
function! VisualSelection(direction) range
|
||||
|
||||
function! VisualSelection(direction, extra_filter) range
|
||||
let l:saved_reg = @"
|
||||
execute "normal! vgvy"
|
||||
|
||||
@@ -135,7 +392,7 @@ function! VisualSelection(direction) range
|
||||
if a:direction == 'b'
|
||||
execute "normal ?" . l:pattern . "^M"
|
||||
elseif a:direction == 'gv'
|
||||
call CmdLine("vimgrep " . '/'. l:pattern . '/' . ' **/*.')
|
||||
call CmdLine("vimgrep " . '/'. l:pattern . '/' . ' **/*.' . a:extra_filter)
|
||||
elseif a:direction == 'replace'
|
||||
call CmdLine("%s" . '/'. l:pattern . '/')
|
||||
elseif a:direction == 'f'
|
||||
@@ -145,83 +402,219 @@ function! VisualSelection(direction) range
|
||||
let @/ = l:pattern
|
||||
let @" = l:saved_reg
|
||||
endfunction
|
||||
function! HasPaste()
|
||||
if &paste
|
||||
return 'PASTE MODE '
|
||||
en
|
||||
return ''
|
||||
endfunction
|
||||
command! Bclose call <SID>BufcloseCloseIt()
|
||||
function! <SID>BufcloseCloseIt()
|
||||
let l:currentBufNum = bufnr("%")
|
||||
let l:alternateBufNum = bufnr("#")
|
||||
|
||||
if buflisted(l:alternateBufNum)
|
||||
buffer #
|
||||
" }}}
|
||||
|
||||
" Slime {{{
|
||||
|
||||
vmap <silent> <Leader>rs <Plug>SendSelectionToTmux
|
||||
nmap <silent> <Leader>rs <Plug>NormalModeSendToTmux
|
||||
nmap <silent> <Leader>rv <Plug>SetTmuxVars
|
||||
|
||||
" }}}
|
||||
|
||||
" NERDTree {{{
|
||||
|
||||
" Close nerdtree after a file is selected
|
||||
let NERDTreeQuitOnOpen = 1
|
||||
|
||||
function! IsNERDTreeOpen()
|
||||
return exists("t:NERDTreeBufName") && (bufwinnr(t:NERDTreeBufName) != -1)
|
||||
endfunction
|
||||
|
||||
function! ToggleFindNerd()
|
||||
if IsNERDTreeOpen()
|
||||
exec ':NERDTreeToggle'
|
||||
else
|
||||
bnext
|
||||
endif
|
||||
|
||||
if bufnr("%") == l:currentBufNum
|
||||
new
|
||||
endif
|
||||
|
||||
if buflisted(l:currentBufNum)
|
||||
execute("bdelete! ".l:currentBufNum)
|
||||
exec ':NERDTreeFind'
|
||||
endif
|
||||
endfunction
|
||||
" Commenting blocks of code.
|
||||
autocmd FileType c,cpp,java,scala,javascript let b:comment_leader = '// '
|
||||
autocmd FileType sh,ruby,python let b:comment_leader = '# '
|
||||
autocmd FileType conf,fstab let b:comment_leader = '# '
|
||||
autocmd FileType tex let b:comment_leader = '% '
|
||||
autocmd FileType vim let b:comment_leader = '" '
|
||||
noremap <leader>cc :<C-B><C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
|
||||
noremap <leader>cu :<C-B><C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
|
||||
vnoremap <leader>cc :<C-B><C-E>s/^/<C-R>=escape(b:comment_leader,'\/')<CR>/<CR>:nohlsearch<CR>
|
||||
vnoremap <leader>cu :<C-B><C-E>s/^\V<C-R>=escape(b:comment_leader,'\/')<CR>//e<CR>:nohlsearch<CR>
|
||||
|
||||
highlight ColorColumn ctermbg=magenta
|
||||
call matchadd('ColorColumn', '\%80v', 100)
|
||||
" If nerd tree is closed, find current file, if open, close it
|
||||
nmap <silent> <leader>f <ESC>:call ToggleFindNerd()<CR>
|
||||
nmap <silent> <leader>F <ESC>:NERDTreeToggle<CR>
|
||||
|
||||
nnoremap <silent> n n:call HLNext(0.4)<cr>
|
||||
nnoremap <silent> N N:call HLNext(0.4)<cr>
|
||||
" }}}
|
||||
|
||||
highlight WhiteOnRed ctermbg=red ctermfg=white
|
||||
" Alignment {{{
|
||||
|
||||
function! HLNext(blinktime)
|
||||
let [bufnum, lnum, col, off] = getpos('.')
|
||||
let machlen = strlen(matchstr(strpart(getline('.'), col-1),@/))
|
||||
let target_pat = '\c\%#'.@/
|
||||
let blinks = 3
|
||||
for n in range(1, blinks)
|
||||
let red = matchadd('WhiteOnRed', target_pat, 101)
|
||||
redraw
|
||||
exec 'sleep ' . float2nr(a:blinktime / (2*blinks) * 1000) . 'm'
|
||||
call matchdelete(red)
|
||||
redraw
|
||||
exec 'sleep ' . float2nr(a:blinktime / (2*blinks) * 1000) . 'm'
|
||||
" Stop Align plugin from forcing its mappings on us
|
||||
let g:loaded_AlignMapsPlugin=1
|
||||
" Align on equal signs
|
||||
map <Leader>a= :Align =<CR>
|
||||
" Align on commas
|
||||
map <Leader>a, :Align ,<CR>
|
||||
" Align on pipes
|
||||
map <Leader>a<bar> :Align <bar><CR>
|
||||
" Prompt for align character
|
||||
map <leader>ap :Align
|
||||
|
||||
" Enable some tabular presets for Haskell
|
||||
let g:haskell_tabular = 1
|
||||
|
||||
" }}}
|
||||
|
||||
" Tags {{{
|
||||
|
||||
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 <leader>tg :!codex update --force<CR>:call system("git hscope -X TemplateHaskell")<CR><CR>:call LoadHscope()<CR>
|
||||
|
||||
map <leader>tt :TagbarToggle<CR>
|
||||
|
||||
set csprg=~/.haskell-vim-now/bin/hscope
|
||||
set csto=1 " search codex tags first
|
||||
set cst
|
||||
set csverb
|
||||
nnoremap <silent> <C-\> :cs find c <C-R>=expand("<cword>")<CR><CR>
|
||||
" 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 {{{
|
||||
|
||||
let g:extradite_width = 60
|
||||
" Hide messy Ggrep output and copen automatically
|
||||
function! NonintrusiveGitGrep(term)
|
||||
execute "copen"
|
||||
" Map 't' to open selected item in new tab
|
||||
execute "nnoremap <silent> <buffer> t <C-W><CR><C-W>T"
|
||||
execute "silent! Ggrep " . a:term
|
||||
execute "redraw!"
|
||||
endfunction
|
||||
|
||||
command! -nargs=1 GGrep call NonintrusiveGitGrep(<q-args>)
|
||||
nmap <leader>gs :Gstatus<CR>
|
||||
nmap <leader>gg :copen<CR>:GGrep
|
||||
nmap <leader>gl :Extradite!<CR>
|
||||
nmap <leader>gd :Gdiff<CR>
|
||||
nmap <leader>gb :Gblame<CR>
|
||||
|
||||
function! CommittedFiles()
|
||||
" Clear quickfix list
|
||||
let qf_list = []
|
||||
" Find files committed in HEAD
|
||||
let git_output = system("git diff-tree --no-commit-id --name-only -r HEAD\n")
|
||||
for committed_file in split(git_output, "\n")
|
||||
let qf_item = {'filename': committed_file}
|
||||
call add(qf_list, qf_item)
|
||||
endfor
|
||||
" Fill quickfix list with them
|
||||
call setqflist(qf_list, '')
|
||||
endfunction
|
||||
|
||||
" VimScript Highlighting is so fucking distracting
|
||||
augroup VimNoHighlight
|
||||
autocmd!
|
||||
autocmd BufEnter .vimrc syntax off
|
||||
augroup END
|
||||
" Show list of last-committed files
|
||||
nnoremap <silent> <leader>g? :call CommittedFiles()<CR>:copen<CR>
|
||||
|
||||
augroup NoEdits
|
||||
autocmd!
|
||||
autocmd SwapExists * let v:swapchoice = 'o'
|
||||
autocmd SwapExists * echomsg ErrorMsg
|
||||
autocmd SwapExists * echo 'Duplicate edit session (you are now editing readonly)'
|
||||
autocmd SwapExists * echohl None
|
||||
augroup END
|
||||
" }}}
|
||||
|
||||
inoremap <expr> <C-K> ShowDigraphs
|
||||
" Haskell Interrogation {{{
|
||||
|
||||
function! ShowDigraphs()
|
||||
digraphs
|
||||
call getchar()
|
||||
return "\<C-K>"
|
||||
set completeopt+=longest
|
||||
|
||||
" Use buffer words as default tab completion
|
||||
let g:SuperTabDefaultCompletionType = '<c-x><c-p>'
|
||||
|
||||
" But provide (neco-ghc) omnicompletion
|
||||
if has("gui_running")
|
||||
imap <c-space> <c-r>=SuperTabAlternateCompletion("\<lt>c-x>\<lt>c-o>")<cr>
|
||||
else " no gui
|
||||
if has("unix")
|
||||
inoremap <Nul> <c-r>=SuperTabAlternateCompletion("\<lt>c-x>\<lt>c-o>")<cr>
|
||||
endif
|
||||
endif
|
||||
|
||||
" Show types in completion suggestions
|
||||
let g:necoghc_enable_detailed_browse = 1
|
||||
|
||||
" Type of expression under cursor
|
||||
nmap <silent> <leader>ht :GhcModType<CR>
|
||||
" Insert type of expression under cursor
|
||||
nmap <silent> <leader>hT :GhcModTypeInsert<CR>
|
||||
" GHC errors and warnings
|
||||
nmap <silent> <leader>hc :SyntasticCheck ghc_mod<CR>
|
||||
" Haskell Lint
|
||||
let g:syntastic_mode_map = { 'mode': 'active', 'passive_filetypes': ['haskell'] }
|
||||
nmap <silent> <leader>hl :SyntasticCheck hlint<CR>
|
||||
|
||||
" Hoogle the word under the cursor
|
||||
nnoremap <silent> <leader>hh :Hoogle<CR>
|
||||
|
||||
" Hoogle and prompt for input
|
||||
nnoremap <leader>hH :Hoogle
|
||||
|
||||
" Hoogle for detailed documentation (e.g. "Functor")
|
||||
nnoremap <silent> <leader>hi :HoogleInfo<CR>
|
||||
|
||||
" Hoogle for detailed documentation and prompt for input
|
||||
nnoremap <leader>hI :HoogleInfo
|
||||
|
||||
" Hoogle, close the Hoogle window
|
||||
nnoremap <silent> <leader>hz :HoogleClose<CR>
|
||||
|
||||
" }}}
|
||||
|
||||
" Conversion {{{
|
||||
|
||||
function! Pointfree()
|
||||
call setline('.', split(system('pointfree '.shellescape(join(getline(a:firstline, a:lastline), "\n"))), "\n"))
|
||||
endfunction
|
||||
vnoremap <silent> <leader>h. :call Pointfree()<CR>
|
||||
|
||||
function! Pointful()
|
||||
call setline('.', split(system('pointful '.shellescape(join(getline(a:firstline, a:lastline), "\n"))), "\n"))
|
||||
endfunction
|
||||
vnoremap <silent> <leader>h> :call Pointful()<CR>
|
||||
|
||||
" }}}
|
||||
|
||||
" Customization {{{
|
||||
|
||||
if filereadable(expand("~/.vimrc.local"))
|
||||
source ~/.vimrc.local
|
||||
endif
|
||||
|
||||
" }}}
|
||||
|
3
zshrc
3
zshrc
@@ -188,6 +188,7 @@ pinfo(){
|
||||
save_dotfiles(){
|
||||
local DOTPATH=~/Documents/Code/Github/.dotfiles/
|
||||
cp ~/.bash_profile ${DOTPATH}bash_profile
|
||||
cp -r ~/.cabal ${DOTPATH}cabal
|
||||
cp ~/dev-tmux ${DOTPATH}dev-tmux
|
||||
cp ~/.ghci ${DOTPATH}ghci
|
||||
cp ~/.gitignore ${DOTPATH}gitignore
|
||||
@@ -196,7 +197,9 @@ save_dotfiles(){
|
||||
cp ~/.pythonrc ${DOTPATH}pythonrc
|
||||
cp ~/.tmux.conf ${DOTPATH}tmux.conf
|
||||
cp ~/.valgrindrc ${DOTPATH}valgrindrc
|
||||
cp -r ~/.vim ${DOTPATH}vim
|
||||
cp ~/.vimrc ${DOTPATH}vimrc
|
||||
cp ~/.vimrc.local ${DOTPATH}vimrc.local
|
||||
cp ~/.zshrc ${DOTPATH}zshrc
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user