Skip to content

Instantly share code, notes, and snippets.

@FooBarrior
Created July 2, 2012 04:49
Show Gist options
  • Save FooBarrior/3031157 to your computer and use it in GitHub Desktop.
Save FooBarrior/3031157 to your computer and use it in GitHub Desktop.
.vimrc and .bashrc
# Check for an interactive session
[ -z "$PS1" ] && return
stty stop undef
alias ls='ls --color=auto'
alias l='ls'
alias ll='ls -lh'
alias la='ls -a'
alias lla='ls -la'
alias gg='git gui'
#pacman/yaourt
alias ys='yaourt -Ss'
alias yS='yaourt -S'
alias yg='yaourt-gui'
#other usefuls
alias ..='cd ..'
. ~/.config/bash/ps.bash
. ~/.config/bash/greetings.bash
. ~/.config/bash/completion.bash
set_imcs_proxy(){
export http_proxy=http://10.0.100.3:3128/
export ftp_proxy=http://10.0.100.3:3128/
export https_proxy=http://10.0.100.3:3128/
}
reload_nvidia(){
pacman -S nvidia --noconfirm
rc.d restart gdm
}
export LESSOPEN="| /usr/bin/src-hilite-lesspipe.sh %s"
export LESS=' -R '
export PYTHONDOCS=/usr/share/doc/python/html/
pptp_beeline_up(){
pptpsetup --create beeline --server vpn.internet.beeline.ru --username $BEELINE_USERNAME --password $BEELINE_PASSWORD --start
route add -net 0.0.0.0 dev ppp0
}
export PYTHONDOCS=/usr/share/doc/python/html/
syntax on
filetype on
filetype plugin indent on
"
"NERDTree config
"
let NERDTreeWinSize=25
function! EnterNT()
NERDTree
wincmd p
endfunction
au VimEnter * call EnterNT()
au TabEnter * NERDTreeMirror
autocmd WinEnter * call s:CloseIfOnlyNerdTreeLeft()
" Close all open buffers on entering a window if the only
" buffer that's left is the NERDTree buffer
function! s:CloseIfOnlyNerdTreeLeft()
if exists("t:NERDTreeBufName")
if bufwinnr(t:NERDTreeBufName) != -1
if winnr("$") == 1
q
endif
endif
endif
endfunction
"
"end NERDTree
"
"set t_Co=256
colo darkblue
set number
set shiftwidth=4
set tabstop=4
set expandtab
set autoindent smartindent cindent
set ignorecase "Ignore case when searching
set smartcase
set hlsearch "Highlight search things
set incsearch "Make search act like search in modern browsers
set nolazyredraw "Don't redraw while executing macros
imap <C-S> <C-O>:w<CR>
au FileType c,cpp,java,javascript,perl imap <C-B> <End>;<Cr>
"au FileType c,cpp,java,javascript,perl imap <S-C-b> <End>; WHYYYYYY!!!
"au FileType cpp syntax off ololo?????
if !filereadable('Makefile')
au FileType c set makeprg=gcc\ -std=gnu99\ -g3\ %
au FileType cpp set makeprg=g++\ -g3\ %
au FileType asm set makeprg=gcc\ -g\ %
au FileType c,cpp,asm map <F7> :! nemiver ./a.out
au FileType c,cpp,asm map <F8> :w<cr>:make<cr>:! nemiver ./a.out<cr>
endif
map <F6> :w<cr>:make<cr>
imap <F6> <C-O>:w<cr><C-O>:make<cr>
map <F4> :cn<cr>
map <F3> :cp<cr>
"in stack with autoclose
"imap {<CR> {<CR><Esc>O
" completions
set completeopt+=longest
inoremap <expr> <C-n> pumvisible() ? '<C-n>' :
\ '<C-n><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
inoremap <expr> <M-,> pumvisible() ? '<C-n>' :
\ '<C-x><C-o><C-n><C-p><C-r>=pumvisible() ? "\<lt>Down>" : ""<CR>'
au filetype c,cpp,javascript,python imap . .<c-x><c-o>
if [ "$(($RANDOM % 2))" = 1 ]; then
echo ' ( )
~(^^^^)~
) @@ \~_ |\ Hey
/ | \ \~ /
( 0 0 ) \ | | Hiya
---___/~ \ | | Doin?
/'\''__/ | ~-_____/ |
o _ ~----~ ___---~ Oops!
O // | | I mean MOOOOOOO
((~\ _| -|
o O //-_ \/ | ~ |
^ \_ / ~ |
| ~ |
| / ~ |
| ( |
\ \ /\
/ -_____-\ \ ~~-*
| / \ \ .==.
/ / / / | |
/~ | //~ | |__|
'; else
echo '
. --- .
/ \
| O _ O |
| ./ \. |
/ `-._.-'\'' \
.'\'' / \ `.
.-~.-~/ \~-.~-.
.-~ ~ | | ~ ~-.
`- . | | . -'\''
~ - | | - ~
\ /
___\ /___
~;_ >- . . -< _i~
`'\'' `'\'; fi
ps_closure(){
[[ `/usr/bin/whoami` = "root" ]] && local userchar='#' || local userchar='$'
ps_simple(){ PS1='[\u@\h \W]'"$userchar "; }
ps_small(){ PS1='\[\e[37;42;1m\]\u@\h\[\e[0m\]\[\e[30;1m\]\[\e[32;1m\]\w'$userchar'\[\e[0m\]'; }
ps_verbose(){ PS1='\[\e[37;42;1m\]\u@\h\[\e[0m\]\[\e[30;1m\]$(date +%I:%M:%S)\[\e[32;1m\]\w/\[\e[0m\]\n'; }
ps_verbose_date(){ PS1='\[\e[37;42;1m\]\u@\h\[\e[0m\]\[\e[30;1m\] \d $(date +%H:%M:%S %P)\[\e[32;1m\]\w/\[\e[0m\]\n'; }
#set small prompt string by default
ps_small
}
#call ps_closure, expanding cosed functions
ps_closure
ps_verbose_extra(){
PS1='[\u@\h \W]\$ '
local NONE="\[\033[0m\]" # unsets color to term's fg color
# regular colors
local K="\[\033[0;30m\]" # black
local R="\[\033[0;31m\]" # red
local G="\[\033[0;32m\]" # green
local Y="\[\033[0;33m\]" # yellow
local B="\[\033[0;34m\]" # blue
local M="\[\033[0;35m\]" # magenta
local C="\[\033[0;36m\]" # cyan
local W="\[\033[0;37m\]" # white
# emphasized (bolded) colors
local EMK="\[\033[1;30m\]"
local EMR="\[\033[1;31m\]"
local EMG="\[\033[1;32m\]"
local EMY="\[\033[1;33m\]"
local EMB="\[\033[1;34m\]"
local EMM="\[\033[1;35m\]"
local EMC="\[\033[1;36m\]"
local EMW="\[\033[1;37m\]"
# background colors
local BGK="\[\033[40m\]"
local BGR="\[\033[41m\]"
local BGG="\[\033[42m\]"
local BGY="\[\033[43m\]"
local BGB="\[\033[44m\]"
local BGM="\[\033[45m\]"
local BGC="\[\033[46m\]"
local BGW="\[\033[47m\]"
case $TERM in
xterm*|rxvt*)
if [ `echo $SSH_CLIENT | wc -c` -gt 1 ]; then SSH_FLAG=1; fi
if [ `/usr/bin/whoami` = "root" ]; then ROOT_FLAG=1; fi
if ([ "$SSH_FLAG" = 1 ] && [ "$ROOT_FLAG" = 1 ]); then
local TITLEBAR='\[\033]0;[SSH] \u@\h\007\]'
PS1="$TITLEBAR${R}[!] ${G}\u${Y}@\h ${W}at ${C}\W ${W}>:/ "
elif [ "$SSH_FLAG" = 1 ]; then
local TITLEBAR='\[\033]0;[SSH] \u@\h\007\]'
PS1="$TITLEBAR${EMR}[SSH]${G}\u${Y}@\h ${W}at ${C}\W ${W}>:/ "
elif [ "$ROOT_FLAG" = 1 ]; then
local TITLEBAR='\[\033]0;\u@\h\007\]'
PS1="$TITLEBAR${R}[!] ${G}\u${Y}@\h ${W}at ${C}\W ${W}>:/ "
else
local TITLEBAR='\[\033]0;\u@\h\007\]'
PS1="$TITLEBAR${G}\u${Y}@\h ${W}at ${C}\W ${W}>:/ "
fi
;;
*)
if [ "$SSH_FLAG" = 1 ]; then
PS1="[SSH]$PS1"
fi
if [ `/usr/bin/whoami` = "root" ]; then ROOT_FLAG=1; fi
if [ "$ROOT_FLAG" = 1 ]; then
PS1="$TITLEBAR${R}[!] ${G}\u${Y}@\h ${W}at ${C}\W ${W}>:/ "
else
PS1="$TITLEBAR${G}\u${Y}@\h ${W}at ${C}\W ${W}>:/ "
fi
;;
esac
}
choose_termcap(){
case $1 in
1) export LESS_TERMCAP_mb=$'\033[01;36m' \
LESS_TERMCAP_md=$'\033[01;33m' \
LESS_TERMCAP_me=$'\033[0m' \
LESS_TERMCAP_mu=$'\033[01;37m' \
LESS_TERMCAP_se=$'\033[0m' \
LESS_TERMCAP_so=$'\033[01;47;30m'\
LESS_TERMCAP_ue=$'\033[0m' \
LESS_TERMCAP_us=$'\033[01;34m' \
;;
2)
export LESS_TERMCAP_mb=$'\033[01;31m'
export LESS_TERMCAP_md=$'\033[01;31m'
export LESS_TERMCAP_me=$'\033[0m'
export LESS_TERMCAP_se=$'\033[0m'
export LESS_TERMCAP_so=$'\033[01;44;33m'
export LESS_TERMCAP_ue=$'\033[0m'
export LESS_TERMCAP_us=$'\033[01;32m'
;;
3)
export LESS_TERMCAP_mb=$'\033[01;36m'
export LESS_TERMCAP_md=$'\033[01;32m'
export LESS_TERMCAP_me=$'\033[0m'
export LESS_TERMCAP_mu=$'\033[01;37m'
export LESS_TERMCAP_se=$'\033[0m'
export LESS_TERMCAP_so=$'\033[01;44;33m'
export LESS_TERMCAP_ue=$'\033[0m'
export LESS_TERMCAP_us=$'\033[01;36m'
;;
esac
}
#change to some other if needed=)
choose_termcap 1
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment