This commit is contained in:
Ian Keane 2020-07-20 10:06:28 -04:00
commit 2b7f1f5e8f
6 changed files with 245 additions and 130 deletions

View file

@ -29,40 +29,37 @@
" Plug 'kovisoft/paredit'
Plug 'sainnhe/vim-color-forest-night'
Plug 'justinmk/vim-sneak'
Plug 'christoomey/vim-tmux-navigator'
Plug 'ap/vim-css-color'
Plug 'axvr/zepl.vim'
" Plug 'kovisoft/slimv'
Plug 'tpope/vim-vinegar'
Plug 'preservim/nerdtree'
Plug 'vimwiki/vimwiki'
Plug 'simnalamburt/vim-mundo'
Plug 'tpope/vim-dadbod'
Plug 'junegunn/gv.vim'
Plug 'rbong/vim-flog'
Plug 'tpope/vim-unimpaired'
" Clojure
Plug 'guns/vim-clojure-static' " syntax
Plug 'tpope/vim-fireplace'
Plug 'guns/vim-sexp'
Plug 'tpope/vim-sexp-mappings-for-regular-people'
Plug 'dylanaraps/wal.vim'
Plug 'sjl/tslime.vim'
" TODO setup
Plug 'roxma/vim-tmux-clipboard'
" TODO setup
Plug 'melonmanchan/vim-tmux-resizer'
" Plug 'roman/golden-ratio'
Plug 'kovisoft/slimv'
" Todo:
" GV
" Gundo (or undotree?)
" Emmett
" Fugitive
" Vimwiki
" Plug 'ryanss/vim-hackernews'
" Plug 'mbbill/undotree' or Plug 'sjl/gundo.vim'
" Plug 'tpope/vim-projectionist'
" Plug 'mileszs/ack.vim'
" Plug 'vim-pandoc/vim-pandoc'
" Plug 'alfredodeza/pytest.vim'
" Plug 'docker/docker'
" Plug vim-scripts/indentpython.vim
"
Plug 'alvan/vim-closetag'
Plug 'mattn/emmet-vim'
" Plug 'tpope/vim-salve'
Plug 'chrisbra/colorizer'
" cljfold
" " Todo:
" "
call plug#end()
"}}}
" appearance {{{
colorscheme zenburn
" colorscheme wal
" colorscheme zenburn
colorscheme wal
syntax on " Enable syntax
set encoding=utf-8 " Keep utf-8 encoding
set scrolloff=2 " Keep at least 3 lines above and below cursor
@ -78,9 +75,16 @@
hi CursorLineNr cterm=bold
" Lightline
let g:lightline = { 'colorscheme': 'sceaduhelm', }
let g:lightline = { 'colorscheme': 'sceaduhelm' }
set fillchars+=vert:│
command! LightlineReload call LightlineReload()
function! LightlineReload()
call lightline#init()
call lightline#colorscheme()
call lightline#update()
endfunction
" }}}
" Movement {{{
@ -106,13 +110,14 @@
set lazyredraw " Redraw only when necessary
set updatetime=100 " Make updates happen faster (gitgutter)
set splitright " Make split to right by default
set splitbelow
set winheight=30 " Soft minimum window height (active)
set winminheight=10 " Hard minimum window height (inactive)
set winwidth=80 " Window width for current window
"set winminheight=10 " Hard minimum window height (inactive)
set winwidth=85 " Window width for current window
set winminwidth=30 " Hard minimum for window width
set timeoutlen=1000
set ttimeoutlen=0
set t_vb= " No visual bell ever
let g:sneak#use_ic_scs=1
set virtualedit=block
"}}}
" searching {{{
@ -125,10 +130,6 @@
" Nnoremap <tab> %
" Vnoremap <tab> %
" Remap tab to jump by window
nnoremap <tab> :tabn<CR>
vnoremap <tab> :tabn<CR>
nnoremap <S-tab> :tabp<CR>
vnoremap <S-tab> :tabp<CR>
"}}}
@ -151,10 +152,10 @@
"}}}
" long line handling {{{
set textwidth=79
set fo=t
" set textwidth=79
" set fo=t
" set colorcolumn=85
"
"}}}
" leaders {{{
@ -162,7 +163,7 @@
" Clear search highlighting with leader-space
nnoremap <leader><space> :noh<cr>
" Underline with line of the same length
nnoremap <leader>- yypv$r-
@ -198,17 +199,37 @@
nnoremap k gk
"}}}
"
" slimv{{{
let g:slimv_repl_split=2
let g:slimv_repl_split_size=10
"
" let g:slimv_repl_split=2
" let g:slimv_repl_split_size=10
"}}}
" {{{ web dev
autocmd FileType html set softtabstop=2
autocmd FileType html set ts=2
autocmd FileType html set shiftwidth=2
autocmd FileType css set softtabstop=2
autocmd FileType css set ts=2
autocmd FileType html set shiftwidth=2
" Emmet tab size
let g:user_emmet_settings = {
\ 'indentation' : ' '
\}
" }}}
" clojure {{{
" TODO: make only work in clojure files
nnoremap <leader>e :Eval<CR> " eval form
nnoremap <leader>E :%Eval<CR> " eval file
" }}}
" split pane navigation {{{
" Map vertical split to \ w, switch to it, open explorer, prompt for filename
" TODO: make new window prompt use fzf
nnoremap <leader>w <C-w>v<C-w>l:e <C-S-d><BS><BS>open
" nnoremap <leader>w <C-w>v<C-w>l:e <C-S-d><BS><BS>open
" Switch panes wit ctrl + h/j/k/l
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
@ -216,11 +237,16 @@
nnoremap <C-l> <C-w>l
nnoremap <C-c> :close <cr>
nnoremap <C-n> :bn <cr>
nnoremap <C-x> :bd <cr>
" Map resize pane
" Term mode
tnoremap <C-h> <C-w>h
tnoremap <C-j> <C-w>j
tnoremap <C-k> <C-w>k
tnoremap <C-l> <C-w>l
tnoremap <C-c> :close <cr>
tnoremap <C-n> :bn <cr>
tnoremap <Esc> <C-\><C-n>
" TODO: remap pane resize to something else (leader?)
map + :vertical resize +5<CR>
map - :vertical resize -5<CR>
" quick-scope
" Trigger a highlight in the appropriate direction when pressing these keys:
let g:qs_highlight_on_keys = ['f', 'F', 't', 'T']
@ -231,10 +257,7 @@
autocmd ColorScheme * highlight QuickScopeSecondary guifg='#5fffff' gui=underline ctermfg=81 cterm=underline
augroup END
"}}}
" launch love game, check youtube love2d roguelike+rpg day 1 if broken {{{
" map ,t :! /Applications/love.app/Contents/MacOS/love . <CR>
nnoremap <c-s> gt
"}}}
@ -298,38 +321,109 @@
nmap ga <Plug>(EasyAlign)
"}}}
"
" git commands {{{
" TODO: map fugitive commands
" TODO: check out gv etc
" TODO: bind hunk committing
" Gitgutter hunk view
nmap ghv <Plug>(GitGutterPreviewHunk)
nmap ghn <Plug>(GitGutterNextHunk)
nmap ghp <Plug>(GitGutterPrevHunk)
nmap ghf <Plug>(GitGutterFold)
nmap ghs <Plug>(GitGutterStageHunk)
" Controls fugitive diff split direction
set diffopt=vertical
command! Gundo !git reset --soft HEAD~1
"}}}
" plugin modification {{{
"
" fold search {{{
" command to fold everything except what you searched for
command! -nargs=* Fs
\ if <q-args> != '' |
\ exe "normal /".<q-args>."\<CR>" |
\ endif |
\ if @/ != '' |
\ setlocal
\ foldexpr=FoldRegex(v:lnum,@/,2)
\ foldmethod=expr
\ foldlevel=0 |
\ endif
function! FoldRegex(lnum,pat,context)
" get start/end positions for context lines
let startline=a:lnum-a:context
while startline < 1
let startline+=1
endwhile
let endline=a:lnum+a:context
while endline > line('$')
let endline-=1
endwhile
let returnval = 2
let pos=getpos('.')
" search from current line to get matches ON the line
call cursor(a:lnum, 1)
let matchline=search(a:pat,'cW',endline)
if matchline==a:lnum
let returnval = 0
elseif matchline > 0
" if current line didn't match, there could have been a match within
" trailing context lines
let returnval = 1
else
" if no match at current line, search leading context lines for a match
call cursor(startline, 1)
let matchline=search(a:pat,'cW',a:lnum)
if matchline > 0
let returnval = 1
endif
endif
call setpos('.',pos)
return returnval
endfun
" }}}
" copy matches {{{
function! CopyMatches(reg)
let hits = []
%s//\=len(add(hits, submatch(0))) ? submatch(0) : ''/gne
let reg = empty(a:reg) ? '+' : a:reg
execute 'let @'.reg.' = join(hits, "\n") . "\n"'
endfunction
command! -register CopyMatches call CopyMatches(<q-reg>)
" }}}
" vimrc {{{
" source $MYVIMRC reloads the saved $MYVIMRC
:nmap <Leader>s :source $MYVIMRC
" opens $MYVIMRC for editing, or use :tabedit $MYVIMRC
:nmap <Leader>v :e $MYVIMRC
"}}}
" gvim {{{
set guioptions=Ace
" zepl {{{
augroup zepl
autocmd!
autocmd FileType python let b:repl_config = { 'cmd': 'python3' }
autocmd FileType javascript let b:repl_config = { 'cmd': 'python3' }
autocmd FileType clojure let b:repl_config = { 'cmd': 'clj' }
autocmd FileType scheme let b:repl_config = { 'cmd': 'rlwrap csi' }
autocmd FileType lisp let b:repl_config = { 'cmd': 'sbcl' }
autocmd FileType julia let b:repl_config = { 'cmd': 'julia' }
" autocmd FileType cs let b:repl_config = { 'cmd': '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat"' }
autocmd FileType cs let b:repl_config = { 'cmd': 'cmd' }
augroup END
"}}}
" tmux {{{
" tslime
let g:tslime_ensure_trailing_newlines = 1
let g:tslime_ensure_trailing_newlines = 1
let g:tslime_normal_mapping = '<leader>t'
let g:tslime_visual_mapping = '<leader>t'
let g:tslime_vars_mapping = '<leader>T'
"}}}
" TODO: rebind c-n
" TODO: change ,k to ,n and add notes to version control
" folding options, this must be last in file
" vim:foldmethod=marker:foldlevel=0

View file

@ -11,7 +11,6 @@
Plug 'junegunn/vim-easy-align'
Plug 'junegunn/fzf', { 'dir': '~/.fzf', 'do': './install --bin --all' }
Plug 'junegunn/fzf.vim'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'w0rp/ale'
@ -31,32 +30,28 @@
Plug 'sainnhe/vim-color-forest-night'
Plug 'justinmk/vim-sneak'
Plug 'axvr/zepl.vim'
Plug 'kovisoft/slimv'
" Plug 'kovisoft/slimv'
Plug 'tpope/vim-vinegar'
" Plug 'preservim/nerdtree'
Plug 'preservim/nerdtree'
Plug 'vimwiki/vimwiki'
Plug 'simnalamburt/vim-mundo'
Plug 'tpope/vim-dadbod'
Plug 'junegunn/gv.vim'
Plug 'rbong/vim-flog'
Plug 'tpope/vim-unimpaired'
Plug 'junegunn/goyo.vim'
" Clojure
Plug 'guns/vim-clojure-static' " syntax
Plug 'tpope/vim-fireplace'
Plug 'guns/vim-sexp'
Plug 'tpope/vim-sexp-mappings-for-regular-people'
Plug 'dylanaraps/wal.vim'
Plug 'alvan/vim-closetag'
Plug 'mattn/emmet-vim'
" Plug 'tpope/vim-salve'
Plug 'chrisbra/colorizer'
" cljfold
" Todo:
" GV
" Gundo (or undotree?)
" Emmett
" Fugitive
" Vimwiki
" Plug 'ryanss/vim-hackernews'
" Plug 'mbbill/undotree' or Plug 'sjl/gundo.vim'
" Plug 'tpope/vim-projectionist'
" Plug 'mileszs/ack.vim'
" Plug 'vim-pandoc/vim-pandoc'
" Plug 'alfredodeza/pytest.vim'
" Plug 'docker/docker'
" Plug vim-scripts/indentpython.vim
"
call plug#end()
"}}}
@ -168,7 +163,7 @@
" Clear search highlighting with leader-space
nnoremap <leader><space> :noh<cr>
" Underline with line of the same length
nnoremap <leader>- yypv$r-
@ -176,6 +171,7 @@
nnoremap <leader>d k :r !date <cr>
nnoremap <leader>k :vert new ~/.vim/bindings.md <cr>
tnoremap <leader><esc> <C-\><C-n>
"}}}
@ -205,11 +201,31 @@
"}}}
" slimv{{{
let g:slimv_repl_split=2
let g:slimv_repl_split_size=10
"
" let g:slimv_repl_split=2
" let g:slimv_repl_split_size=10
"}}}
" {{{ web dev
autocmd FileType html set softtabstop=2
autocmd FileType html set ts=2
autocmd FileType html set shiftwidth=2
autocmd FileType css set softtabstop=2
autocmd FileType css set ts=2
autocmd FileType html set shiftwidth=2
" Emmet tab size
let g:user_emmet_settings = {
\ 'indentation' : ' '
\}
" }}}
" clojure {{{
" TODO: make only work in clojure files
nnoremap <leader>e :Eval<CR> " eval form
nnoremap <leader>E :%Eval<CR> " eval file
" }}}
" split pane navigation {{{
" Map vertical split to \ w, switch to it, open explorer, prompt for filename
" TODO: make new window prompt use fzf
@ -308,15 +324,15 @@
"}}}
" git commands {{{
" TODO: map fugitive commands
" TODO: check out gv etc
" TODO: bind hunk committing
" Gitgutter hunk view
nmap ghv <Plug>(GitGutterPreviewHunk)
nmap ghn <Plug>(GitGutterNextHunk)
nmap ghp <Plug>(GitGutterPrevHunk)
nmap ghf <Plug>(GitGutterFold)
nmap ghs <Plug>(GitGutterStageHunk)
" Controls fugitive diff split direction
set diffopt=vertical
command! Gundo !git reset --soft HEAD~1
"}}}
" fold search {{{
@ -407,6 +423,8 @@ command! -register CopyMatches call CopyMatches(<q-reg>)
augroup END
"}}}
" TODO: rebind c-n
" TODO: change ,k to ,n and add notes to version control
" folding options, this must be last in file
" vim:foldmethod=marker:foldlevel=0