Skip to content

Instantly share code, notes, and snippets.

@eltonlaw
Last active March 21, 2019 06:10
Show Gist options
  • Save eltonlaw/dce719d9f7e665cd6a01d609a52ef7a2 to your computer and use it in GitHub Desktop.
Save eltonlaw/dce719d9f7e665cd6a01d609a52ef7a2 to your computer and use it in GitHub Desktop.
" pathogen vim modules
execute pathogen#infect()
set t_Co=256
filetype plugin on
filetype indent on
syntax on
set laststatus=2
" statusline+=%{FugitiveStatusline()}
" General
set nocompatible
set hlsearch " Highlighting search
set background=dark
" set relativenumber " relative number lines
set tabstop=4
set shiftwidth=4
set softtabstop=4
set expandtab
colorscheme antares
set clipboard=unnamed
set nowrap
set backup
set swapfile
set backupdir=~/.vim-tmp
set directory=~/.vim-tmp
" Search down into subfolders - Ex. :find file.py
" Provides tab-completion for all file-related tasks
" Note - :b <unique substring> lets you autocomplete any open buffer
set path+=**
" Display all matching files when we tab complete
" Ex. :find *.py
set wildmenu
" To alternate between 2 and 4 spaces for tabs
nmap <leader>4 :set expandtab tabstop=4 shiftwidth=4 softtabstop=4<CR>
nmap <leader>2 :set expandtab tabstop=2 shiftwidth=2 softtabstop=2<CR>
nmap <leader>1 :set expandtab tabstop=1 shiftwidth=1 softtabstop=1<CR>
" Some basic mappings for common things
nmap <leader>w :w<CR>
nmap <leader>wq :wq<CR>
function! NumberToggle()
if(&nu == 1)
set nu!
set rnu
elseif(&rnu == 1)
set nonu
set nornu
else
set nornu
set nu
endif
endfunc
nnoremap <C-n> :call NumberToggle()<cr>
"" FILE SYSTEM
" NERDTREE
let g:NERDTreeWinPos = "right"
"" ftdetect
au! BufRead,BufNewFile *.boot set filetype=clojure
"" VIMUX
":let mapleader=","
:let maplocalleader = "-"
" Interrupt any command running in the runner pane
map <LocalLeader>vx :VimuxInterruptRunner<CR>
" If text is selected, save it in the v buffer and send that buffer it to tmux
map <LocalLeader>vs :call VimuxSlime()<CR>
"nmap <LocalLeader>vs vip<LocalLeader>vs<CR>
map <LocalLeader>vo :call VimuxOpenRunner()<CR>
map <LocalLeader>ve "vy :call VimuxSingleLine()<CR>
map <LocalLeader>vc :call VimuxCloseRunner()<CR>
map <LocalLeader>vk :call VimuxPreviousCommand()<CR>
map <LocalLeader>v2k :call VimuxPrevious2Commands()<CR>
" vim-fugitive
nnoremap <space>ga :Git add -e %<CR><CR>
nnoremap <space>gr :Git reset HEAD %<CR><CR>
nnoremap <space>gR :Git checkout -- %<CR><CR>
nnoremap <space>gcc :Gcommit <CR>
nnoremap <space>gca :Gcommit --amend<CR>
nnoremap <space>gcd :Git reset --soft HEAD~1<CR>
nnoremap <space>gd :Gdiff<CR>
nnoremap <space>gh :Git show<CR>
nnoremap <space>gs :Gstatus<CR>
nnoremap <space>gt :Gcommit -v -q %:p<CR>
nnoremap <space>ge :Gedit<CR>
nnoremap <space>gw :Gwrite<CR><CR>
nnoremap <space>gl :silent! Glog<CR>:bot copen<CR>
nnoremap <space>gp :Ggrep<Space> nnoremap <space>gm :Gmove<Space>
nnoremap <space>gb :Git branch<Space>
nnoremap <space>go :Git checkout<Space>
nnoremap <space>gps :Dispatch! git push<CR>
nnoremap <space>gpl :Dispatch! git pull<CR>
" Vimux
function! VimuxMultiLine()
call VimuxSendText("%cpaste")
call VimuxSendKeys("Enter")
call VimuxSendText(@v)
call VimuxSendKeys("C-d")
endfunction
function! VimuxSingleLine()
call VimuxSendText(@v)
call VimuxSendKeys("Enter")
endfunction
function! VimuxPreviousCommand()
call VimuxSendKeys("Up")
call VimuxSendKeys("Enter")
endfunction
function! VimuxPrevious2Commands()
call VimuxSendKeys("Up")
call VimuxSendKeys("Up")
call VimuxSendKeys("Enter")
call VimuxSendKeys("Up")
call VimuxSendKeys("Up")
call VimuxSendKeys("Enter")
endfunction
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment