Skip to content

Instantly share code, notes, and snippets.

@guilhermelimak
Last active May 18, 2019 18:17
Show Gist options
  • Select an option

  • Save guilhermelimak/10f7e954ad66b7d74f965bddf8fc4f39 to your computer and use it in GitHub Desktop.

Select an option

Save guilhermelimak/10f7e954ad66b7d74f965bddf8fc4f39 to your computer and use it in GitHub Desktop.
VPS Config files
## Starts a tmux session on ssh connect
if [[ -z "$TMUX" ]] && [ "$SSH_CONNECTION" != "" ]; then
tmux attach-session -t ssh_tmux || tmux new-session -s ssh_tmux
fi
alias nvim="vim"
alias :q="exit"
alias :wq="exit"
alias myip='curl ipecho.net/plain ; echo'
# some more ls aliases
alias ll='ls -l'
alias la='ls -A'
alias l='ls -CF'
# enable color support of ls and also add handy aliases
if [ -x /usr/bin/dircolors ]; then
test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)"
alias ls='ls --color=auto'
alias dir='dir --color=auto'
alias vdir='vdir --color=auto'
alias grep='grep --color=auto'
alias fgrep='fgrep --color=auto'
alias egrep='egrep --color=auto'
fi
# ~/.bashrc: executed by bash(1) for non-login shells.
# see /usr/share/doc/bash/examples/startup-files (in the package bash-doc)
# for examples
# If not running interactively, don't do anything
case $- in
*i*) ;;
*) return;;
esac
# don't put duplicate lines or lines starting with space in the history.
# See bash(1) for more options
HISTCONTROL=ignoreboth
# append to the history file, don't overwrite it
shopt -s histappend
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
HISTSIZE=1000
HISTFILESIZE=2000
# check the window size after each command and, if necessary,
# update the values of LINES and COLUMNS.
shopt -s checkwinsize
# If set, the pattern "**" used in a pathname expansion context will
# match all files and zero or more directories and subdirectories.
#shopt -s globstar
# make less more friendly for non-text input files, see lesspipe(1)
#[ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)"
# set variable identifying the chroot you work in (used in the prompt below)
if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then
debian_chroot=$(cat /etc/debian_chroot)
fi
# set a fancy prompt (non-color, unless we know we "want" color)
case "$TERM" in
xterm-color|*-256color) color_prompt=yes;;
esac
# uncomment for a colored prompt, if the terminal has the capability; turned
# off by default to not distract the user: the focus in a terminal window
# should be on the output of commands, not on the prompt
#force_color_prompt=yes
if [ -n "$force_color_prompt" ]; then
if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then
# We have color support; assume it's compliant with Ecma-48
# (ISO/IEC-6429). (Lack of such support is extremely rare, and such
# a case would tend to support setf rather than setaf.)
color_prompt=yes
else
color_prompt=
fi
fi
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\] '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w '
fi
PS1="$PS1(  ̄ー ̄)σ "
unset color_prompt force_color_prompt
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1"
;;
*)
;;
esac
# colored GCC warnings and errors
#export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
# enable programmable completion features (you don't need to enable
# this, if it's already enabled in /etc/bash.bashrc and /etc/profile
# sources /etc/bash.bashrc).
if ! shopt -oq posix; then
if [ -f /usr/share/bash-completion/bash_completion ]; then
. /usr/share/bash-completion/bash_completion
elif [ -f /etc/bash_completion ]; then
. /etc/bash_completion
fi
fi
source .autotmux
## Mouse options
set -g mouse on
set -g visual-activity off
## Start counting windows from 1
set -g base-index 1
setw -g mode-keys vi
## titles
set-window-option -g automatic-rename on
set-option -g set-titles on
## Toggle copymode
bind Escape copy-mode
##open and close splits
bind -n M-/ split-window -h
bind -n M-- split-window -v
bind -n M-x killp
bind -n M-z resize-pane -Z
unbind '"'
unbind %
# Use Ctrl-arrows to navigate text
set-window-option -g xterm-keys on
bind -n M-h select-pane -L
bind -n M-l select-pane -R
bind -n M-k select-pane -U
bind -n M-j select-pane -D
# Shift arrow to switch windows
bind -n M-T new-window
bind -n M-J prev
bind -n M-K next
# No delay for escape key press
set -sg escape-time 0
# Reload tmux config
bind r source-file ~/.tmux.conf
set -g prefix C-b
set -g pane-active-border-fg colour79
setw -g aggressive-resize on
# ----------------------
# Status Bar
# -----------------------
set-option -g status on # turn the status bar on
set -g status-interval 15 # set update frequencey (default 15 seconds)
set -g status-justify centre # center window list for clarity
set-option -g status-position bottom # position the status bar at top of screen
# visual notification of activity in other windows
setw -g monitor-activity on
set -g visual-activity on
# set color for status bar
set-option -g status-bg colour235 #base02
set-option -g status-fg yellow #yellow
set-option -g status-attr dim
# set window list colors - red for active and cyan for inactive
set-window-option -g window-status-fg colour29 #base0
set-window-option -g window-status-bg colour236
set-window-option -g window-status-attr dim
set-window-option -g window-status-current-fg colour79 #orange
set-window-option -g window-status-current-bg colour236
set-window-option -g window-status-current-attr bright
# show host name
set -g status-left-length 70
set -g status-left "#[fg=green]: #h :"
# Don't show anything on the left side of the bar
#set -g status-left ""
# show session name, window & pane number, date and time on right side of
# status bar
set -g status-right-length 60
set -g status-right "#[fg=blue]#S #I:#P #[fg=yellow]:: %d/%m/%Y #[fg=green]:: %H:%M"
# Don't show anything on the right side of the bar
#set -g default-command "/usr/bin/zsh"
set -g default-terminal screen-256color
set -as terminal-overrides ',st*:kind@:kri@'
# Better mouse support
set -g @prevent-scroll-for-fullscreen-alternate-buffer 'on'
set -g @scroll-speed-num-lines-per-scroll '3'
" Remap leader
nnoremap <SPACE> <Nop>
let mapleader=" "
set background=dark
filetype plugin indent on " required
syntax enable
" set colorcolumn=100
set autoread
set pastetoggle=<F2>
set number
set t_Co=256
set clipboard=unnamedplus
set mouse=a
set shell=/bin/bash
set ul=99
set laststatus=2
set timeoutlen=500 ttimeoutlen=0
set shiftwidth=2
set softtabstop=2
set backspace=indent,eol,start
set tabstop=2
set expandtab
set encoding=utf8
set ruler
set incsearch
set noswapfile
set cursorline
set hid
set smartcase
"remove mode status from bottom line
set noshowmode
set noshowmatch
"disable .swp files
set nobackup
"Open new buffers in new page
set switchbuf+=usetab,newtab
"Display hidden chars
set listchars=tab:>·
set list
"Set tags directory
" == Autocmd
"disable autocomment on paste
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" remove trailing whitespace on save
autocmd BufWritePre * :%s/\s\+$//e
au BufReadPre //* :NoMatchParen
" == Maps
" Disable autoindent paste
nnoremap <F2> :set invpaste paste?<CR>
imap <C-g> <CR><Esc>O<Tab>
" Map emmet to <C-e>
imap <C-e> <C-y>,
nmap <leader>ee :lnext<cr>
nmap <silent> T :TestFile<CR>
" Move lines
nmap <c-l> [e
nmap <c-k> ]e
vmap <c-k> ]egv
vmap <c-l> [egv
"save read only files without reopening vim
cmap w!! w !sudo tee % >/dev/null
nnoremap <leader>s :source ~/.vimrc<CR>
nnoremap <leader>v :e ~/.vimrc<CR>
nnoremap <leader>j <c-w><c-h>
nnoremap <leader>k <c-w><c-j>
nnoremap <leader>l <c-w><c-k>
nnoremap <leader>r <c-w><c-r>
nnoremap <leader>; <c-w><c-l>
nnoremap <leader>e :e ~/
nnoremap <leader>f /
nnoremap <leader>w <c-w><c-w>
nnoremap <leader>c :GoMetaLinter<CR>
" change ' to "
nnoremap <f11> :%s/'\([^']*\)'/"\1"/g<cr>
" change " to '
nnoremap <F12> :%s/"\([^"]*\)"/'\1'/g<CR>
map <leader>q :q<CR>
map <leader>t :tabnew<CR>
nnoremap <leader>hs :sp<CR>
nnoremap <leader>vs :vsp<CR>
nnoremap <leader><leader> :w<CR>
nnoremap <c-s> :w<CR>
" go to tab
map <leader>1 1gt
map <leader>2 2gt
map <leader>3 3gt
map <leader>4 4gt
map <leader>5 5gt
map <leader>6 6gt
map <leader>7 7gt
map <leader>8 8gt
"normalmov
" nnoremap j h
" nnoremap k gj
" nnoremap l gk
" nnoremap ; l
" "visualmov
" vnoremap j h
" vnoremap k gj
" vnoremap l gk
" vnoremap ; l
vnoremap j gj
vnoremap k gk
nnoremap j gj
nnoremap k gk
"allow . to repeat visual commands
vnoremap . :norm.<CR>
" Highlight extra whitespace
hi ExtraWhitespace ctermbg=red
nnoremap <C-o> :call NumberToggle()<cr>
let &t_SI = "\<Esc>[6 q"
let &t_SR = "\<Esc>[4 q"
let &t_EI = "\<Esc>[2 q"
" vnoremap K gT
" vnoremap L gt
" nnoremap K gT
" nnoremap L gt
vnoremap J gT
vnoremap K gt
nnoremap J gT
nnoremap K gt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment