Skip to content

Commit

Permalink
Vim and emacs.
Browse files Browse the repository at this point in the history
  • Loading branch information
David Sargeant committed Nov 2, 2016
1 parent 8642132 commit 04d2a9c
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 30 deletions.
8 changes: 6 additions & 2 deletions .emacs.d/init.el
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
(defun pbcopy ()
(interactive)
(call-process-region (point) (mark) "pbcopy")
(setq deactivate-mark t))

(defun rename-file-and-buffer ()
"Rename the current buffer and file it is visiting."
(interactive)
Expand Down Expand Up @@ -333,8 +338,7 @@
;; Git
"gs" 'magit-status-window
"gh" 'github-browse-file
"gb" 'magit-blame
"gl" 'magit-log-buffer-file)
"gb" 'magit-blame)
;; Dumb jump
(dumb-jump-mode)
(normal-key "gj" 'dumb-jump-go)
Expand Down
70 changes: 42 additions & 28 deletions init.vim
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,28 @@ filetype plugin indent on
" Load plugins
call plug#begin()
Plug 'vim-airline/vim-airline'
Plug 'vim-airline/vim-airline-themes'
Plug 'EasyMotion'
Plug 'airblade/vim-gitgutter'
Plug 'ntpeters/vim-better-whitespace'
Plug 'tpope/vim-fugitive'
" Plug 'gregsexton/gitv'
Plug 'tpope/vim-repeat'
Plug 'YankRing.vim'
Plug 'tpope/vim-surround'
Plug 'tomtom/tcomment_vim'
Plug 'osyo-manga/vim-anzu'
Plug 'luochen1990/rainbow'
Plug 'cohama/lexima.vim'
Plug 'timkendrick/vim-duplicate'
Plug 'haya14busa/incsearch.vim'
Plug 'osyo-manga/vim-over'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --all' }
Plug 'junegunn/fzf.vim'
Plug 'matchit.zip', {'for': ['html', 'xml', 'sh', 'vim']}
Plug 'lambdalisue/vim-manpager', {'on': 'MANPAGER'}
Plug 'lambdalisue/vim-pager', {'on': 'PAGER'}
Plug 'powerman/vim-plugin-AnsiEsc', {'on': 'PAGER'}
Plug 'rust-lang/rust.vim', {'for': 'rust'}
Plug 'ensime/ensime-vim', {'for': 'scala'}
Plug 'derekwyatt/vim-scala', {'for': ['scala', 'sbt.scala']}
Plug 'mbbill/undotree', {'on': 'UndotreeToggle'}
Plug 'mtth/scratch.vim', {'on': ['Scratch', 'ScratchInsert']}
Expand All @@ -33,6 +36,7 @@ Plug 'guns/vim-clojure-static', {'for': 'clojure'}
Plug 'scrooloose/syntastic', {'for': 'fsharp'}
Plug 'ervandew/supertab', {'for': 'fsharp'}
Plug 'fsharp/vim-fsharp', {'for': 'fsharp', 'do': 'make fsautocomplete'}
Plug 'ElmCast/elm-vim', {'for': 'elm'}
call plug#end()
" Color theme
colorscheme tir_black
Expand All @@ -42,8 +46,6 @@ set hidden
set visualbell
" Highlight current line
set cursorline
" Show 3 lines of context around the cursor
set scrolloff=3
" Set the terminal's title
set title
" Tabs and spaces
Expand Down Expand Up @@ -82,22 +84,7 @@ autocmd FileType html set omnifunc=htmlcomplete#CompleteTags
tnoremap <Esc> <C-\><C-n>
" vim-airline
set laststatus=2
let g:airline_powerline_fonts=0
let g:airline#extensions#tabline#enabled=1
let g:airline#extensions#tabline#show_tab_nr=0
let g:airline#extensions#tabline#show_close_button=0
let g:airline#extensions#tabline#buffer_idx_mode=1
let g:airline#extensions#tabline#show_tab_type=0
let g:airline#extensions#tabline#fnamemod=':t'
nmap <Leader>1 <Plug>AirlineSelectTab1
nmap <Leader>2 <Plug>AirlineSelectTab2
nmap <Leader>3 <Plug>AirlineSelectTab3
nmap <Leader>4 <Plug>AirlineSelectTab4
nmap <Leader>5 <Plug>AirlineSelectTab5
nmap <Leader>6 <Plug>AirlineSelectTab6
nmap <Leader>7 <Plug>AirlineSelectTab7
nmap <Leader>8 <Plug>AirlineSelectTab8
nmap <Leader>9 <Plug>AirlineSelectTab9
let g:airline_theme='murmur'
" Backspace closes buffer
nmap <BS> :bd<CR>
" Buffer previous
Expand All @@ -106,6 +93,9 @@ nmap <M-b> :bp!<CR>
nmap <M-f> :bn!<CR>
" Last buffer
nmap <C-l> :e#<CR>
" Quickfix
nmap <M-n> :cnext<CR>
nmap <M-p> :cprev<CR>
" Move lines up/down
nmap <C-j> :m +1<CR>
nmap <C-k> :m -2<CR>
Expand All @@ -117,15 +107,18 @@ vmap <Leader>d <Plug>Duplicate gv
" Emacs-like beginning and end of line
imap <C-e> <C-o>$
imap <C-a> <C-o>^
" Trailing whitespace
imap <M-BS> <C-o>db
" Strip trailing whitespace
let g:strip_whitespace_on_save=1
" Don't highlight trailing whitespace
let g:better_whitespace_enabled=0
" YankRing
nmap <Leader>y :YRShow<CR>
function! YRRunAfterMaps()
nnoremap Y :<C-U>YRYankCount 'y$'<CR>
endfunction
" Easy Motion
let g:EasyMotion_leader_key='m'
let g:EasyMotion_leader_key=',m'
" Undo-tree
nmap <Leader>u :UndotreeToggle<CR>
let g:undotree_SetFocusWhenToggle=1
Expand Down Expand Up @@ -155,16 +148,37 @@ nmap <Leader>b :Buffers<CR>
nmap <Leader>hf :History<CR>
nmap <Leader>hc :History:<CR>
nmap <Leader>hs :History/<CR>
" Anzu
nmap n <Plug>(anzu-n-with-echo)
nmap N <Plug>(anzu-N-with-echo)
nmap * <Plug>(anzu-star-with-echo)
nmap # <Plug>(anzu-sharp-with-echo)
let g:anzu_status_format='%p (%i/%l)'
" Clojure
let g:clojure_syntax_keywords={'clojureDefine': ['defn$','defna','defnv'], 'clojureSpecial': ['fn$','fna','fnv']}
" Fugitive
nmap <Leader>gh :Gbrowse<CR>
vmap <Leader>gh :Gbrowse<CR>
nmap <Leader>gs :Gstatus<CR>
nmap <Leader>gb :Gblame<CR>
nmap <Leader>gc :Gcommit<CR>
nmap <Leader>gd :terminal git diff<CR>
nmap <Leader>gl :Glog<Space>
nmap <Leader>gg :Ggrep<Space>
nmap <Leader>ge :Gedit<Space>
nmap <Leader>gp :Gpush<CR>
" Open lines without changing to Insert mode
nmap <Leader>o o<Esc>
nmap <Leader>O O<Esc>
" netrw
let g:netrw_banner = 0
let g:netrw_liststyle = 3
let g:netrw_browse_split = 4
let g:netrw_altv = 1
let g:netrw_winsize = 20
" Incremental searching
map / <Plug>(incsearch-forward)
map ? <Plug>(incsearch-backward)
map g/ <Plug>(incsearch-stay)
" Incremental replacing
nmap <Leader>s :OverCommandLine<CR>%s/
vmap <Leader>s :OverCommandLine<CR>s/
" Display full path of current file
nmap <Leader>n :echo expand('%:p')<CR>
" Ensime
nmap <Leader>ej :EnDeclaration<CR>
nmap <Leader>et :EnType<CR>

0 comments on commit 04d2a9c

Please sign in to comment.