Skip to content

Commit ea0df0d

Browse files
committed
Refact config
1 parent 3601da0 commit ea0df0d

File tree

4 files changed

+65
-93
lines changed

4 files changed

+65
-93
lines changed

tmux.conf

Lines changed: 19 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,98 +1,62 @@
11
# General ##################################################################
22
set -g mouse on
3-
4-
# utf8 is on
5-
set -g utf8 on
6-
set -g status-utf8 on
7-
8-
# address vim mode switching delay (http://superuser.com/a/252717/65504)
9-
set -s escape-time 0
10-
11-
# increase scrollback buffer size
12-
set -g history-limit 50000
13-
14-
# tmux messages are displayed for 4 seconds
15-
set -g display-time 4000
16-
17-
# refresh 'status-left' and 'status-right' more often
3+
set -s escape-time 0 # address vim mode switching delay
4+
set -g history-limit 50000 # increase scrollback buffer size
185
set -g status-interval 5
19-
20-
# upgrade $TERM
216
set -g default-terminal "screen-256color"
22-
23-
# vi keybinding
24-
set -g mode-keys vi
25-
26-
# focus events enabled for terminals that support them
27-
set -g focus-events on
28-
29-
# super useful when using "grouped sessions" and multi-monitor setup
30-
setw -g aggressive-resize on
7+
set -g mode-keys vi # vi keybinding
8+
set -g focus-events on # focus events enabled for terminals that support them
9+
setw -g aggressive-resize on # super useful when using "grouped sessions" and multi-monitor setup
3110

3211
# change default prefix key
3312
set -g prefix C-a
3413
unbind C-b
3514
bind C-a send-prefix
3615

37-
set -g base-index 1 # start windows numbering at 1
38-
setw -g pane-base-index 1 # make pane numbering consistent with windows
39-
set -g renumber-windows on # renumber windows when a window is closed
16+
set -g base-index 1 # start windows numbering at 1
17+
setw -g pane-base-index 1 # make pane numbering consistent with windows
18+
set -g renumber-windows on # renumber windows when a window is closed
4019

20+
# vim keybinding
4121
bind / copy-mode \; send-key ?
4222
bind-key -T copy-mode-vi v send-keys -X begin-selection
4323
bind-key -T copy-mode-vi y send-keys -X copy-selection-and-cancel
4424
bind-key -T copy-mode-vi C-w send-keys b \; send -X begin-selection \; send-keys E
45-
bind-key -T copy-mode-vi C-shift-c send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
46-
47-
bind l choose-tree # list and choose sessions
25+
bind-key -T copy-mode-vi C-c send-keys -X copy-pipe-and-cancel "xclip -in -selection clipboard"
4826

49-
# bind key to toggle mouse
27+
bind l choose-session
5028
bind m set -g mouse \; display "Mouse #{?mouse,on,off}"
51-
52-
# reload config
5329
bind r source-file ~/.tmux.conf \; display "tmux.conf reloaded."
54-
55-
# fullscreen
5630
bind f resize-pane -Z
57-
58-
# split windows like vim
5931
bind v split-window -h -c "#{pane_current_path}"
6032
bind s split-window -v -c "#{pane_current_path}"
61-
62-
bind > swap-pane -D # swap current pane with the next one
63-
bind < swap-pane -U # swap current pane with the previous one
64-
65-
# pane resizing
33+
bind > swap-pane -D
34+
bind < swap-pane -U
6635
bind -r H resize-pane -L 4
6736
bind -r J resize-pane -D 4
6837
bind -r K resize-pane -U 4
6938
bind -r L resize-pane -R 4
39+
bind C-p previous-window
40+
bind C-n next-window
7041

7142
# Open small terminal :D
7243
bind T split-window -l 15 -c "#{pane_current_path}" \; display "Create terminal"
7344
bind t resize-pane -t 1 -Z
7445

75-
# Vim Tmux navigator
76-
# see: https://github.com/christoomey/vim-tmux-navigator
7746
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
78-
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
47+
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
7948
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
8049
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
8150
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
8251
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
83-
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
52+
bind -n 'C-\' if-shell "$is_vim" "send-keys 'C-\\'" "select-pane -l"
8453
bind-key -T copy-mode-vi C-h select-pane -L
8554
bind-key -T copy-mode-vi C-j select-pane -D
8655
bind-key -T copy-mode-vi C-k select-pane -U
8756
bind-key -T copy-mode-vi C-l select-pane -R
88-
bind-key -T copy-mode-vi C-\ select-pane -l
57+
bind-key -T copy-mode-vi 'C-\' select-pane -l
8958

9059
# Theme file ################################################################
9160
source-file ~/dotfiles/tmux.conf.basic
9261

93-
# List of plugins
94-
set -g @plugin 'tmux-plugins/tpm'
95-
set -g @plugin 'tmux-plugins/tmux-resurrect'
96-
97-
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
98-
run -b '~/.tmux/plugins/tpm/tpm'
62+
run-shell ~/dotfiles/tmux/plugins/tmux-resurrect/resurrect.tmux

tmux/plugins/tmux-resurrect

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Subproject commit 1160c1da711c47f5b9a3983433442569f3c9d22b

vim/vimrc

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -142,10 +142,10 @@ Plug 'ap/vim-css-color'
142142
" Plug 'neoclide/coc-eslint', {'do': 'yarn install --frozen-lockfile'}
143143

144144
" UI
145-
Plug 'vim-airline/vim-airline'
146-
Plug 'vim-airline/vim-airline-themes'
147-
" Plug 'itchyny/lightline.vim'
148-
" Plug 'mengelbrecht/lightline-bufferline'
145+
" Plug 'vim-airline/vim-airline'
146+
" Plug 'vim-airline/vim-airline-themes'
147+
Plug 'itchyny/lightline.vim'
148+
Plug 'mengelbrecht/lightline-bufferline'
149149
Plug 'morhetz/gruvbox'
150150

151151
" other
@@ -171,36 +171,37 @@ colorscheme gruvbox
171171
let g:gruvbox_contrast_dark='hard'
172172
set background=dark
173173

174-
" Airline config
175-
let g:airline#extensions#tabline#enabled = 1
176-
let g:airline#extensions#tabline#show_tabs = 0
177-
let g:airline#extensions#tabline#left_sep = ' '
178-
let g:airline#extensions#tabline#left_alt_sep = '|'
179-
let g:airline_theme='gruvbox'
180-
let g:airline_powerline_fonts = 1
181-
182-
" " Lightline config
183-
" let g:lightline = {
184-
" \ 'colorscheme': 'gruvbox',
185-
" \ 'active': {
186-
" \ 'left':[ [ 'mode', 'paste' ],
187-
" \ [ 'gitbranch', 'readonly', 'filename', 'modified' ]
188-
" \ ]
189-
" \ },
190-
" \ 'component': {
191-
" \ 'lineinfo': ' %3l:%-2v',
192-
" \ },
193-
" \ 'component_function': {
194-
" \ 'gitbranch': 'fugitive#head',
195-
" \ }
196-
" \ }
197-
" let g:lightline.tabline = {
198-
" \ 'left': [ ['buffers'] ],
199-
" \ 'right': [ ['close'] ]
200-
" \ }
201-
" let g:lightline.component_expand = {'buffers': 'lightline#bufferline#buffers'}
202-
" let g:lightline.component_type = {'buffers': 'tabsel'}
203-
" set showtabline=2 " Show tabline
174+
" " Airline config
175+
" let g:airline#extensions#tabline#enabled = 1
176+
" let g:airline#extensions#tabline#show_tabs = 0
177+
" let g:airline#extensions#ale#enabled = 1
178+
" let g:airline#extensions#tabline#left_sep = ' '
179+
" let g:airline#extensions#tabline#left_alt_sep = '|'
180+
" let g:airline_theme='gruvbox'
181+
" let g:airline_powerline_fonts = 1
182+
183+
" Lightline config
184+
let g:lightline = {
185+
\ 'colorscheme': 'gruvbox',
186+
\ 'active': {
187+
\ 'left':[ [ 'mode', 'paste' ],
188+
\ [ 'gitbranch', 'readonly', 'filename', 'modified' ]
189+
\ ]
190+
\ },
191+
\ 'component': {
192+
\ 'lineinfo': ' %3l:%-2v',
193+
\ },
194+
\ 'component_function': {
195+
\ 'gitbranch': 'fugitive#head',
196+
\ }
197+
\ }
198+
let g:lightline.tabline = {
199+
\ 'left': [ ['buffers'] ],
200+
\ 'right': [ ['close'] ]
201+
\ }
202+
let g:lightline.component_expand = {'buffers': 'lightline#bufferline#buffers'}
203+
let g:lightline.component_type = {'buffers': 'tabsel'}
204+
set showtabline=2 " Show tabline
204205

205206
" NERDTree
206207
let g:NERDTreeMouseMode=3
@@ -242,7 +243,7 @@ if executable('ag')
242243
endif
243244

244245
" Ale plugin
245-
let g:ale_fix_on_save = 1
246+
" let g:ale_fix_on_save = 1
246247
let g:ale_fixers = {
247248
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
248249
\ 'ruby': ['rubocop'],

zshrc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,12 +73,18 @@ plugins=(rails docker git ruby tmux zsh-autosuggestions zsh-syntax-highlighting)
7373

7474
source $ZSH/oh-my-zsh.sh
7575

76-
# User configuration
76+
# Key binding #################################################################
7777
bindkey '^ ' autosuggest-accept
78-
79-
# Disable Ctrl-S and Ctrl-Q in terminal
8078
stty -ixon
8179

80+
# vi mode
81+
# bindkey -v
82+
bindkey "^[" vi-cmd-mode
83+
84+
# handy keybindings
85+
bindkey "^B" beginning-of-line
86+
bindkey "^E" end-of-line
87+
8288
export EDITOR='vim'
8389

8490
# export MANPATH="/usr/local/man:$MANPATH"

0 commit comments

Comments
 (0)