Skip to content

Instantly share code, notes, and snippets.

@hoandang
Created September 5, 2015 09:30
Show Gist options
  • Save hoandang/316c9609b00e3d7d8d93 to your computer and use it in GitHub Desktop.
Save hoandang/316c9609b00e3d7d8d93 to your computer and use it in GitHub Desktop.
#!/bin/bash
cat > ~/.bash_profile <<EOL
export VISUAL=vim
export EDITOR="$VISUAL"
alias install="sudo apt-get -y install"
alias update="sudo apt-get -y update"
alias upgrade="sudo apt-get -y upgrade"
alias v="vim"
alias c="clear"
alias ..="cd .."
alias vimrc="vim ~/.vimrc"
alias src="source ~/.bash_profile"
alias ll="ls -l"
alias la="ls -la"
alias rc="vim ~/.bash_profile"
alias rm="sudo rm -rf"
function hs()
{
history | grep $1
}
# @param target
# @param filetype
# @param chmod number (755 or 644, or etc..)
function chmodfilter()
{
find $1 -type $2 -exec chmod $3 {} \;
}
EOL
cat > ~/.vimrc <<EOL
set nocompatible
set tabstop=2
set shiftwidth=2
set expandtab
set softtabstop=2
set shiftround
set hlsearch
set incsearch
set ignorecase
set smartcase
noremap <C-c> :set hlsearch!<CR>
map Q <Nop>
vnoremap < <gv
vnoremap > >gv
cmap W w !sudo tee % >/dev/null<CR>
let mapleader = "\<Space>"
ino jj <Esc>
cno jj <Esc>
vno v <esc>
set nobackup
set nowritebackup
set noswapfile
syntax on
set number " Show line numbers and length
set mouse=a " Enable mouse
set mousehide
" Tab Control (others)
nnoremap <c-h> :tabprev<CR>
nnoremap <c-l> :tabnext<CR>
nnoremap <Leader>w :w<CR>
nnoremap <Leader>q :q<CR>
nnoremap <Leader>z :z<CR>
nnoremap <Leader>t :tabe<CR>
cab W! w!
cab Q! q!
cab Wq wq
cab Wa wa
cab wQ wq
cab WQ wq
cab W w
cab Q q
EOL
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment