Created
April 26, 2018 15:10
-
-
Save runarorama/c42b37ed3f41d6b9dacec9daf6af4fab to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call pathogen#infect() | |
call plug#begin('~/.vim/plugged') | |
Plug 'kana/vim-textobj-user' | |
Plug 'isovector/ghci.vim' | |
Plug 'michaeljsmith/vim-indent-object' | |
Plug 'junegunn/vim-easy-align' | |
Plug 'deris/vim-shot-f' | |
"Plug 'ap/vim-buftabline' | |
Plug 'tpope/vim-surround' | |
Plug 'tpope/vim-repeat' | |
Plug 'tpope/vim-commentary' | |
"Plug 'scrooloose/nerdtree' | |
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' } | |
Plug 'junegunn/fzf.vim' | |
Plug 'derekwyatt/vim-scala' | |
Plug 'vim-airline/vim-airline' | |
Plug 'AndrewRadev/sideways.vim' | |
"Plug 'Xuyuanp/nerdtree-git-plugin' | |
call plug#end() | |
set nocompatible | |
filetype off | |
set rtp+=~/.vim/bundle/vundlev | |
call vundle#rc() | |
Bundle 'gmarik/vundle' | |
let mapleader = "\<Space>" | |
map! <C-Space> <C-P> | |
"let g:miniBufExplMapWindowNavVim = 1 | |
"let g:miniBufExplMapWindowNavArrows = 1 | |
"let g:miniBufExplMapCTabSwitchBufs = 1 | |
"let g:miniBufExplModSelTarget = 1 | |
set softtabstop=2 | |
set shiftwidth=2 | |
set tabstop=2 | |
set expandtab | |
set autoindent | |
set undofile | |
set ai | |
set si | |
set equalalways | |
set splitbelow splitright | |
:noremap <Leader>v :vsp^M^W^W<cr> | |
:noremap <Leader>h :split^M^W^W<cr> | |
" Save with leader-w | |
noremap <Leader>w :w<CR> | |
" Copy/paste system clipboard with leader-p and leader-y | |
vmap <Leader>y "+y | |
vmap <Leader>d "+d | |
nmap <Leader>p "+p | |
nmap <Leader>P "+P | |
vmap <Leader>p "+p | |
vmap <Leader>P "+P | |
set completeopt=menuone,menu,longest | |
set wildignore+=*\\tmp\\*,*.swp,*.swo,*.zip,.git,.cabal-sandbox | |
set wildmode=longest,list,full | |
set wildmenu | |
set completeopt+=longest | |
set t_Co=256 | |
set cmdheight=1 | |
set cursorline | |
set hlsearch | |
set incsearch | |
set ignorecase | |
set smartcase | |
set background=light | |
syntax on | |
colorscheme solarized | |
set showcmd | |
set ruler | |
set wrap | |
set linebreak | |
filetype plugin indent on | |
map <S-Enter> O<ESC> " awesome, inserts new line without going into insert mode | |
map <Enter> o<ESC> | |
set listchars=trail:.,tab:>-,eol:$ | |
set nolist | |
:noremap <Leader>i :set list!<CR> " Toggle invisible chars | |
set backspace=indent,eol,start | |
set matchpairs+=<:> | |
set vb t_vb= | |
map k gk | |
map j gj | |
map E ge | |
map <Leader>p <C-^> " Go to previous file | |
augroup BEGIN | |
au! BufRead,BufNewFile *.xml source ~/.vim/ftplugin/xml/dbhelper.vim | |
augroup END | |
" Allows vim to manage multiple buffers effectively. | |
set hidden | |
" Keep a longer history | |
set history=1000 | |
" Enable extended % matching | |
runtime macros/matchit.vim | |
" Make file/command completion useful | |
set wildmenu | |
set wildmode=list:longest | |
set wildignore+=*.o,*.a,*.pyc,*.depend,*.class,*.jar | |
" Set the terminal title | |
set title | |
" Maintain context around the cursor | |
set scrolloff=3 | |
" Store temporary files in a central spot | |
set backupdir=~/.vim-tmp,~/.tmp,~/tmp,var/tmp,/tmp | |
set directory=~/.vim-tmp,~/.tmp,~/tmp,var/tmp,/tmp | |
" Enable line numbering | |
set number | |
"set relativenumber | |
" Highlight search terms... | |
set hlsearch | |
" ... dynamically as they are typed. | |
set incsearch | |
" Map ,n to turn off search highlighting | |
nmap <silent> <leader>n :silent :nohlsearch<CR> | |
" Make tabs and trailing spaces visible with ,s | |
set listchars=tab:>-,trail:·,eol:$ | |
nmap <silent> <leader>s :set nolist!<CR> | |
" Stifle interruptive prompts | |
set shortmess=atI | |
" Turn off distracting sounds | |
set visualbell | |
" Set the default encoding to unicode | |
set encoding=UTF-8 | |
" strip trailing whitespace on save | |
function! StripTrailingWhitespace() | |
let myline=line(".") | |
let mycolumn=col(".") | |
silent %s/ *$// | |
call cursor(myline, mycolumn) | |
endfunction | |
au BufWritePre *.e,*.scala,*.java,*.hs,*.lhs silent! cal StripTrailingWhitespace() | |
noremap <f4> :setfiletype vo_base<CR> | |
inoremap <f4> <c-o>:setfiletype vo_base<CR> | |
" Markdown | |
let g:markdown_fenced_languages = ['scala', 'haskell', 'json=javascript', 'java'] | |
set runtimepath^=~/.vim/bundle/ag | |
set guifont=Menlo:h16 | |
" ghc-mod | |
map <silent> tw :GhcModTypeInsert<CR> | |
map <silent> ts :GhcModSplitFunCase<CR> | |
map <silent> tq :GhcModType<CR> | |
map <silent> te :GhcModTypeClear<CR> | |
"map <Leader>n :NERDTreeToggle<CR> | |
"map <Leader>f :NERDTreeFind<CR> | |
" tabularize | |
let g:haskell_tabular = 1 | |
vmap a= :Tabularize /=<CR> | |
vmap a; :Tabularize /::<CR> | |
vmap a- :Tabularize /-><CR> | |
"map <silent> <Leader>t :CtrlP()<CR> | |
"noremap <leader>b<space> :CtrlPBuffer<cr> | |
"let g:ctrlp_custom_ignore = '\v[\/]dist$' | |
set colorcolumn=80 | |
function! AddHsPragma() | |
" Add a new HS pragma, and sort the list so it's pretty | |
let pragma = input("LANGUAGE ") | |
normal! ms | |
if match(cetline(1), "module") == 0 | |
execute "normal! ggO\<ESC>" | |
endif | |
if pragma != "" | |
execute "normal! ggO{-# LANGUAGE " . pragma . " #-}\<ESC>" | |
endif | |
" execute "normal! ggvip:sort\<CR>gv:EasyAlign -#\<CR>" | |
normal `s | |
endfunction | |
nnoremap <leader>l :call AddHsPragma()<CR> | |
" Things we can align on | |
let g:easy_align_delimiters = { | |
\ '[': { 'pattern': '[[\]]', 'left_margin': 0, 'right_margin': 0, 'stick_to_left': 0 }, | |
\ '(': { 'pattern': '[()]', 'left_margin': 0, 'right_margin': 0, 'stick_to_left': 0 }, | |
\ ']': { 'pattern': '[[\]]', 'left_margin': 1, 'right_margin': 0, 'stick_to_left': 0 }, | |
\ ')': { 'pattern': '[()]', 'left_margin': 1, 'right_margin': 0, 'stick_to_left': 0 }, | |
\ '<': { 'pattern': '[<]', 'left_margin': 1, 'right_margin': 0, 'stick_to_left': 0 }, | |
\ '.': { 'pattern': '\.', 'left_margin': 1, 'right_margin': 1, 'stick_to_left': 0 }, | |
\ '>': { 'pattern': '[->]', 'left_margin': 1, 'right_margin': 0, 'stick_to_left': 0 }, | |
\ ':': { 'pattern': '::', 'left_margin': 1, 'right_margin': 1, 'stick_to_left': 0 }, | |
\ '$': { 'pattern': '\$', 'left_margin': 1, 'right_margin': 1, 'stick_to_left': 0 }, | |
\ '~': { 'pattern': '\.\~', 'left_margin': 1, 'right_margin': 1, 'stick_to_left': 0 }, | |
\ '#': { 'pattern': '#', 'left_margin': 1, 'right_margin': 0, 'stick_to_left': 0 }, | |
\ 'q': { 'pattern': '\(qualified\)\?\ze ', 'left_margin': 1, 'right_margin': 1, 'stick_to_left': 0 }, | |
\ 'c': { 'pattern': '.\zs--', 'left_margin': 2, 'right_margin': 1, 'stick_to_left': 0, 'ignore_groups': [] }, | |
\ } | |
" Start interactive EasyAlign in visual mode (e.g. vipga) | |
xmap ga <Plug>(EasyAlign) | |
" Start interactive EasyAlign for a motion/text object (e.g. gaip) | |
nmap ga <Plug>(EasyAlign) | |
nnoremap <leader>ev :e ~/.vimrc<cr> | |
nnoremap # :e #<CR> | |
" sort imports | |
nnoremap <silent> <leader>si magg/^import<CR>vip:EasyAlign q<CR>gv:sort /.*\%18v/<CR>:noh<CR>`a | |
" let g:buftabline_numbers = 1 | |
" Allow switching to buffer #<n> by typing <n>e | |
function! s:bufSwitch(count) | |
if count >=# 1 | |
return ":\<C-U>" . count . "b\<CR>" | |
endif | |
return 'e' | |
endfunction | |
nnoremap <expr> e <SID>bufSwitch(v:count) | |
" set guitablabel=%-0.12t%M | |
" set showtabline=2 | |
nnoremap ;; :w<CR> | |
function! VisualPointfree() range | |
let n = @n | |
let q = @q | |
silent! normal gv"nd | |
let @q = system("pointfree '" . @n . "'") | |
let @q=substitute(strtrans(@q),'\^@','','g') | |
silent! normal "qP | |
let @n = n | |
let @q = q | |
endfunction | |
function! VisualPointful() range | |
let n = @n | |
let q = @q | |
silent! normal gv"nd | |
let @q = system("pointful '" . @n . "'") | |
let @q=substitute(strtrans(@q),'\^@','','g') | |
silent! normal "qP | |
let @n = n | |
let @q = q | |
endfunction | |
if executable('ag') | |
set grepprg=ag\ --nogroup\ --nocolor | |
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""' | |
let g:ctrlp_use_caching = 0 | |
endif | |
xnoremap <silent> <leader>pl :call VisualPointfree()<CR> | |
xnoremap <silent> <leader>lp :call VisualPointful()<CR> | |
augroup automaticallySourceVimrc | |
au! | |
au bufwritepost .vimrc source ~/.vimrc | |
augroup END | |
" ctags configuration | |
set tags=tags,htags;$HOME | |
nnoremap <leader>t :!/usr/local/bin/ctags -R .<CR><CR> | |
nnoremap <leader>h :!hasktags -o htags -c --ignore-close-implementation .<CR><CR> | |
nnoremap <silent> <leader>st :! (cd `git rev-parse --show-toplevel`; hasktags **/*.hs)<CR>:set tags=<C-R>=system("git rev-parse --show-toplevel")<CR><BS>/tags<CR> | |
set guioptions+=e | |
" Ripgrep for file indexing | |
if executable('rg') | |
let $FZF_DEFAULT_COMMAND = 'rg --files --no-messages --color never"" .' | |
endif | |
" Use FZF for files and tags if available, otherwise fall back onto CtrlP | |
" <leader>j will search for tag using word under cursor | |
let g:fzf_command_prefix = 'Fzf' | |
nnoremap <C-P> :FzfFiles<cr> | |
nnoremap <leader>b :FzfBuffers<cr> | |
nnoremap <leader>u :FzfTags<cr> | |
nnoremap <leader>j :call fzf#vim#tags("'".expand('<cword>'))<cr> | |
nnoremap <c-h> :SidewaysLeft<cr> | |
nnoremap <c-l> :SidewaysRight<cr> | |
omap aa <Plug>SidewaysArgumentTextobjA | |
xmap aa <Plug>SidewaysArgumentTextobjA | |
omap ia <Plug>SidewaysArgumentTextobjI | |
xmap ia <Plug>SidewaysArgumentTextobjI | |
iab csig (r,rec,top,stackU,x1,x0,stackB,x1b,x0b) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup fzf | |
# --------- | |
if [[ ! "$PATH" == */Users/runar/.fzf/bin* ]]; then | |
export PATH="$PATH:/Users/runar/.fzf/bin" | |
fi | |
# Auto-completion | |
# --------------- | |
[[ $- == *i* ]] && source "/Users/runar/.fzf/shell/completion.zsh" 2> /dev/null | |
# Key bindings | |
# ------------ | |
source "/Users/runar/.fzf/shell/key-bindings.zsh" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Setup fzf | |
# --------- | |
if [[ ! "$PATH" == */Users/runar/.fzf/bin* ]]; then | |
export PATH="$PATH:/Users/runar/.fzf/bin" | |
fi | |
# Auto-completion | |
# --------------- | |
[[ $- == *i* ]] && source "/Users/runar/.fzf/shell/completion.bash" 2> /dev/null | |
# Key bindings | |
# ------------ | |
source "/Users/runar/.fzf/shell/key-bindings.bash" | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Customize to your needs... | |
[ -f ~/.fzf.zsh ] && source ~/.fzf.zsh | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment