Permalink
Browse files

tight coupling of vim and tmux keybinds

  • Loading branch information...
xero committed Oct 9, 2018
1 parent 7c0e974 commit 02cbf95a00676672df6e548d3beb74a66e632c81
Showing with 132 additions and 98 deletions.
  1. +43 −42 tmux/.tmux.conf
  2. +13 −0 vim/.vim/commands.vim
  3. +3 −7 vim/.vim/general.vim
  4. +47 −30 vim/.vim/plugin-settings.vim
  5. +24 −17 vim/.vim/plugins.vim
  6. +2 −2 vim/.vim/ui.vim
View
@@ -14,74 +14,38 @@
# ░▓▓▓▓▓▓▓▓▓▓
# ░░░░░░░░░░
# change prefix to backtick
unbind C-b
set-option -g prefix `
bind ` send-prefix
# shell
set -g default-command /usr/bin/zsh
set -g default-shell /usr/bin/zsh
# screen mode
set -g default-terminal "screen-256color"
# start with window 1 (instead of 0)
set -g base-index 1
# renumber windows after closing
set -g renumber-windows on
# start with pane 1
set -g pane-base-index 1
# screen mode
set -g default-terminal "screen-256color"
# remove esc delay
set -sg escape-time 0
# source config file
bind r source-file ~/.tmux.conf \; display-message "█▓░ ~/.tmux.conf reloaded."
# history
set -g history-limit 4096
set -g history-limit 10000
# allow terminal scrolling
set-option -g terminal-overrides 'xterm*:smcup@:rmcup@'
# vim style copy paste mode
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
# use vi mode
setw -g mode-keys vi
set -g status-keys vi
# pleb mode
set -g mouse on
# splitting
unbind %
bind h split-window -v
unbind '"'
bind v split-window -h
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n S-j resize-pane -D 2
bind -n S-k resize-pane -U 2
bind -n S-h resize-pane -L 2
bind -n S-l resize-pane -R 2
# colon :
bind : command-prompt
# panes
set -g pane-border-fg colour0
set -g pane-active-border-fg colour0
@@ -134,7 +98,44 @@ set-option -g bell-action none
# tmux clock
set -g clock-mode-colour colour14
# some key-binding changes
# change prefix to backtick
unbind C-b
set-option -g prefix `
bind ` send-prefix
# vim style copy paste mode
unbind [
bind Escape copy-mode
unbind p
bind p paste-buffer
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-pipe-and-cancel 'xclip -in -selection clipboard'
# splitting
unbind %
bind h split-window -v
unbind '"'
bind v split-window -h
# navigate and resize splits
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind -n M-h if-shell "$is_vim" "send-keys M-h" "resize-pane -L 2"
bind -n M-l if-shell "$is_vim" "send-keys M-l" "resize-pane -R 2"
bind -n M-k if-shell "$is_vim" "send-keys M-k" "resize-pane -U 2"
bind -n M-j if-shell "$is_vim" "send-keys M-j" "resize-pane -D 2"
# vim style commands
bind : command-prompt
# source config file
bind r source-file ~/.tmux.conf \; display-message "█▓░ ~/.tmux.conf reloaded."
# other random key-binding changes
bind x kill-pane
bind X next-layout
bind Z previous-layout
View
@@ -22,6 +22,16 @@ function! JSONify()
endfunction
command J :call JSONify()
function! UnMinify()
%s/{\ze[^\r\n]/{\r/g
%s/){/) {/g
%s/};\?\ze[^\r\n]/\0\r/g
%s/;\ze[^\r\n]/;\r/g
%s/[^\s]\zs[=&|]\+\ze[^\s]/ \0 /g
normal ggVG=
endfunction
command UnMinify :call UnMinify()
" remove trailing white space
command Nows :%s/\s\+$//
@@ -34,6 +44,9 @@ command Spell :setlocal spell! spell?
" make current buffer executable
command Chmodx :!chmod a+x %
" fix syntax highlighting
command FixSyntax :syntax sync fromstart
" let's make some textmode art!
function! AsciiMode()
e ++enc=cp850
View
@@ -19,7 +19,7 @@
set nocompatible
" security
set modelines=0
set modelines=1
" hide buffers, not close them
set hidden
@@ -53,7 +53,7 @@ set smartcase
set infercase
" the /g flag on :s substitutions by default
set gdefault
"set gdefault <<--- need to break this habit
" make backspace behave in a sane manner
set backspace=indent,eol,start
@@ -65,7 +65,6 @@ if has("nvim")
set inccommand=split
endif
" use indents of 4 spaces
set shiftwidth=4
@@ -90,8 +89,5 @@ augroup end
" set leader key to comma
let mapleader=","
" new coffee pasta commands
"vnoremap <silent> <leader>y :w !xsel -i -b<CR>
"nnoremap <silent> <leader>y V:w !xsel -i -b<CR>
"nnoremap <silent> <leader>p :silent :r !xsel -o -b<CR>
" coffee pasta
set clipboard^=unnamedplus
@@ -19,7 +19,8 @@
"colorscheme sourcerer
" dark wizard colors http://git.io/blaquemagick.vim
colorscheme blaquemagick
"colorscheme blaquemagick
colorscheme nord
" use your shell colors
"colorscheme noctu
@@ -59,11 +60,19 @@ endif
" linting
let g:ale_completion_enabled = 1
let g:ale_sign_column_always = 1
let g:ale_sign_error = '× '
let g:ale_sign_warning = '> '
let g:ale_sign_error = ' '
let g:ale_sign_warning = ' '
"let g:ale_open_list = 1
"let g:ale_lint_on_text_changed = 'never'
highlight ALEErrorSign ctermbg=234 ctermfg=magenta
highlight ALEErrorSign ctermbg=0 ctermfg=magenta
" file browser
let NERDTreeShowHidden = 1
let NERDTreeMinimalUI = 1
let NERDTreeDirArrows = 1
let g:webdevicons_enable_nerdtree = 1
let g:NERDTreeDirArrowExpandable = ''
let g:NERDTreeDirArrowCollapsible = ''
" disable folding
let g:vim_json_syntax_conceal = 0
@@ -74,7 +83,10 @@ set diffopt+=vertical
" close if final buffer is netrw or the quickfix
augroup finalcountdown
au!
autocmd WinEnter * if winnr('$') == 1 && getbufvar(winbufnr(winnr()), "&filetype") == "netrw" || &buftype == 'quickfix' |q|endif
"autocmd WinEnter * if winnr('$') == 1 && getbufvar(winbufnr(winnr()), "&filetype") == "netrw" || &buftype == 'quickfix' |q|endif
autocmd BufEnter * if (winnr("$") == 1 && exists("b:NERDTree") && b:NERDTree.isTabTree()) || &buftype == 'quickfix' | q | endif
"nmap - :Lexplore<cr>
nmap - :NERDTreeToggle<cr>
augroup END
" speed optimizations
@@ -90,19 +102,21 @@ let g:gitgutter_sign_removed_first_line = '^'
let g:gitgutter_sign_modified_removed = ':'
" color overrrides
highlight clear SignColumn
highlight GitGutterAdd ctermfg=green ctermbg=234
highlight GitGutterChange ctermfg=yellow ctermbg=234
highlight GitGutterDelete ctermfg=red ctermbg=234
highlight GitGutterChangeDelete ctermfg=red ctermbg=234
highlight GitGutterAdd ctermfg=green ctermbg=0
highlight GitGutterChange ctermfg=yellow ctermbg=0
highlight GitGutterDelete ctermfg=red ctermbg=0
highlight GitGutterChangeDelete ctermfg=red ctermbg=0
" use the silver searcher
let g:ag_prg="ag -i --vimgrep"
let g:ag_highlight=1
" map \ to the ag command for quick searching
nnoremap \ :Ag<SPACE>
" use ^{h,j} to move lines
let g:move_key_modifier = 'A'
" use {H,J,K,L} to move lines
let g:move_key_modifier = 'S'
" tmux/vim resize amount
let g:window_resize_count = 2
" distraction free writing mode
let g:limelight_conceal_ctermfg = 240
@@ -139,11 +153,11 @@ augroup end
" █▓▒░ wizard status line
let s:base03 = [ '#151513', 233 ]
let s:base02 = [ '#222222', 0 ]
let s:base02 = [ '#303030', 0 ]
let s:base01 = [ '#4e4e43', 239 ]
let s:base00 = [ '#666656', 242 ]
let s:base0 = [ '#808070', 244 ]
let s:base1 = [ '#949484', 246 ]
let s:base1 = [ '#949484', 242 ]
let s:base2 = [ '#a8a897', 248 ]
let s:base3 = [ '#e8e8d3', 253 ]
let s:yellow = [ '#7A7A57', 11 ]
@@ -152,29 +166,30 @@ let s:red = [ '#5F8787', 1 ]
let s:magenta = [ '#8181A6', 13 ]
let s:cyan = [ '#87ceeb', 12 ]
let s:green = [ '#7A7A57', 3 ]
let s:none = [ 'none', 'none' ]
let s:p = {'normal': {}, 'inactive': {}, 'insert': {}, 'replace': {}, 'visual': {}, 'tabline': {}}
let s:p.normal.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ]
let s:p.normal.left = [ [ s:base02, s:cyan ], [ s:base3, s:base01 ] ]
let s:p.normal.right = [ [ s:base02, s:base1 ], [ s:base2, s:base01 ] ]
let s:p.inactive.right = [ [ s:base02, s:base00 ], [ s:base0, s:base02 ] ]
let s:p.inactive.left = [ [ s:base0, s:base02 ], [ s:base00, s:base02 ] ]
let s:p.insert.left = [ [ s:base02, s:cyan ], [ s:base3, s:base01 ] ]
let s:p.insert.left = [ [ s:base02, s:magenta ], [ s:base3, s:base01 ] ]
let s:p.replace.left = [ [ s:base02, s:red ], [ s:base3, s:base01 ] ]
let s:p.visual.left = [ [ s:base02, s:green ], [ s:base3, s:base01 ] ]
let s:p.normal.middle = [ [ s:base0, s:base02 ] ]
let s:p.inactive.middle = [ [ s:base00, s:base02 ] ]
let s:p.normal.middle = [ [ s:none, s:none ] ]
let s:p.inactive.middle = copy(s:p.normal.middle)
let s:p.tabline.left = [ [ s:base3, s:base00 ] ]
let s:p.tabline.tabsel = [ [ s:base3, s:base02 ] ]
let s:p.tabline.middle = [ [ s:base01, s:base1 ] ]
let s:p.tabline.middle = copy(s:p.normal.middle)
let s:p.tabline.right = copy(s:p.normal.right)
let s:p.normal.error = [ [ s:base02, s:yellow ] ]
let s:p.normal.warning = [ [ s:yellow, s:base01 ] ]
let g:lightline#colorscheme#sourcerer#palette = lightline#colorscheme#flatten(s:p)
let g:lightline#colorscheme#nord#palette = lightline#colorscheme#flatten(s:p)
set laststatus=2
let g:lightline = {
\ 'colorscheme': 'sourcerer',
\ 'colorscheme': 'nord',
\ 'active': {
\ 'left': [ [ 'filename' ],
\ [ 'linter', 'gitbranch' ] ],
@@ -207,24 +222,20 @@ function! WizMod()
endfunction
function! WizRO()
return &ft !~? 'help\|vimfiler' && &readonly ? '× ' : ''
" ×   
return &ft !~? 'help\|vimfiler' && &readonly ? '' : ''
endfunction
function! WizGit()
return exists('*fugitive#head') ? fugitive#head() : ''
return !IsTree() ? exists('*fugitive#head') ? fugitive#head() : '' : ''
endfunction
function! WizName()
let l:name = expand('%:t')
if l:name =~ 'NetrwTreeListing'
return ''
endif
return ('' != WizRO() ? WizRO() : WizMod()) .
\ ('' != expand('%:t') ? expand('%:t') : '[none]')
return !IsTree() ? ('' != WizRO() ? WizRO() : WizMod()) . ('' != expand('%:t') ? expand('%:t') : '[none]') : ''
endfunction
function! WizType()
return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype : '') : ''
return winwidth(0) > 70 ? (strlen(&filetype) ? ' ' . WebDevIconsGetFileTypeSymbol() . ' ' . &filetype : '') : ''
endfunction
function! WizEncoding()
@@ -233,7 +244,13 @@ endfunction
function! WizErrors() abort
let l:counts = ale#statusline#Count(bufnr(''))
return l:counts.total == 0 ? '' : printf('×%d', l:counts.total)
" ×   
return l:counts.total == 0 ? '' : printf(' %d', l:counts.total)
endfunction
function! IsTree()
let l:name = expand('%:t')
return l:name =~ 'NetrwTreeListing\|undotree\|NERD' ? 1 : 0
endfunction
augroup alestatus
Oops, something went wrong.

0 comments on commit 02cbf95

Please sign in to comment.