Skip to content

Instantly share code, notes, and snippets.

@faraazkhan
Last active April 19, 2021 15:34
Show Gist options
  • Save faraazkhan/4a083497dc2c1d6ead91a1feb401a869 to your computer and use it in GitHub Desktop.
Save faraazkhan/4a083497dc2c1d6ead91a1feb401a869 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
DIST=089bdac4580d62e7a3a051de60fd34dfc0a3d293
wget "https://gist.github.com/faraazkhan/4a083497dc2c1d6ead91a1feb401a869/archive/$DIST.zip" --no-check-certificate
unzip "$DIST.zip"
cd "4a083497dc2c1d6ead91a1feb401a869-$DIST"
sh setup.sh
#!/usr/bin/env bash
rm -rf ~/.tmux/plugins/tpm
rm ~/.vimrc
cp vimrc ~/.vimrc
cp tmux.conf ~/.tmux.conf
git config --global http.sslVerify false
git clone https://github.com/tmux-plugins/tpm ~/.tmux/plugins/tpm
curl -fLo ~/.vim/autoload/plug.vim --create-dirs \
https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
sudo apt-get install jq tmux -y
rm -rf $(which kubectl)
curl -kLO https://dl.k8s.io/release/v1.21.0/bin/linux/amd64/kubectl
chmod +x kubectl
sudo mv kubectl /usr/bin/kubectl
echo "export do='--dry-run=client -o yaml'" >> ~/.bashrc
echo "alias k=kubectl" >> ~/.bashrc
echo 'source <(kubectl completion bash)' >>~/.bashrc
echo 'complete -F __start_kubectl k' >>~/.bashrc
# INSTALL
# cp tmuxconf ~/.tmux.conf
#
# Set prefix key to c-f instead of default c-b
unbind C-b
set -g prefix C-f
bind C-f send-prefix
# toggle last window by hitting again C-f
bind-key C-f last-window
# Shift arrow to switch windows
#bind -n S-Left previous-window
#bind -n S-Right next-window
# Start windows and pane numbering with index 1 instead of 0
set -g base-index 1
setw -g pane-base-index 1
# re-number windows when one is closed
set -g renumber-windows on
# highlight window when it has new activity
setw -g monitor-activity on
set -g visual-activity on
# Show times longer than supposed
set -g display-panes-time 2000
# tmux messages are displayed for 4 seconds
set -g display-time 4000
# {n}vim compability
set -g default-terminal "screen-256color"
# Split horiziontal and vertical splits, instead of % and "
# Also open them in the same directory
bind-key v split-window -h -c '#{pane_current_path}'
bind-key s split-window -v -c '#{pane_current_path}'
# Pressing Ctrl+Shift+Left (will move the current window to the left. Similarly
# right. No need to use the modifier (C-b).
bind-key -n C-S-Left swap-window -t -1
bind-key -n C-S-Right swap-window -t +1
# Source file
unbind r
bind r source-file ~/.tmux.conf \; display "Reloaded!"
# Use vim keybindings in copy mode
setw -g mode-keys vi
# Select and copy with v and y, instead of default space and enter
bind-key -T edit-mode-vi Up send-keys -X history-up
bind-key -T edit-mode-vi Down send-keys -X history-down
unbind-key -T copy-mode-vi Space ; bind-key -T copy-mode-vi v send-keys -X begin-selection
unbind-key -T copy-mode-vi Enter ; bind-key -T copy-mode-vi y send-keys -X copy-selection
unbind-key -T copy-mode-vi C-v ; bind-key -T copy-mode-vi C-v send-keys -X rectangle-toggle
unbind-key -T copy-mode-vi [ ; bind-key -T copy-mode-vi [ send-keys -X begin-selection
unbind-key -T copy-mode-vi ] ; bind-key -T copy-mode-vi ] send-keys -X copy-selection
# Clear screen with Ctrl+k
bind -n C-k send-keys -R \; send-keys C-l \; clear-history
# emacs key bindings in tmux command prompt (prefix + :) are better than
# vi keys, even for vim users, not really :P
set -g status-keys vi
# focus events enabled for terminals that support them
set -g focus-events on
# Sync panes (Send input to all panes in the window). When enabled, pane
# borders become red as an indication.
bind C-s if -F '#{pane_synchronized}' \
'setw synchronize-panes off; \
setw pane-active-border-style fg=colour63,bg=default; \
setw pane-border-format " #P "' \
'setw synchronize-panes on; \
setw pane-active-border-style fg=red; \
setw pane-border-format " #P - Pane Synchronization ON "'
# Faster command sequence
set -s escape-time 0
# Have a very large history
set -g history-limit 1000000
# Mouse mode on
set -g terminal-overrides 'xterm*:smcup@:rmcup@'
set-option -sa terminal-overrides ',screen-256color:RGB'
set -g mouse on
# Set title
set -g set-titles on
set -g set-titles-string "#T"
# Equally resize all panes
bind-key = select-layout even-horizontal
bind-key | select-layout even-vertical
# Resize panes
bind-key J resize-pane -D 10
bind-key K resize-pane -U 10
bind-key H resize-pane -L 10
bind-key L resize-pane -R 10
# Select panes
# NOTE(arslan): See to prevent cycling https://github.com/tmux/tmux/issues/1158
bind-key j select-pane -D
bind-key k select-pane -U
bind-key h select-pane -L
bind-key l select-pane -R
# Hide Status Bar
bind-key b set-option -g status
# Disable confirm before killing
bind-key x kill-pane
set -g pane-border-style fg=colour240
set -g pane-active-border-style fg=colour148
set -g message-command-style fg=colour231,bg=colour240
set -g message-style fg=colour231,bg=colour240
setw -g window-status-separator ""
setw -g window-status-style fg=colour245,bg=colour236,none
setw -g window-status-activity-style fg=colour148,bg=colour236,none
setw -g window-status-format "#[fg=colour245,bg=colour236] #I #[fg=colour245,bg=colour236]#W "
setw -g window-status-current-format "#[fg=colour236,bg=colour240,nobold,nounderscore,noitalics]#[fg=colour231,bg=colour240] #I #[fg=colour231,bg=colour240]#W #[fg=colour240,bg=colour236,nobold,nounderscore,noitalics]"
# set -g window-style 'fg=colour247,bg=colour236'
# set -g window-active-style 'fg=colour250,bg=black'
# List of plugins
# see this https://github.com/tmux-plugins/tpm to installation
set -g @plugin 'tmux-plugins/tpm'
set -g @plugin 'tmux-plugins/tmux-yank'
set -g @plugin 'tmux-plugins/tmux-open'
set -g @plugin 'tmux-plugins/tmux-prefix-highlight'
set -g @plugin 'tmux-plugins/tmux-sessionist'
set -g @plugin 'soyuka/tmux-current-pane-hostname'
set -g @plugin 'tmux-plugins/tmux-battery'
set -g @plugin 'Morantron/tmux-fingers'
set -g @plugin 'tmux-plugins/tmux-resurrect'
set -g @plugin 'tmux-plugins/tmux-continuum'
# Automatically restore last session when starting tmux
set -g @continuum-boot 'on'
set -g @continuum-restore 'on'
set -g @continuum-boot-options 'iterm,fullscreen'
# Restore Neovim Sessions across reboot
set -g @resurrect-strategy-nvim 'session'
set -g @resurrect-capture-pane-contents 'on'
# Restore VPN Connection
set -g @resurrect-processes 'openconnect vpn-slice'
# Configure tmux-fingers https://github.com/Morantron/tmux-fingers#fingers-patterns-N
set -g @fingers-key a
set -g @fingers-command 'echo {} | tmux load-buffer -'
set -g @fingers-upcase-command 'echo {} | tmux load-buffer -'
set -g @fingers-hint-bg-color blue
set -g @fingers-hint-fg-color green
set -g @fingers-contrast 1
set -g @fingers-patterns-1 '[a-z0-9]+(-[a-z0-9]+)*'
####
#set -g @plugin 'christoomey/vim-tmux-navigator'
# Smart pane switching with awareness of Nvim/Vim splits.
# See: https://github.com/christoomey/vim-tmux-navigator
# Initialize TMUX plugin manager (keep this line at the very bottom of tmux.conf)
run '~/.tmux/plugins/tpm/tpm'
"https://github.com/golang/tools/blob/master/gopls/doc/settings.md#buildflags-string Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
call plug#begin('~/.local/share/nvim/plugged')
Plug 'Chiel92/vim-autoformat'
Plug 'tsandall/vim-rego'
Plug 'ekalinin/Dockerfile.vim'
Plug 'jiangmiao/auto-pairs'
call plug#end()
" Turn off toolbar for macvim
if has("gui_running")
set guioptions=emgrt
endif
" http://springest.io/vim-font-size-depending-screen-size
" Set font size based on screen size. When vertical height is greater than 900
" (i.e. an external monitor is attached on 13" or smaller MacBooks), use 22, else use 16
"if has('mac')
"if system("osascript -e 'tell application \"Finder\" to get bounds of window of desktop' | cut -d ' ' -f 4") > 900
"set guifont=Menlo\ Regular:h22
"else
"set guifont=Menlo\ Regular:h16
"endif
"endif
" Basic Vim Settings
syntax enable
syntax sync minlines=256
filetype off
filetype plugin indent on
highlight Comment cterm=italic gui=italic
scriptencoding utf-8
set mmp=10000
set background=dark
set colorcolumn=120 "highlight this column so you can break line
set ttyfast "faster terminal connection
set laststatus=2 "always show statusline
set encoding=utf-8 "set default encoding
set autoread "auto read changed files
set autowrite "auto write changed files
set backspace=indent,eol,start "meaningful backspace
set cmdheight=2 "give more space for displaying messages
set updatetime=300
set shortmess+=c
set noerrorbells "No beeps
set number "show line numbers
set showcmd "show what I am typing
set noshowmode "we use airline
set noswapfile "dont use swapfile
set nobackup "no backups!
set nowritebackup
set signcolumn=yes
set nocompatible "Enables vim specific features
set hidden " buffer should exist if window is closed
set fileformats=unix,dos,mac "Prefer unix over windows over OS 9 formats
set history=100
set mouse=a " Automatically enable mouse usage
set mousehide " Hide the mouse cursor while typing
set completeopt=menu,menuone "show popup menu even with one match
set pumheight=10 "max height for completion window
set nocursorcolumn " do not highlight column
set nocursorline " do not highlight line
set lazyredraw "wait to redraw
set t_Co=256 "enable 256 colors
set synmaxcol=300
set re=1
set termguicolors
set showmatch " show matching parentheses
set foldmethod=syntax "fold based on syntax
set foldnestmax=10 "deepest fold is 10 levels
set nofoldenable "dont fold by default
set foldlevel=1 "what I use right now
set wildignore+=*/vcr_cassettes/*,*/bundle_vendor/*,*/node_modules/*,*/tmp/*,*/log/*,*.iso,*.box,packer_cache/*,output-*,*/.git/*,*/vendor/* "ignore these dirs when searching or with NerdTree
set nowrap
set splitright "Puts new vsplit to the right
set splitbelow "Puts new hsplit to the bottom
set tags=tags;/ "Set tags in current directory or parent dir
" Dont like molokai's settings for Visual mode
hi Visual term=reverse cterm=reverse guibg=Yellow guifg=#004A85
" Search related settings
set hlsearch " vim will highlight searched words
set incsearch " Find as you type search
set ignorecase " Case insensitive search
set smartcase " Case sensitive when upper case present
set wildmenu " Show list instead of just completing
" Auto completion settings
set wildmode=list:longest,full " Command <Tab> completion, list matches, then longest common part, then all.
" Indentation without hard tabs
set autoindent "copy indent level from previous file
set shiftwidth=2
set expandtab "tabs are spaces not tabs
set tabstop=2
set softtabstop=2
set smartindent "automatically insert extra level of indentation when appropriate
" yank, d, c all write to the mac clipboard
if has('clipboard')
if has('unnamedplus') " When possible use + register for copy-paste
set clipboard^=unnamed
set clipboard^=unnamedplus
else " On mac and Windows, use * register for copy-paste
set clipboard=unnamed
endif
endif
" Undo Stuff
if has('persistent_undo')
set undofile " So is persistent undo ...
set undolevels=1000 " Maximum number of changes that can be undone
set undoreload=10000 " Maximum number lines to save for undo on a buffer reload
set undodir=~/.undodir
endif
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment