Skip to content

Instantly share code, notes, and snippets.

@loriopatrick
Created April 27, 2020 22:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loriopatrick/60582d265d4d333cc6469e0f4ffca861 to your computer and use it in GitHub Desktop.
Save loriopatrick/60582d265d4d333cc6469e0f4ffca861 to your computer and use it in GitHub Desktop.
set -sg escape-time 0
# Use C-a as prefix
unbind C-b
set-option -g prefix C-a
bind-key C-a send-prefix
# split panes using | and -
bind | split-window -h
bind - split-window -v
unbind '"'
unbind %
# Allow mouse stuff
set -g mouse on
bind r source-file ~/.tmux.conf
bind h select-pane -L
bind l select-pane -R
bind k select-pane -U
bind j select-pane -D
# vim like selection
bind-key -Tcopy-mode-vi 'v' send -X begin-selection
bind-key -Tcopy-mode-vi 'y' send -X copy-pipe "xclip -selection c > /dev/null"
# vim like movement
set-window-option -g mode-keys vi
######################
### DESIGN CHANGES ###
######################
# panes
set -g pane-border-fg black
set -g pane-active-border-fg brightred
## Status bar design
# status line
set -g status-justify left
set -g status-bg default
set -g status-fg colour12
set -g status-interval 2
# messaging
set -g message-fg black
set -g message-bg yellow
set -g message-command-fg blue
set -g message-command-bg black
#window mode
setw -g mode-bg colour6
setw -g mode-fg colour0
# window status
setw -g window-status-format " #F#I:#W#F "
setw -g window-status-current-format " #F#I:#W#F "
setw -g window-status-format "#[fg=magenta]#[bg=black] #I #[bg=cyan]#[fg=colour8] #W "
setw -g window-status-current-format "#[bg=brightmagenta]#[fg=colour8] #I #[fg=colour8]#[bg=colour14] #W "
setw -g window-status-current-bg colour0
setw -g window-status-current-fg colour11
setw -g window-status-current-attr dim
setw -g window-status-bg green
setw -g window-status-fg black
setw -g window-status-attr reverse
# Info on left (I don't have a session display for now)
set -g status-left ''
# loud or quiet?
set-option -g visual-activity off
set-option -g visual-bell off
set-option -g visual-silence off
set-window-option -g monitor-activity off
set-option -g bell-action none
set -g default-terminal "screen-256color"
set -g default-shell $SHELL
# The modes
setw -g clock-mode-colour colour135
setw -g mode-attr bold
setw -g mode-fg colour196
setw -g mode-bg colour238
# The panes
set -g pane-border-bg colour235
set -g pane-border-fg colour238
set -g pane-active-border-bg colour236
set -g pane-active-border-fg colour51
# The statusbar
set -g status-position bottom
set -g status-bg colour234
set -g status-fg colour137
set -g status-attr dim
set -g status-left ''
set -g status-right '#[fg=colour233,bg=colour241,bold] %d/%m #[fg=colour233,bg=colour245,bold] %H:%M:%S '
set -g status-right-length 50
set -g status-left-length 20
setw -g window-status-current-fg colour81
setw -g window-status-current-bg colour238
setw -g window-status-current-attr bold
setw -g window-status-current-format ' #I#[fg=colour250]:#[fg=colour255]#W#[fg=colour50]#F '
setw -g window-status-fg colour138
setw -g window-status-bg colour235
setw -g window-status-attr none
setw -g window-status-format ' #I#[fg=colour237]:#[fg=colour250]#W#[fg=colour244]#F '
setw -g window-status-bell-attr bold
setw -g window-status-bell-fg colour255
setw -g window-status-bell-bg colour1
# The messages
set -g message-attr bold
set -g message-fg colour232
set -g message-bg colour166
# Smart pane switching with awareness of Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
is_vim="ps -o state= -o comm= -t '#{pane_tty}' \
| grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'"
bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L"
bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D"
bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U"
bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R"
bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l"
set hidden
filetype off " required
" set the runtime path to include Vundle and initialize
call plug#begin('~/.vim/plugged')
Plug 'bling/vim-airline' " cool status bar
Plug 'airblade/vim-gitgutter' " git file changes
Plug 'scrooloose/nerdtree' " file explorer
Plug 'editorconfig/editorconfig-vim' " linting
Plug 'christoomey/vim-tmux-navigator' " tmux awesomeness
Plug 'ctrlpvim/ctrlp.vim' " Fuzzy search
" Lang Support
Plug 'pangloss/vim-javascript'
Plug 'groenewege/vim-less'
Plug 'JuliaLang/julia-vim'
Plug 'exu/pgsql.vim'
Plug 'rust-lang/rust.vim'
Plug 'tomlion/vim-solidity'
Plug 'hashivim/vim-terraform'
" Language server client
Plug 'autozimu/LanguageClient-neovim', {
\ 'branch': 'next',
\ 'do': 'bash install.sh',
\ }
" Colors
Plug 'vim-scripts/summerfruit256.vim'
Plug 'NLKNguyen/papercolor-theme'
Plug 'morhetz/gruvbox'
Plug 'vim-scripts/moria'
Plug 'agude/vim-eldar'
call plug#end()
filetype plugin indent on " required
" Rust Config
filetype plugin on
set omnifunc=syntaxcomplete#Complete
let g:LanguageClient_serverCommands = {
\ 'rust': ['~/.cargo/bin/rustup', 'run', 'stable', 'rls'],
\ }
" Only search in current dir with Ctrl-P
let g:ctrlp_cmd='CtrlP :pwd'
if executable('ag')
" Use The Silver Searcher https://github.com/ggreer/the_silver_searcher
set grepprg=ag\ --nogroup\ --nocolor
" Use ag in CtrlP for listing files. Lightning fast, respects .gitignore
" and .agignore. Ignores hidden files by default.
let g:ctrlp_user_command = 'ag %s -l --nocolor -f -g ""'
else
"ctrl+p ignore files in .gitignore
let g:ctrlp_user_command = ['.git', 'cd %s && git ls-files . -co --exclude-standard', 'find %s -type f']
endif
" Enable postgres highlighting on .sql
let g:sql_type_default = 'pgsql'
" Speed up regex
set re=1
" Plugin Configs
let g:jsx_ext_required = 0 " jsx enable for .js files
let g:airline_powerline_fonts = 0 " use nice fonts for airline
autocmd FileType sql :let b:vimpipe_command="psql mydatabase"
autocmd FileType sql :let b:vimpipe_filetype="postgresql"
" Share clipboard between instances
set clipboard=unnamedplus
" No more swap and back files
set nobackup
set noswapfile
" Indnet suff
set autoindent
set copyindent
" Search case
set ignorecase
set smartcase
syntax on " syntax highlight
set number " show line numbers
set laststatus=2 " show airline
" Add menu add bottom for page for tab completion
set wildmenu
set wildmode=list:longest,full
" improve render speed
set ttyfast
set lazyredraw
" set theme
colorscheme eldar
set background=dark
" fix tab and backspace
set backspace=indent,eol,start
set tabstop=2
set shiftwidth=2
set expandtab
set cursorline " highlight current line
" Highlight search
set hlsearch
set incsearch
set smartcase
set so=5 " keep cursor 5 lines in window
set foldmethod=syntax foldlevel=999999 " set fold mode
" Open NERDTREE
nmap <C-y> :NERDTreeToggle<CR>
if has('nvim')
nmap <BS> <C-W>h
endif
" Change tab
nmap <silent> <S-h> :tabp<CR>
nmap <silent> <S-l> :tabn<CR>
" tmux navigation
let g:tmux_navigator_no_mappings = 1
let g:tmux_navigator_save_on_switch = 2
nnoremap <silent> <BS> :TmuxNavigateLeft<cr>
nnoremap <silent> <C-h> :TmuxNavigateLeft<cr>
nnoremap <silent> <C-j> :TmuxNavigateDown<cr>
nnoremap <silent> <C-k> :TmuxNavigateUp<cr>
nnoremap <silent> <C-l> :TmuxNavigateRight<cr>
nnoremap <silent> <C-\> :TmuxNavigatePrevious<cr>
imap <Tab> <Tab>
" Resize window commands
nnoremap <silent> + :exe "resize " . (winheight(0) * 8/7)<CR>
nnoremap <silent> _ :exe "resize " . (winheight(0) * 7/8)<CR>
nnoremap <silent> = :exe "vertical resize " . (winwidth(0) * 8/7)<CR>
nnoremap <silent> - :exe "vertical resize " . (winwidth(0) * 7/8)<CR>
" Quit commands
nmap <S-s> :write<CR>
nmap <S-q> :qall<CR>
nmap <S-w> :q<CR>
" Clear search highlight
nmap <silent> <S-m> :nohl<CR>
" Move quickly
nmap <S-j> jjjj
nmap <S-k> kkkk
vmap <S-j> jjjj
vmap <S-k> kkkk
vmap <S-h> ^
vmap <S-l> $
" nmap <S-h> ^
" nmap <S-l> $
" Go to end of line
inoremap <S-Tab> <Esc><S-a>
nnoremap <S-Tab> $
" Enable spell check
" noremap <C-s> :set spell!<CR>
" set spelllang=en_us
"
set clipboard=unnamedplus
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment