├── .bashrc ├── .local ├── lib │ └── node │ │ └── .gitkeep └── bin │ └── .personal-scripts-here ├── .profile ├── .vimrc ├── .config ├── bash │ ├── themes │ │ ├── current │ │ ├── minimal │ │ └── haskell │ ├── functions.d │ │ ├── system │ │ ├── misc │ │ ├── files │ │ └── tmux │ ├── profile │ ├── utils │ ├── completion │ ├── bashrc │ ├── exports │ ├── inputrc │ ├── aliases │ └── dircolors ├── mad │ └── config ├── mysql │ ├── config │ └── grcat ├── npm │ └── npmrc ├── gemrc │ └── config ├── git │ ├── ignore │ └── config ├── nvim │ ├── plugin │ │ ├── whitespace.vim │ │ └── sessions.vim │ ├── theme │ │ └── rafi-2017.vim │ ├── init.vim │ ├── config │ │ ├── filetype.vim │ │ ├── mappings.vim │ │ └── general.vim │ └── colors │ │ └── hybrid.vim ├── psql │ └── config ├── tmux │ └── config └── ranger │ └── rc.conf ├── .agignore └── README.md /.bashrc: -------------------------------------------------------------------------------- 1 | .config/bash/bashrc -------------------------------------------------------------------------------- /.local/lib/node/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.profile: -------------------------------------------------------------------------------- 1 | .config/bash/profile -------------------------------------------------------------------------------- /.vimrc: -------------------------------------------------------------------------------- 1 | .config/nvim/init.vim -------------------------------------------------------------------------------- /.local/bin/.personal-scripts-here: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.config/bash/themes/current: -------------------------------------------------------------------------------- 1 | haskell -------------------------------------------------------------------------------- /.config/mad/config: -------------------------------------------------------------------------------- 1 | heading: 1;33m 2 | code: 36m 3 | strong: 37m 4 | em: 1;34m 5 | -------------------------------------------------------------------------------- /.config/bash/functions.d/system: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | function psg() { 4 | ps auxww | grep -i --color=always $* | grep -v grep 5 | } 6 | -------------------------------------------------------------------------------- /.config/bash/functions.d/misc: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Spellcheck with aspell 4 | spell() { 5 | echo "$@" | aspell -a | egrep -v "^@|^$" 6 | } 7 | 8 | -------------------------------------------------------------------------------- /.config/mysql/config: -------------------------------------------------------------------------------- 1 | [mysql] 2 | default-character-set = utf8 3 | auto-rehash 4 | prompt = '[\u@\h:\d] (mysql) % ' 5 | safe-updates 6 | pager = grcat ~/.config/mysql/grcat | less -niSFXR 7 | sigint-ignore 8 | -------------------------------------------------------------------------------- /.config/npm/npmrc: -------------------------------------------------------------------------------- 1 | #email = 2 | prefix = ${HOME}/.local/lib/node 3 | cache = ${XDG_CACHE_HOME}/node/npm 4 | nodedir = ${XDG_CACHE_HOME}/node/gyp 5 | tmp = /tmp 6 | #registry = http://registry.npmjs.org/ 7 | -------------------------------------------------------------------------------- /.config/bash/functions.d/files: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Create and enter directory 4 | mk() { 5 | mkdir -p "$@" && cd "$1" 6 | } 7 | 8 | # Jump x directories up 9 | up() { 10 | local path i 11 | [ "$1" ] || set 1 12 | for ((i = 0; i < $1; i++)); do 13 | path="$path../" 14 | done 15 | cd "$path" 16 | } 17 | -------------------------------------------------------------------------------- /.config/gemrc/config: -------------------------------------------------------------------------------- 1 | --- 2 | # Disable explic user-install. We explicitly set the GEM_HOME enviroment 3 | # variable to the users gem path, so they will be installed there by default. If 4 | # we have user-install enabled it will install to ~/.gem which we may not want 5 | # 6 | # Disable installation of rdoc and ri data 7 | gem: --no-user-install --no-ri --no-rdoc 8 | -------------------------------------------------------------------------------- /.config/git/ignore: -------------------------------------------------------------------------------- 1 | # Compiled files 2 | *.sass-cache 3 | *.cache 4 | *.class 5 | *.o 6 | *.so 7 | *.pyc 8 | 9 | # Pacakges 10 | *.7z 11 | *.dmg 12 | *.gz 13 | *.iso 14 | *.jar 15 | *.rar 16 | *.tar 17 | *.zip 18 | 19 | # OS Generated files 20 | .DS_Store 21 | .DS_Store? 22 | ._* 23 | .Trashes 24 | 25 | # Other things 26 | .bundle 27 | .vagrant 28 | .idea 29 | tmp/ 30 | node_modules/ 31 | bower_components/ 32 | -------------------------------------------------------------------------------- /.agignore: -------------------------------------------------------------------------------- 1 | .android/ 2 | .atom/ 3 | .apm 4 | .cocoapods/ 5 | .git 6 | .gradle/ 7 | .idea 8 | .node-gyp/ 9 | /.local/ 10 | .stversions 11 | .tmp 12 | .DS_Store 13 | .DS_Store? 14 | .Genymobile 15 | .proselint 16 | .fingerprint/ 17 | compile-cache/ 18 | watch_later/ 19 | macports-ports/ 20 | *.sass-cache 21 | *.cache 22 | *.swp 23 | *.py[co] 24 | *.s?o 25 | /Applications/ 26 | /Library/ 27 | build/ 28 | bower_modules/ 29 | node_modules/ 30 | gems/ 31 | dist/ 32 | tmp/ 33 | -------------------------------------------------------------------------------- /.config/bash/profile: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | # .-. .-. .-. .-. .-. .-. 3 | # `._.' `._.' `._.' `._.' `._.' `._.' ` 4 | # 5 | # github.com/rafi/.config bash/profile 6 | 7 | source "$HOME/.config/bash/exports" 8 | source "$XDG_CONFIG_HOME/bash/bashrc" 9 | 10 | # If SSH session and not running tmux, list tmux sessions on log-in. 11 | if [ -n "$SSH_TTY" ] && [ -z "$TMUX" ] && hash tmux 2>/dev/null; then 12 | tmux list-sessions 2>/dev/null | sed 's/^/# tmux /' 13 | fi 14 | 15 | # vim: set ft=sh ts=2 sw=0 tw=80 noet : 16 | -------------------------------------------------------------------------------- /.config/bash/functions.d/tmux: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # tm - create new tmux session, or switch to existing one. Works from within tmux too. (@bag-man) 4 | # `tm` will allow you to select your tmux session via fzf. 5 | # `tm irc` will attach to the irc session (if it exists), else it will create it. 6 | 7 | tm() { 8 | [[ -n "$TMUX" ]] && change="switch-client" || change="attach-session" 9 | if [ $1 ]; then 10 | tmux $change -t "$1" 2>/dev/null || (tmux new-session -d -s $1 && tmux $change -t "$1"); return 11 | fi 12 | session=$(tmux list-sessions -F "#{session_name}" 2>/dev/null | fzf --exit-0) && tmux $change -t "$session" || echo "No sessions found." 13 | } 14 | -------------------------------------------------------------------------------- /.config/bash/themes/minimal: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Theme: Minimal 4 | # -------------- 5 | # [hostname:basename/] % █ 6 | # 7 | # Within Git repository: 8 | # [hostname:basename/] (branch) % █ 9 | # 10 | # Within SSH session: 11 | # [hostname:basename/] % █ 12 | # 13 | 14 | if [ -z "$SSH_CLIENT" ] && [ -z "$SSH_TTY" ]; then 15 | # Local connections 16 | PS1='\[\e[1;30m\][\[\e[0;38m\]\h\[\e[0;33m\]:\[\e[0;34m\]${PWD##*/}/\[\e[1;30m\]] $(__git_ps1 "(%s)\[\e[00m\] ")\[\e[0;32m\]%\[\e[00m\] ' 17 | else 18 | # Remote connections 19 | PS1='\[\e[1;30m\][\[\e[0;31m\]\h\[\e[0;33m\]:\[\e[0;34m\]${PWD##*/}/\[\e[1;30m\]] $(__git_ps1 "(%s)\[\e[00m\] ")\[\e[0;32m\]%\[\e[00m\] ' 20 | fi 21 | -------------------------------------------------------------------------------- /.config/mysql/grcat: -------------------------------------------------------------------------------- 1 | #row delimeter when using \G key 2 | regexp=[*]+.+[*]+ 3 | count=stop 4 | colours=white 5 | - 6 | #table borders 7 | regexp=[+\-]+[+\-]|[|] 8 | colours=red 9 | - 10 | #default word color 11 | regexp=[\w]+ 12 | colours=green 13 | - 14 | #data in ( ) and ' ' 15 | regexp=\([\w\d,']+\) 16 | colours=white 17 | - 18 | #numeric 19 | regexp=\s[\d\.]+\s 20 | colours=yellow 21 | - 22 | #column names when using \G key 23 | regexp=\w+: 24 | colours=white 25 | - 26 | #date 27 | regexp=\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2} 28 | colours=cyan 29 | - 30 | #IP 31 | regexp=(\d{1,3}\.){3}\d{1,3}(:\d{1,5})? 32 | colours=cyan 33 | - 34 | #schema 35 | regexp=`\w+` 36 | colours=yellow 37 | - 38 | #email 39 | regexp=[\w\.\-_]+@[\w\.\-_]+ 40 | colours=magenta 41 | -------------------------------------------------------------------------------- /.config/bash/utils: -------------------------------------------------------------------------------- 1 | # .-. .-. .-. .-. .-. .-. 2 | # `._.' `._.' `._.' `._.' `._.' `._.' ` 3 | # 4 | # github.com/rafi/.config bash/utils 5 | 6 | # Source all extra functions 7 | for func in "$XDG_CONFIG_HOME/bash/functions.d/"*; do 8 | . "$func" 9 | done 10 | unset func 11 | 12 | # Git prompt helpers 13 | GIT_PS1_SHOWDIRTYSTATE=1 14 | GIT_PS1_SHOWSTASHSTATE=1 15 | GIT_PS1_SHOWCOLORHINTS=0 16 | GIT_PS1_SHOWUNTRACKEDFILES=1 17 | GIT_PS1_SHOWUPSTREAM="auto" 18 | if [ -f "$PREFIX/share/git/git-prompt.sh" ]; then 19 | . "$PREFIX/share/git/git-prompt.sh" 20 | fi 21 | 22 | # https://github.com/rupa/z 23 | # Must be loaded _after_ setting PROMPT_COMMAND 24 | if [ -f "$PREFIX/etc/profile.d/z.sh" ]; then 25 | . "$PREFIX/etc/profile.d/z.sh" 26 | fi 27 | 28 | # vim: set ft=sh ts=2 sw=2 tw=80 noet : 29 | -------------------------------------------------------------------------------- /.config/bash/themes/haskell: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | # Theme: Haskell 4 | # -------------- 5 | # basename/ λ: ▏ 6 | # 7 | # Within Git repository: 8 | # basename/branch λ: ▏ 9 | # 10 | # Within SSH session: 11 | # hostname:basename/branch λ: ▏ 12 | # 13 | # Within virtualenv: 14 | # venv/basename/branch λ: ▏ 15 | 16 | function ps1_context { 17 | local virtualenv 18 | if [ -n "$VIRTUAL_ENV" ]; then 19 | virtualenv="$(basename "$VIRTUAL_ENV")" 20 | echo -n "${virtualenv:+${virtualenv}/}" 21 | fi 22 | } 23 | 24 | if [ -z "$SSH_CLIENT" ] && [ -z "$SSH_TTY" ]; then 25 | # Local connections 26 | PS1='\[\e[0;31m\]$(ps1_context)\[\e[0;34m\]${PWD##*/}/\[\e[1;90m\]$(__git_ps1 "%s") \[\e[0;32m\]λ\[\e[00m\]: ' 27 | else 28 | # Remote connections 29 | PS1='\[\e[0;31m\]$(ps1_context)\[\e[0;33m\]\h\[\e[1;90m\]:\[\e[0;34m\]${PWD##*/}/\[\e[1;90m\]$(__git_ps1 "%s") \[\e[0;32m\]λ\[\e[00m\]: ' 30 | fi 31 | -------------------------------------------------------------------------------- /.config/bash/completion: -------------------------------------------------------------------------------- 1 | # github.com/rafi/.config bash/completion 2 | 3 | # Ubuntu bash completions aren't loaded automatically. 4 | if [ -f /etc/lsb-release ]; then 5 | if [ -f /usr/share/bash-completion/bash_completion ]; then 6 | . /usr/share/bash-completion/bash_completion 7 | elif [ -f /etc/bash_completion ]; then 8 | . /etc/bash_completion 9 | fi 10 | fi 11 | 12 | # Load Git bash completion 13 | # https://github.com/git/git/blob/master/contrib/completion 14 | if [ -f "$PREFIX/share/bash-completion/completions/git" ]; then 15 | . "$PREFIX/share/bash-completion/completions/git" 16 | elif [ -f "$PREFIX/share/git/completion/git-completion.bash" ]; then 17 | . "$PREFIX/share/git/completion/git-completion.bash" 18 | elif [ -f "$PREFIX/share/git/contrib/completion/git-completion.bash" ]; then 19 | . "$PREFIX/share/git/contrib/completion/git-completion.bash" 20 | fi 21 | 22 | # vim: set ft=sh ts=2 sw=2 tw=80 noet : 23 | -------------------------------------------------------------------------------- /.config/nvim/plugin/whitespace.vim: -------------------------------------------------------------------------------- 1 | 2 | " Whitespace utilities 3 | " --- 4 | 5 | " Remove end of line white space 6 | command! -range=% WhitespaceErase call WhitespaceErase(,) 7 | 8 | " Whitespace events 9 | if v:version >= 702 10 | augroup WhitespaceMatch 11 | autocmd! 12 | autocmd InsertEnter * call ToggleWhitespace('i') 13 | autocmd InsertLeave * call ToggleWhitespace('n') 14 | augroup END 15 | endif 16 | 17 | function! s:ToggleWhitespace(mode) 18 | if &buftype =~? 'nofile\|help\|quickfix' || &filetype ==? '' 19 | return 20 | elseif a:mode ==? '' 21 | call matchdelete(w:whitespace_match_id) 22 | return 23 | else 24 | let l:pattern = (a:mode ==# 'i') ? '\s\+\%#\@session_complete SessionSave 9 | \ call s:session_save() 10 | 11 | " Load and persist session 12 | command! -nargs=? -complete=customlist,session_complete SessionLoad 13 | \ call s:session_load() 14 | 15 | " Save session on quit if one is loaded 16 | augroup sessionsave 17 | autocmd! 18 | " If session is loaded, write session file on quit 19 | autocmd VimLeavePre * 20 | \ if ! empty(v:this_session) && ! exists('g:SessionLoad') 21 | \ | execute 'mksession! '.fnameescape(v:this_session) 22 | \ | endif 23 | augroup END 24 | 25 | function! s:session_save(name) abort 26 | if ! isdirectory(g:session_directory) 27 | call mkdir(g:session_directory, 'p') 28 | endif 29 | let file_name = empty(a:name) ? badge#project() : a:name 30 | let file_path = g:session_directory.'/'.file_name.'.vim' 31 | execute 'mksession! '.fnameescape(file_path) 32 | let v:this_session = file_path 33 | 34 | echohl MoreMsg 35 | echo 'Session `'.file_name.'` is now persistent' 36 | echohl None 37 | endfunction 38 | 39 | function! s:session_load(name) abort 40 | let file_path = g:session_directory.'/'.a:name.'.vim' 41 | 42 | if ! empty(v:this_session) && ! exists('g:SessionLoad') 43 | \ | execute 'mksession! '.fnameescape(v:this_session) 44 | \ | endif 45 | 46 | noautocmd silent! %bwipeout! 47 | execute 'silent! source '.file_path 48 | endfunction 49 | 50 | function! s:session_complete(A, C, P) 51 | return map( 52 | \ split(glob(g:session_directory.'/*.vim'), '\n'), 53 | \ "fnamemodify(v:val, ':t:r')" 54 | \ ) 55 | endfunction 56 | 57 | " vim: set ts=2 sw=2 tw=80 noet : 58 | -------------------------------------------------------------------------------- /.config/bash/bashrc: -------------------------------------------------------------------------------- 1 | # .-. .-. .-. .-. .-. .-. 2 | # `._.' `._.' `._.' `._.' `._.' `._.' ` 3 | # 4 | # github.com/rafi ~/.bashrc config 5 | 6 | # If not running interactively, don't do anything 7 | [[ $- != *i* ]] && return 8 | 9 | # Remove the ^S ^Q mappings. See all mappings: stty -a 10 | stty stop undef 11 | stty start undef 12 | 13 | # Bash settings 14 | shopt -s cdspell # Autocorrects cd misspellings 15 | shopt -s checkwinsize # update the value of LINES and COLUMNS after each command if altered 16 | shopt -s cmdhist # Save multi-line commands in history as single line 17 | shopt -s dotglob # Include dotfiles in pathname expansion 18 | shopt -s expand_aliases # Expand aliases 19 | shopt -s extglob # Enable extended pattern-matching features 20 | shopt -s histreedit # Add failed commands to the bash history 21 | shopt -s histappend # Append each session's history to $HISTFILE 22 | shopt -s histverify # Edit a recalled history line before executing 23 | 24 | export HISTSIZE=2000 25 | export HISTFILESIZE=50000 26 | export HISTTIMEFORMAT='[%F %T] ' 27 | export HISTIGNORE='pwd:jobs:ll:ls:l:fg:history:clear:exit' 28 | export HISTCONTROL=ignoreboth 29 | export HISTFILE="$XDG_CACHE_HOME/bash_history" 30 | export VISUAL=nvim 31 | export EDITOR="$VISUAL" 32 | export PAGER=less 33 | 34 | # Source bash completions 35 | source "$XDG_CONFIG_HOME/bash/completion" 36 | 37 | # Source aliases 38 | source "$XDG_CONFIG_HOME/bash/aliases" 39 | 40 | # Append to history and set the window title to user@host:dir 41 | PROMPT_COMMAND='history -a; echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"' 42 | 43 | # Load CLI utilities 44 | source "$XDG_CONFIG_HOME/bash/utils" 45 | 46 | # Load symlinked command prompt theme 47 | source "$XDG_CONFIG_HOME/bash/themes/current" 48 | 49 | # Load directory and file colors for GNU ls 50 | eval "$(dircolors -b "$XDG_CONFIG_HOME/bash/dircolors")" 51 | 52 | # vim: set ft=sh ts=2 sw=2 tw=80 noet : 53 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Rafael Bodill's /etc/skel 2 | 3 | Minimal configuration for **remote servers**. 4 | 5 | Supported programs: 6 | 7 | * _**[ag]**_ - common ignore patterns 8 | * _**[bash], [npm], [gem]**_ - aliases, exports, completion, colors, inputrc, install paths 9 | * _**[git]**_ - aliases, advanced settings, common ignore patterns 10 | * _**[mysql], [psql]**_ - aliases, nicer prompt, comfort settings 11 | * _**[ranger]**_ - mostly default configuration 12 | * _**[tmux]**_ - advanced setup 13 | * _**[vim/neovim]**_ - advanced setup 14 | 15 | ## Origins 16 | 17 | These configurations were extracted from [rafi/.config] and [rafi/vim-config]. 18 | Visit these repositories for the original full configuration. 19 | 20 | ## Install 21 | 22 | You will need to extract contents of repository into your `~/` directory, 23 | and/or the `/etc/skel` directory which contains files and directories that 24 | are automatically copied over to a new user's home directory when such user 25 | is created by the `useradd` program. 26 | 27 | ### Local Install 28 | 29 | :warning: This will overwrite existing files. 30 | 31 | Follow these instructions if you want to install on a local machine. 32 | 33 | Specific user: 34 | 35 | ```sh 36 | cd ~ 37 | curl -L https://github.com/rafi/etc-skel/archive/master.tar.gz \ 38 | | tar xzv --strip-components=1 --exclude README.md 39 | ``` 40 | 41 | Copy to `/etc/skel`: 42 | 43 | ```sh 44 | curl -L https://github.com/rafi/etc-skel/archive/master.tar.gz \ 45 | | tar xzv -C /etc/skel --strip-components=1 --exclude README.md 46 | ``` 47 | 48 | ### Remote Install 49 | 50 | :warning: This will overwrite existing files. 51 | 52 | Follow these instructions if you want to install onto a remote server: 53 | 54 | ```sh 55 | git clone git://github.com/rafi/etc-skel.git 56 | cd etc-skel 57 | rsync -cavh --exclude=.git . user@server:./ 58 | ``` 59 | 60 | [rafi/.config]: https://github.com/rafi/.config 61 | [rafi/vim-config]: https://github.com/rafi/vim-config 62 | [ag]: ./.agignore 63 | [bash]: ./.config/bash 64 | [npm]: ./.config/npm 65 | [gem]: ./.config/gemrc 66 | [git]: ./.config/git 67 | [mysql]: ./.config/mysql 68 | [psql]: ./.config/psql 69 | [vim/neovim]: ./.config/nvim 70 | [ranger]: ./.config/ranger 71 | [tmux]: ./.config/tmux 72 | -------------------------------------------------------------------------------- /.config/bash/exports: -------------------------------------------------------------------------------- 1 | # .-. .-. .-. .-. .-. .-. 2 | # `._.' `._.' `._.' `._.' `._.' `._.' ` 3 | # 4 | # github.com/rafi/.config bash/exports 5 | 6 | # XDG directories 7 | export XDG_CONFIG_HOME="$HOME/.config" 8 | export XDG_CACHE_HOME="$HOME/.cache" 9 | export XDG_DATA_HOME="$HOME/.local/share" 10 | 11 | export PREFIX=/usr 12 | export XAUTHORITY="$XDG_CACHE_HOME/Xauthority" 13 | export XINITRC="$XDG_CONFIG_HOME"/xorg/xinitrc 14 | 15 | # Python per user site-packages directory 16 | export PATH="$PATH:$HOME/.local/lib/python3.5/bin" 17 | export PATH="$PATH:$HOME/.local/lib/python2.7/bin" 18 | 19 | # Local bin 20 | export PATH="$HOME/.local/bin:$PATH:bin" 21 | 22 | # Look for terminfo files under data 23 | if [ -d "$XDG_DATA_HOME/terminfo" ]; then 24 | export TERMINFO="$XDG_DATA_HOME/terminfo" 25 | export TERMINFO_DIRS="$XDG_DATA_HOME/terminfo:$PREFIX/share/terminfo" 26 | fi 27 | 28 | export INPUTRC="$XDG_CONFIG_HOME/bash/inputrc" 29 | export _Z_DATA="$XDG_CACHE_HOME/z/data" 30 | export MYSQL_HISTFILE="$XDG_CACHE_HOME/mysql_history" 31 | export LESSHISTFILE="$XDG_CACHE_HOME/less_history" 32 | export LESSKEY="$XDG_CONFIG_HOME/lesskey/output" 33 | 34 | hash http 2>/dev/null && export HTTPIE_CONFIG_DIR="$XDG_CONFIG_HOME/httpie" 35 | hash wget 2>/dev/null && export WGETRC="$XDG_CONFIG_HOME/wget/config" 36 | 37 | # Load only ranger's user config 38 | export RANGER_LOAD_DEFAULT_RC=FALSE 39 | 40 | # IPython profile directory 41 | export IPYTHONDIR="$XDG_CONFIG_HOME"/ipython 42 | 43 | export PSQLRC="$XDG_CONFIG_HOME/psql/config" 44 | export PGCLIRC="$XDG_CONFIG_HOME/pgcli/config" 45 | 46 | # GO configuration 47 | if hash go 2>/dev/null 48 | then 49 | export GOPATH="$HOME/code/go" 50 | export PATH="$PATH:$GOPATH/bin" 51 | fi 52 | 53 | # Node NPM tool configuration 54 | if hash npm 2>/dev/null 55 | then 56 | export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME/npm/npmrc" 57 | export PATH="$PATH:$HOME/.local/lib/node/bin" 58 | fi 59 | 60 | # Ack configuration 61 | if hash ack 2> /dev/null 62 | then 63 | export ACKRC="$XDG_CONFIG_HOME/ack/ackrc" 64 | export ACK_PAGER_COLOR="less -x4SRFX" 65 | fi 66 | 67 | # Settings 68 | hash nvim 2>/dev/null && export MANPAGER="nvim -c 'set ft=man' -" 69 | export LESS="-FiQMXR" 70 | export LESSCHARSET="UTF-8" 71 | export GREP_OPTIONS="--color=auto --exclude-dir=.git" 72 | 73 | if hash fzf 2>/dev/null 74 | then 75 | export FZF_DEFAULT_OPTS="--bind=ctrl-d:page-down,ctrl-u:page-up,y:yank --inline-info --reverse --height 50% --multi --preview 'highlight -O ansi -l {} 2> /dev/null || cat {}'" 76 | export FZF_DEFAULT_COMMAND='ag -U --hidden --follow --nogroup --nocolor -g ""' 77 | fi 78 | # vim: set ft=sh ts=2 sw=2 tw=80 noet : 79 | -------------------------------------------------------------------------------- /.config/bash/inputrc: -------------------------------------------------------------------------------- 1 | # .-. .-. .-. .-. .-. .-. 2 | # `._.' `._.' `._.' `._.' `._.' `._.' ` 3 | # 4 | # github.com/rafi/.config bash/inputrc 5 | 6 | $include /etc/inputrc 7 | 8 | # Uncomment to enable vi-mode! 9 | #set editing-mode vi 10 | 11 | # Ring the bell, let other programs handle it (urxvt, tmux, etc.) 12 | set bell-style audible 13 | 14 | # Ignore case when matching and completing paths 15 | set completion-ignore-case On 16 | 17 | # Treat underscores and hyphens the same way for completion purposes 18 | set completion-map-case On 19 | 20 | # Show me up to 5,000 completion items, don't be shy 21 | set completion-query-items 5000 22 | 23 | # Don't display control characters like ^C if I input them 24 | set echo-control-characters Off 25 | 26 | # Expand tilde to full path on completion 27 | set expand-tilde On 28 | 29 | # Preserve caret position while browsing through history lines 30 | set history-preserve-point On 31 | 32 | # When completing directories, add a trailing slash 33 | set mark-directories On 34 | 35 | # Do the same for symlinked directories 36 | set mark-symlinked-directories On 37 | 38 | # on menu-complete, first display the common prefix, then cycle through the 39 | # options when hitting TAB 40 | set menu-complete-display-prefix On 41 | 42 | # Don't paginate possible completions 43 | set page-completions Off 44 | 45 | # Show multiple completions on first tab press 46 | set show-all-if-ambiguous On 47 | 48 | # Don't re-complete already completed text in the middle of a word 49 | set skip-completed-text On 50 | 51 | # Show extra file information when completing, like `ls -F` does 52 | set visible-stats on 53 | 54 | $if mode=vi 55 | # Insert mode settings 56 | set keymap vi-insert 57 | 58 | "\C-p": history-search-backward 59 | "\C-n": history-search-forward 60 | "\C-l": clear-screen 61 | 62 | # Shortcut for inserting a grep pipeline at eol 63 | "\C-g": "\e$a | grep " 64 | 65 | # Ctrl+left/right for word movement 66 | "\e\e[C": forward-word 67 | "\e\e[D": backward-word 68 | "\e[1;5C": forward-word 69 | "\e[1;5D": backward-word 70 | 71 | # Disable left and right cursor movement 72 | "\e[C": redraw-current-line 73 | "\e[D": redraw-current-line 74 | 75 | # Command mode settings 76 | set keymap vi-command 77 | 78 | "gg": beginning-of-history 79 | "G": end-of-history 80 | 81 | # Shortcut for inserting a grep pipeline at eol 82 | "\C-g": "$a | grep " 83 | 84 | # Ctrl+left/right for word movement 85 | "\e\e[C": forward-word 86 | "\e\e[D": backward-word 87 | "\e[1;5C": forward-word 88 | "\e[1;5D": backward-word 89 | 90 | # Disable left and right cursor movement 91 | "\e[C": redraw-current-line 92 | "\e[D": redraw-current-line 93 | $endif 94 | 95 | # vim: set ft=readline ts=2 sw=2 tw=80 noet : 96 | -------------------------------------------------------------------------------- /.config/nvim/init.vim: -------------------------------------------------------------------------------- 1 | " .-. .-. .-. .-. .-. .-. .-. 2 | " `._.' `._.' `._.' `._.' `._.' `._.' `._.' 3 | " 4 | " https://github.com/rafi/vim-config 5 | 6 | if &compatible 7 | set nocompatible 8 | endif 9 | 10 | " Set main configuration directory, and where cache is stored. 11 | let $VIMPATH = fnamemodify(resolve(expand(':p')), ':h') 12 | let $VARPATH = expand(($XDG_CACHE_HOME ? $XDG_CACHE_HOME : '~/.cache').'/vim') 13 | 14 | " Search and use environments specifically made for Neovim. 15 | if isdirectory($VARPATH.'/venv/neovim2') 16 | let g:python_host_prog = $VARPATH.'/venv/neovim2/bin/python' 17 | endif 18 | if isdirectory($VARPATH.'/venv/neovim3') 19 | let g:python3_host_prog = $VARPATH.'/venv/neovim3/bin/python' 20 | endif 21 | 22 | function! s:source_file(path, ...) abort 23 | let use_global = get(a:000, 0, ! has('vim_starting')) 24 | let abspath = resolve(expand($VIMPATH.'/config/'.a:path)) 25 | if ! use_global 26 | execute 'source' fnameescape(abspath) 27 | return 28 | endif 29 | 30 | let content = map(readfile(abspath), 31 | \ "substitute(v:val, '^\\W*\\zsset\\ze\\W', 'setglobal', '')") 32 | let tempfile = tempname() 33 | try 34 | call writefile(content, tempfile) 35 | execute printf('source %s', fnameescape(tempfile)) 36 | finally 37 | if filereadable(tempfile) 38 | call delete(tempfile) 39 | endif 40 | endtry 41 | endfunction 42 | 43 | " Set augroup 44 | augroup MyAutoCmd 45 | autocmd! 46 | autocmd CursorHold *? syntax sync minlines=300 47 | augroup END 48 | 49 | " Global Mappings "{{{ 50 | " Use spacebar as leader and ; as secondary-leader 51 | " Required before loading plugins! 52 | let g:mapleader="\" 53 | let g:maplocalleader=';' 54 | 55 | " Release keymappings prefixes, evict entirely for use of plug-ins. 56 | nnoremap 57 | xnoremap 58 | nnoremap , 59 | xnoremap , 60 | nnoremap ; 61 | xnoremap ; 62 | nnoremap m 63 | xnoremap m 64 | 65 | " }}} 66 | " Ensure cache directory "{{{ 67 | if ! isdirectory(expand($VARPATH)) 68 | " Create missing dirs i.e. cache/{undo,backup} 69 | call mkdir(expand('$VARPATH/undo'), 'p') 70 | call mkdir(expand('$VARPATH/backup')) 71 | endif 72 | 73 | " Disable pre-bundled plugins 74 | let g:loaded_getscript = 1 75 | let g:loaded_getscriptPlugin = 1 76 | let g:loaded_gzip = 1 77 | let g:loaded_logiPat = 1 78 | let g:loaded_matchit = 1 79 | let g:loaded_matchparen = 1 80 | let g:loaded_rrhelper = 1 81 | let g:loaded_ruby_provider = 1 82 | let g:loaded_shada_plugin = 1 83 | let g:loaded_spellfile_plugin = 1 84 | let g:loaded_tar = 1 85 | let g:loaded_tarPlugin = 1 86 | let g:loaded_tutor_mode_plugin = 1 87 | let g:loaded_2html_plugin = 1 88 | let g:loaded_vimball = 1 89 | let g:loaded_vimballPlugin = 1 90 | let g:loaded_zip = 1 91 | let g:loaded_zipPlugin = 1 92 | 93 | if has('nvim') 94 | " Write history on idle, for sharing among different sessions 95 | autocmd MyAutoCmd CursorHold * if exists(':rshada') | rshada | wshada | endif 96 | endif 97 | 98 | filetype plugin indent on 99 | syntax enable 100 | 101 | " Loading configuration modules 102 | call s:source_file('general.vim') 103 | call s:source_file('filetype.vim') 104 | call s:source_file('mappings.vim') 105 | " }}} 106 | 107 | " Theme 108 | " ----- 109 | 110 | " Enable 256 color terminal 111 | set t_Co=256 112 | 113 | " Enable true color 114 | if has('termguicolors') 115 | set termguicolors 116 | endif 117 | 118 | function! s:theme_reload(name) 119 | let theme_path = $VIMPATH.'/theme/'.a:name.'.vim' 120 | if filereadable(theme_path) 121 | execute 'source' fnameescape(theme_path) 122 | endif 123 | endfunction 124 | 125 | " THEME NAME 126 | let g:theme_name = 'rafi-2017' 127 | autocmd MyAutoCmd ColorScheme * call s:theme_reload(g:theme_name) 128 | 129 | set background=dark 130 | colorscheme hybrid 131 | 132 | set secure 133 | 134 | " vim: set ts=2 sw=2 tw=80 noet : 135 | -------------------------------------------------------------------------------- /.config/nvim/config/filetype.vim: -------------------------------------------------------------------------------- 1 | 2 | " File Types 3 | "------------------------------------------------- 4 | 5 | augroup MyAutoCmd " {{{ 6 | 7 | " Highlight current line only on focused window 8 | autocmd WinEnter,InsertLeave * set cursorline 9 | autocmd WinLeave,InsertEnter * set nocursorline 10 | 11 | " Automatically set read-only for files being edited elsewhere 12 | autocmd SwapExists * nested let v:swapchoice = 'o' 13 | 14 | " Check if file changed when its window is focus, more eager than 'autoread' 15 | autocmd WinEnter,FocusGained * checktime 16 | 17 | autocmd Syntax * if 5000 < line('$') | syntax sync minlines=200 | endif 18 | 19 | " Update filetype on save if empty 20 | autocmd BufWritePost * nested 21 | \ if &l:filetype ==# '' || exists('b:ftdetect') 22 | \ | unlet! b:ftdetect 23 | \ | filetype detect 24 | \ | endif 25 | 26 | " When editing a file, always jump to the last known cursor position. 27 | " Don't do it when the position is invalid or when inside an event handler 28 | autocmd BufReadPost * 29 | \ if &ft !~ '^git\c' && ! &diff && line("'\"") > 0 && line("'\"") <= line("$") 30 | \| execute 'normal! g`"zvzz' 31 | \| endif 32 | 33 | " Disable paste and/or update diff when leaving insert mode 34 | autocmd InsertLeave * 35 | \ if &paste | setlocal nopaste mouse=a | echo 'nopaste' | endif | 36 | \ if &l:diff | diffupdate | endif 37 | 38 | autocmd FileType help 39 | \ setlocal iskeyword+=: | setlocal iskeyword+=# | setlocal iskeyword+=- 40 | 41 | autocmd FileType crontab setlocal nobackup nowritebackup 42 | 43 | autocmd FileType yaml.docker-compose setlocal expandtab 44 | 45 | autocmd FileType gitcommit setlocal spell 46 | 47 | autocmd FileType gitcommit,qfreplace setlocal nofoldenable 48 | 49 | autocmd FileType zsh setlocal foldenable foldmethod=marker 50 | 51 | " Improved HTML include pattern 52 | autocmd FileType html 53 | \ setlocal includeexpr=substitute(v:fname, '^\\/', '', '') 54 | \ | setlocal path+=./;/ 55 | 56 | autocmd FileType markdown 57 | \ set expandtab 58 | \ | setlocal spell autoindent formatoptions=tcroqn2 comments=n:> 59 | 60 | autocmd FileType apache setlocal path+=./;/ 61 | 62 | " Open Quickfix window automatically 63 | autocmd QuickFixCmdPost [^l]* leftabove copen 64 | \ | wincmd p | redraw! 65 | autocmd QuickFixCmdPost l* leftabove lopen 66 | \ | wincmd p | redraw! 67 | 68 | " Fix window position of help/quickfix 69 | autocmd FileType help if &l:buftype ==# 'help' 70 | \ | wincmd L | endif 71 | autocmd FileType qf if &l:buftype ==# 'quickfix' 72 | \ | wincmd J | endif 73 | 74 | augroup END " }}} 75 | 76 | " Internal Plugin Settings {{{ 77 | " ------------------------ 78 | 79 | " PHP {{{ 80 | let g:PHP_removeCRwhenUnix = 0 81 | 82 | " }}} 83 | " Python {{{ 84 | let g:python_highlight_all = 1 85 | 86 | " }}} 87 | " Vim {{{ 88 | let g:vimsyntax_noerror = 1 89 | let g:vim_indent_cont = &shiftwidth 90 | 91 | " }}} 92 | " Bash {{{ 93 | let g:is_bash = 1 94 | 95 | " }}} 96 | " Java {{{ 97 | let g:java_highlight_functions = 'style' 98 | let g:java_highlight_all = 1 99 | let g:java_highlight_debug = 1 100 | let g:java_allow_cpp_keywords = 1 101 | let g:java_space_errors = 1 102 | let g:java_highlight_functions = 1 103 | 104 | " }}} 105 | " JavaScript {{{ 106 | let g:SimpleJsIndenter_BriefMode = 1 107 | let g:SimpleJsIndenter_CaseIndentLevel = -1 108 | 109 | " }}} 110 | " Markdown {{{ 111 | let g:markdown_fenced_languages = [ 112 | \ 'css', 113 | \ 'javascript', 114 | \ 'js=javascript', 115 | \ 'json=javascript', 116 | \ 'python', 117 | \ 'py=python', 118 | \ 'sh', 119 | \ 'sass', 120 | \ 'xml', 121 | \ 'vim' 122 | \] 123 | 124 | " }}} 125 | " Folding {{{ 126 | " augroup: a 127 | " function: f 128 | let g:vimsyn_folding = 'af' 129 | let g:tex_fold_enabled = 1 130 | let g:xml_syntax_folding = 1 131 | let g:php_folding = 2 132 | let g:php_phpdoc_folding = 1 133 | let g:perl_fold = 1 134 | " }}} 135 | " }}} 136 | 137 | " vim: set foldmethod=marker ts=2 sw=2 tw=80 noet : 138 | -------------------------------------------------------------------------------- /.config/bash/aliases: -------------------------------------------------------------------------------- 1 | # .-. .-. .-. .-. .-. .-. 2 | # `._.' `._.' `._.' `._.' `._.' `._.' ` 3 | # 4 | # github.com/rafi bash aliases 5 | 6 | # Carry over aliases to the root account when using sudo 7 | alias sudo='sudo ' 8 | 9 | # Listing directory contents 10 | alias ls='LC_COLLATE=C ls --color=auto --group-directories-first' 11 | alias l='ls -CFa' 12 | alias ll='ls -alF' 13 | alias lsd='ls -Gal | grep ^d' 14 | 15 | alias grep="grep $GREP_OPTIONS" 16 | unset GREP_OPTIONS 17 | 18 | # File and directory find, if fd is not installed 19 | if ! hash fd 2>/dev/null; then 20 | alias f='find . -iname ' 21 | alias ff='find . -type f -iname ' 22 | alias fd='find . -type d -iname ' 23 | fi 24 | 25 | # Head and tail will show as much possible without scrolling 26 | hash ghead 2>/dev/null && alias h='ghead -n $((${LINES:-12}-4))' 27 | hash gtail 2>/dev/null && alias t='gtail -n $((${LINES:-12}-4)) -s.1' 28 | 29 | # Git 30 | alias gb='git branch' 31 | alias gc='git checkout' 32 | alias gcb='git checkout -b' 33 | alias gd='git diff' 34 | alias gds='git diff --cached' 35 | alias gfl='git fetch --prune && git lg -15' 36 | alias gf='git fetch --prune' 37 | alias gfa='git fetch --all --tags --prune' 38 | alias gs='git status -sb' 39 | alias gl='git lg -15' 40 | alias gll='git lg' 41 | alias gld='git lgd -15' 42 | 43 | # Docker 44 | alias dk='docker-compose' 45 | alias dps='docker ps --format "table {{.Names}}\\t{{.Image}}\\t{{.Status}}\\t{{ .Ports }}\\t{{.RunningFor}}\\t{{.Command}}\\t{{ .ID }}" | cut -c-$(tput cols)' 46 | alias dls='docker ps -a --format "table {{.Names}}\\t{{.Image}}\\t{{.Status}}\\t{{ .Ports }}\\t{{.RunningFor}}\\t{{.Command}}\\t{{ .ID }}" | cut -c-$(tput cols)' 47 | alias dim='docker images --format "table {{.Repository}}\\t{{.Tag}}\\t{{.ID}}\\t{{.Size}}\\t{{.CreatedSince}}"' 48 | alias dgc='docker rmi $(docker images -qf "dangling=true")' 49 | alias dvc='docker volume ls -qf dangling=true | xargs docker volume rm' 50 | alias dtop='docker stats $(docker ps --format="{{.Names}}")' 51 | alias dnet='docker network ls && echo && docker inspect --format "{{\$e := . }}{{with .NetworkSettings}} {{\$e.Name}} 52 | {{range \$index, \$net := .Networks}} - {{\$index}} {{.IPAddress}} 53 | {{end}}{{end}}" $(docker ps -q)' 54 | alias dtag='docker inspect --format "{{.Name}} 55 | {{range \$index, \$label := .Config.Labels}} - {{\$index}}={{\$label}} 56 | {{end}}" $(docker ps -q)' 57 | 58 | # Kubernetes 59 | alias k='kubectl' 60 | 61 | # Shortcuts 62 | alias c='clear' 63 | alias diff='colordiff' 64 | 65 | # Storage 66 | alias dut="du -hsx * | sort -rh | head -10" 67 | alias dfu="df -hT -x devtmpfs -x tmpfs" 68 | 69 | # Processes 70 | alias process='ps -ax' 71 | alias psk='ps -ax | fzf | cut -d " " -f1 | xargs -o kill' 72 | alias pst='pstree -g 3 -ws' 73 | 74 | # XDG conformity 75 | alias tmux='tmux -f "$XDG_CONFIG_HOME/tmux/config"' 76 | alias mysql='mysql --defaults-extra-file="$XDG_CONFIG_HOME/mysql/config"' 77 | 78 | # Misc 79 | alias aspell="aspell -c -l en_US" 80 | alias mux="tmuxp load -y ." 81 | alias cal='cal | grep -C6 "$(date +%e)"' 82 | alias ccat='pygmentize -P tabsize=2 -O style=monokai -f console256 -g' 83 | alias yank='xsel -ib --logfile "$XDG_CACHE_HOME/xsel.log"' 84 | alias put='xsel -ob --logfile "$XDG_CACHE_HOME/xsel.log"' 85 | alias fontcache='fc-cache -f -v' 86 | alias freq='cut -f1 -d" " "$HISTFILE" | sort | uniq -c | sort -nr | head -n 30' 87 | alias sniff="sudo ngrep -d 'en1' -t '^(GET|POST) ' 'tcp and port 80'" 88 | alias ungzip='gzip -d' 89 | alias untar='tar xvf' 90 | 91 | alias ipinfo="curl -s ipinfo.io" 92 | 93 | # Neovim shortcuts 94 | if hash nvim 2>/dev/null; then 95 | alias vim=nvim 96 | alias vless="nvim -u $PREFIX/share/nvim/runtime/macros/less.vim" 97 | alias suvim='sudo -E nvim' 98 | alias oldvim="VIMINIT='let \$MYVIMRC=\"\$XDG_CONFIG_HOME/nvim/vimrc\" | source \$MYVIMRC' /usr/local/bin/vim" 99 | else 100 | alias vless="vim -u /usr/local/share/vim/vim74/macros/less.vim" 101 | alias suvim='sudo -E vim' 102 | fi 103 | alias v='vim $(fzf)' 104 | alias vi=vim 105 | alias vimdiff='vim -d' 106 | 107 | # A quick way to get out of current directory 108 | alias ..='cd ..' 109 | alias ...='cd ../../' 110 | alias ....='cd ../../../' 111 | alias .....='cd ../../../../' 112 | 113 | # vim: set ft=sh ts=2 sw=2 tw=80 noet : 114 | -------------------------------------------------------------------------------- /.config/psql/config: -------------------------------------------------------------------------------- 1 | ------------------------------------------------------------------------------ 2 | -- sources and inspiration: -- 3 | -- http://opensourcedbms.com/dbms/psqlrc-psql-startup-file-for-postgres/ -- 4 | -- http://www.craigkerstiens.com/2013/02/21/more-out-of-psql/ -- 5 | -- https://github.com/dlamotte/dotfiles/blob/master/psqlrc -- 6 | ------------------------------------------------------------------------------ 7 | 8 | \set QUIET ON 9 | 10 | \set PROMPT1 '%[%033[33;1m%]%x%[%033[0m%]%[%033[1m%]%/%[%033[0m%]%R%# ' 11 | -- alternate: 12 | -- \set PROMPT1 '(%n@%M:%>) [%/] > ' 13 | 14 | -- PROMPT2 is printed when the prompt expects more input, like when you type 15 | -- SELECT * FROM. %R shows what type of input it expects. 16 | \set PROMPT2 '[more] %R > ' 17 | 18 | -- Use best available output format 19 | \x auto 20 | 21 | \set VERBOSITY verbose 22 | \set HISTFILE ~/.cache/psql_history 23 | \set HISTCONTROL ignoredups 24 | \set PAGER always 25 | \set HISTSIZE 2000 26 | \set ECHO_HIDDEN OFF 27 | \set COMP_KEYWORD_CASE upper 28 | 29 | \timing 30 | \encoding unicode 31 | 32 | \pset null '¤' 33 | \pset linestyle unicode 34 | \pset border 2 35 | 36 | \pset format wrapped 37 | 38 | \set QUIET OFF 39 | 40 | \echo '\nCurrent Host Server Date Time : '`date` '\n' 41 | 42 | \echo 'Administrative queries:\n' 43 | \echo '\t\t\t:settings\t-- Server Settings' 44 | \echo '\t\t\t:conninfo\t-- Server connections' 45 | \echo '\t\t\t:activity\t-- Server activity' 46 | \echo '\t\t\t:locks\t\t-- Lock info' 47 | \echo '\t\t\t:waits\t\t-- Waiting queires' 48 | \echo '\t\t\t:dbsize\t\t-- Database Size' 49 | \echo '\t\t\t:tablesize\t-- Tables Size' 50 | \echo '\t\t\t:uselesscol\t-- Useless columns' 51 | \echo '\t\t\t:uptime\t\t-- Server uptime' 52 | \echo '\t\t\t:menu\t\t-- Help Menu' 53 | \echo '\t\t\t\\h\t\t-- Help with SQL commands' 54 | \echo '\t\t\t\\?\t\t-- Help with psql commands\n' 55 | 56 | \echo 'Development queries:\n' 57 | \echo '\t\t\t:sp\t\t-- Current Search Path' 58 | \echo '\t\t\t:clear\t\t-- Clear screen' 59 | \echo '\t\t\t:ll\t\t-- List\n' 60 | 61 | -- Administration queries 62 | 63 | \set menu '\\i ~/.psqlrc' 64 | 65 | \set settings 'SELECT name, setting,unit,context from pg_settings;' 66 | 67 | \set locks 'SELECT bl.pid AS blocked_pid, a.usename AS blocked_user, kl.pid AS blocking_pid, ka.usename AS blocking_user, a.query AS blocked_statement FROM pg_catalog.pg_locks bl JOIN pg_catalog.pg_stat_activity a ON bl.pid = a.pid JOIN pg_catalog.pg_locks kl JOIN pg_catalog.pg_stat_activity ka ON kl.pid = ka.pid ON bl.transactionid = kl.transactionid AND bl.pid != kl.pid WHERE NOT bl.granted;' 68 | 69 | \set conninfo 'SELECT usename, count(*) from pg_stat_activity group by usename;' 70 | 71 | \set activity 'SELECT datname, pid, usename, application_name,client_addr, client_hostname, client_port, query, state from pg_stat_activity;' 72 | 73 | \set waits 'SELECT pg_stat_activity.pid, pg_stat_activity.query, pg_stat_activity.waiting, now() - pg_stat_activity.query_start AS \"totaltime\", pg_stat_activity.backend_start FROM pg_stat_activity WHERE pg_stat_activity.query !~ \'%IDLE%\'::text AND pg_stat_activity.waiting = true;' 74 | 75 | \set dbsize 'SELECT datname, pg_size_pretty(pg_database_size(datname)) db_size FROM pg_database ORDER BY db_size;' 76 | 77 | \set tablesize 'SELECT nspname || \'.\' || relname AS \"relation\", pg_size_pretty(pg_relation_size(C.oid)) AS "size" FROM pg_class C LEFT JOIN pg_namespace N ON (N.oid = C.relnamespace) WHERE nspname NOT IN (\'pg_catalog\', \'information_schema\') ORDER BY pg_relation_size(C.oid) DESC LIMIT 40;' 78 | 79 | \set uselesscol 'SELECT nspname, relname, attname, typname, (stanullfrac*100)::int AS null_percent, case when stadistinct >= 0 then stadistinct else abs(stadistinct)*reltuples end AS \"distinct\", case 1 when stakind1 then stavalues1 when stakind2 then stavalues2 end AS \"values\" FROM pg_class c JOIN pg_namespace ns ON (ns.oid=relnamespace) JOIN pg_attribute ON (c.oid=attrelid) JOIN pg_type t ON (t.oid=atttypid) JOIN pg_statistic ON (c.oid=starelid AND staattnum=attnum) WHERE nspname NOT LIKE E\'pg\\\\_%\' AND nspname != \'information_schema\' AND relkind=\'r\' AND NOT attisdropped AND attstattarget != 0 AND reltuples >= 100 AND stadistinct BETWEEN 0 AND 1 ORDER BY nspname, relname, attname;' 80 | 81 | \set uptime 'SELECT now() - pg_postmaster_start_time() AS uptime;' 82 | 83 | -- Development queries: 84 | 85 | \set sp 'SHOW search_path;' 86 | \set clear '\\! clear;' 87 | \set ll '\\! ls -lrt;' 88 | 89 | -- vim: set ft=psql ts=2 sw=2 tw=80 et : 90 | -------------------------------------------------------------------------------- /.config/git/config: -------------------------------------------------------------------------------- 1 | # .-. .-. .-. .-. .-. .-. 2 | # `._.' `._.' `._.' `._.' `._.' `._.' ` 3 | # 4 | # Git config 5 | # https://github.com/rafi/.config 6 | 7 | [core] 8 | pager = /usr/bin/less -EFRSX 9 | excludesfile = ~/.config/git/ignore 10 | # Do NOT auto-convert CRLF line endings into LF 11 | autocrlf = false 12 | # Do NOT check if converting CRLF is reversible 13 | safecrlf = false 14 | # Whitespace detection 15 | whitespace = trailing-space,space-before-tab 16 | [credential] 17 | helper = cache --timeout=3600 18 | [pager] 19 | show-branch = true 20 | status = true 21 | [pretty] 22 | log = %C(240)%h%C(reset) -%C(auto)%d%Creset %s %C(242)(%an %ar) 23 | detailed = %C(cyan)%h %C(red)%ad %C(blue)[%an]%C(magenta)%d %C(white)%s 24 | shorter = %C(auto)%D %C(240)--%C(242)%gD%N %ad by %C(white)%cn%C(reset) 25 | multiline = %C(blue)──────%Creset%n %C(auto)commit %h %C(auto) %D%Creset%n %C(cyan)%an%Creset | %Cgreen%cr%Creset%n%+B 26 | [status] 27 | submodulesummary = true 28 | showUntrackedFiles = all 29 | [fetch] 30 | recurseSubmodules = true 31 | [push] 32 | # Defines the action git push should take if no refspec is explicitly given: 33 | # current = Push the current branch to update a branch with the same name on the receiving end 34 | default = current 35 | # https://git-scm.com/docs/git-config#git-config-pushfollowTags 36 | followTags = true 37 | [submodule] 38 | fetchJobs = 8 39 | [rerere] 40 | enabled = true 41 | [diff] 42 | tool = vimdiff 43 | algorithm = patience 44 | renames = copies 45 | mnemonicprefix = true 46 | compactionHeuristic = true 47 | [difftool "vimdiff"] 48 | cmd = nvim -d \"$LOCAL\" \"$REMOTE\" 49 | [merge] 50 | summary = true 51 | verbosity = 1 52 | stat = true 53 | [mergetool] 54 | prompt = false 55 | keepBackup = true 56 | writeToTemp = true 57 | [url "git@github.com:"] 58 | insteadOf = gh: 59 | [color] 60 | ui = true 61 | pager = true 62 | showbranch = true 63 | diff = auto 64 | status = auto 65 | branch = auto 66 | interactive = auto 67 | [color "branch"] 68 | plain = yellow 69 | current = magenta bold 70 | local = blue bold 71 | remote = white 72 | upstream = green bold 73 | [color "diff"] 74 | plain = normal 75 | old = red 76 | new = green 77 | commit = yellow 78 | meta = blue 79 | frag = cyan 80 | func = yellow bold 81 | whitespace = red reverse 82 | [color "diff-highlight"] 83 | oldNormal = red bold 84 | oldHighlight = red bold 52 85 | newNormal = green bold 86 | newHighlight = green bold 22 87 | [color "status"] 88 | header = 243 89 | added = green bold 90 | changed = red 91 | untracked = blue bold 92 | branch = green bold 93 | nobranch = red 94 | [url "git@github.com:"] 95 | insteadOf = gh: 96 | [alias] 97 | s = status -sb 98 | f = fetch --prune 99 | c = commit -v 100 | cm = commit -vm 101 | br = branch -v 102 | st = status 103 | ck = checkout 104 | t = tag --column 105 | tn = tag -n 106 | d = diff 107 | ds = diff --staged 108 | dw = diff --color-words 109 | dh = diff --color-words HEAD 110 | dp = !git log --pretty=oneline | fzf | cut -d ' ' -f1 | xargs -o git show 111 | patch = !git --no-pager diff --no-color 112 | prune = fetch --prune 113 | stash-all = stash save --include-untracked 114 | w = whatchanged --decorate 115 | wp = whatchanged --decorate -p 116 | #=============================================== 117 | sm = submodule 118 | smu = submodule foreach git pull origin master 119 | lcrev = log --reverse --no-merges --stat @{1}.. 120 | lcp = diff @{1}.. 121 | #=============================================== 122 | tree = log --graph --all --oneline --decorate 123 | lb = log --graph --simplify-by-decoration --pretty=shorter --all --notes --date-order --relative-date 124 | lg = log --graph --pretty=log --all 125 | lgd = log --graph --pretty=log 126 | lgw = !sh -c '"while true; do clear; git lg -15; sleep 5; done"' 127 | #=============================================== 128 | bf = !git diff --name-only "$(git base-branch)..@" 129 | post = !sh -c 'git format-patch --stdout $1 | ix' - 130 | sync-tags = fetch --prune origin '+refs/tags/*:refs/tags/*' 131 | recent-branches = !git for-each-ref --count=15 --sort=-committerdate refs/heads/ --format='%(refname:short)' 132 | ours = "!f() { git checkout --ours $@ && git add $@; }; f" 133 | theirs = "!f() { git checkout --theirs $@ && git add $@; }; f" 134 | #=============================================== 135 | # Take a snapshot of your current working tree without removing the changes from your tree. 136 | # via http://blog.apiaxle.com/post/handy-git-tips-to-stop-you-getting-fired/ 137 | snapshot = !git stash save "snapshot: $(date)" && git stash apply "stash@{0}" 138 | snapshots = !git stash list --grep snapshot 139 | -------------------------------------------------------------------------------- /.config/nvim/config/mappings.vim: -------------------------------------------------------------------------------- 1 | 2 | " Key-mappings 3 | "--------------------------------------------------------- 4 | 5 | " Non-standard {{{ 6 | " ------------ 7 | 8 | " Window-control prefix 9 | nnoremap [Window] 10 | nmap s [Window] 11 | 12 | " Fix keybind name for Ctrl+Spacebar 13 | map 14 | map! 15 | 16 | " Disable arrow movement, resize splits instead. 17 | if get(g:, 'elite_mode') 18 | nnoremap :resize +2 19 | nnoremap :resize -2 20 | nnoremap :vertical resize +2 21 | nnoremap :vertical resize -2 22 | endif 23 | 24 | " Double leader key for toggling visual-line mode 25 | nmap V 26 | vmap 27 | 28 | " Toggle fold 29 | nnoremap za 30 | 31 | " Focus the current fold by closing all others 32 | nnoremap zMza 33 | 34 | " Use backspace key for matchit.vim 35 | nmap % 36 | xmap % 37 | 38 | nmap w 39 | nmap W 40 | 41 | "}}} 42 | " Global niceties {{{ 43 | " --------------- 44 | 45 | " Start an external command with a single bang 46 | nnoremap ! :! 47 | 48 | " Allow misspellings 49 | cnoreabbrev qw wq 50 | cnoreabbrev Wq wq 51 | cnoreabbrev WQ wq 52 | cnoreabbrev Qa qa 53 | cnoreabbrev Bd bd 54 | cnoreabbrev bD bd 55 | 56 | " Start new line from any cursor position 57 | inoremap o 58 | 59 | " Quick substitute within selected area 60 | xnoremap s :s//g 61 | 62 | nnoremap zl z5l 63 | nnoremap zh z5h 64 | 65 | " Improve scroll, credits: https://github.com/Shougo 66 | nnoremap zz (winline() == (winheight(0)+1) / 2) ? 67 | \ 'zt' : (winline() == 1) ? 'zb' : 'zz' 68 | noremap max([winheight(0) - 2, 1]) 69 | \ ."\".(line('w$') >= line('$') ? "L" : "M") 70 | noremap max([winheight(0) - 2, 1]) 71 | \ ."\".(line('w0') <= 1 ? "H" : "M") 72 | noremap (line("w$") >= line('$') ? "j" : "3\") 73 | noremap (line("w0") <= 1 ? "k" : "3\") 74 | 75 | " Window control 76 | nnoremap 77 | nnoremap xw 78 | nnoremap z :vert resize:resize:normal! ze 79 | 80 | " Select blocks after indenting 81 | xnoremap < >gv| 83 | 84 | " Use tab for indenting in visual mode 85 | vnoremap >gv| 86 | vnoremap >>_ 88 | nnoremap < <<_ 89 | 90 | " Select last paste 91 | nnoremap gp '`['.strpart(getregtype(), 0, 1).'`]' 92 | 93 | " Navigation in command line 94 | cnoremap 95 | cnoremap 96 | cnoremap 97 | cnoremap 98 | cnoremap 99 | 100 | " Switch history search pairs, matching my bash shell 101 | cnoremap 102 | cnoremap 103 | cnoremap 104 | cnoremap 105 | 106 | " }}} 107 | " File operations {{{ 108 | " --------------- 109 | 110 | " When pressing cd switch to the directory of the open buffer 111 | map cd :lcd %:p:h:pwd 112 | 113 | " Fast saving 114 | nnoremap w :write 115 | vnoremap w :write 116 | nnoremap :write 117 | vnoremap :write 118 | cnoremap write 119 | 120 | " Save a file with sudo 121 | " http://forrst.com/posts/Use_w_to_sudo_write_a_file_with_Vim-uAN 122 | cmap W!! w !sudo tee % >/dev/null 123 | 124 | " }}} 125 | " Editor UI {{{ 126 | " --------- 127 | 128 | " I like to :quit with 'q', shrug. 129 | nnoremap q ::quit 130 | autocmd MyAutoCmd FileType man nnoremap q ::quit 131 | 132 | " Macros 133 | nnoremap Q q 134 | nnoremap gQ @q 135 | 136 | " Show highlight names under cursor 137 | nmap gh :echo 'hi<'.synIDattr(synID(line('.'), col('.'), 1), 'name') 138 | \.'> trans<'.synIDattr(synID(line('.'), col('.'), 0), 'name').'> lo<' 139 | \.synIDattr(synIDtrans(synID(line('.'), col('.'), 1)), 'name').'>' 140 | 141 | " Toggle editor visuals 142 | nmap ts :setlocal spell! 143 | nmap tn :setlocal nonumber! 144 | nmap tl :setlocal nolist! 145 | nmap th :nohlsearch 146 | nmap tw :setlocal wrap! breakindent! 147 | 148 | " Tabs 149 | nnoremap g0 :tabfirst 150 | nnoremap g$ :tablast 151 | nnoremap gr :tabprevious 152 | nnoremap :tabnext 153 | nnoremap :tabprevious 154 | nnoremap :tabnext 155 | nnoremap :tabprevious 156 | " Uses g:lasttab set on TabLeave in MyAutoCmd 157 | let g:lasttab = 1 158 | nmap \\ :execute 'tabn '.g:lasttab 159 | 160 | 161 | " }}} 162 | " Totally Custom {{{ 163 | " -------------- 164 | 165 | " Remove spaces at the end of lines 166 | nnoremap , :silent! keeppatterns %substitute/\s\+$//e 167 | 168 | " C-r: Easier search and replace 169 | xnoremap :call get_selection('/'):%s/\V=@///gc 170 | 171 | " Returns visually selected text 172 | function! s:get_selection(cmdtype) "{{{ 173 | let temp = @s 174 | normal! gv"sy 175 | let @/ = substitute(escape(@s, '\'.a:cmdtype), '\n', '\\n', 'g') 176 | let @s = temp 177 | endfunction "}}} 178 | 179 | " Location list movement 180 | nmap j :lnext 181 | nmap k :lprev 182 | 183 | " Duplicate lines 184 | nnoremap d m`YP`` 185 | vnoremap d YPgv 186 | 187 | " Source line and selection in vim 188 | vnoremap S y:execute @@:echo 'Sourced selection.' 189 | nnoremap S ^vg_y:execute @@:echo 'Sourced line.' 190 | 191 | " Yank buffer's absolute path to X11 clipboard 192 | nnoremap y :let @+=expand("%"):echo 'Relative path copied to clipboard.' 193 | nnoremap Y :let @+=expand("%:p"):echo 'Absolute path copied to clipboard.' 194 | 195 | " Drag current line/s vertically and auto-indent 196 | vnoremap mk :m-2gv=gv 197 | vnoremap mj :m'>+gv=gv 198 | noremap mk :m-2 199 | noremap mj :m+ 200 | 201 | " Session management shortcuts 202 | nmap se :execute 'SessionSave' fnamemodify(resolve(getcwd()), ':p:gs?/?_?') 203 | nmap os :execute 'source '.g:session_directory.'/'.fnamemodify(resolve(getcwd()), ':p:gs?/?_?').'.vim' 204 | 205 | " Display diff from last save {{{ 206 | command! DiffOrig vert new | setlocal bt=nofile | r # | 0d_ | diffthis | wincmd p | diffthis 207 | " }}} 208 | 209 | " Append modeline to EOF {{{ 210 | nnoremap ml :call append_modeline() 211 | 212 | " Append modeline after last line in buffer 213 | " See: http://vim.wikia.com/wiki/Modeline_magic 214 | function! s:append_modeline() "{{{ 215 | let l:modeline = printf(' vim: set ts=%d sw=%d tw=%d %set :', 216 | \ &tabstop, &shiftwidth, &textwidth, &expandtab ? '' : 'no') 217 | let l:modeline = substitute(&commentstring, '%s', l:modeline, '') 218 | call append(line('$'), l:modeline) 219 | endfunction "}}} 220 | " }}} 221 | 222 | " s: Windows and buffers {{{ 223 | 224 | nnoremap [Window]v :split 225 | nnoremap [Window]g :vsplit 226 | nnoremap [Window]t :tabnew 227 | nnoremap [Window]o :only 228 | nnoremap [Window]b :b# 229 | nnoremap [Window]c :close 230 | nnoremap [Window]x :call BufferEmpty() 231 | 232 | " Split current buffer, go to previous window and previous buffer 233 | nnoremap [Window]sv :split:wincmd p:e# 234 | nnoremap [Window]sg :vsplit:wincmd p:e# 235 | 236 | function! s:BufferEmpty() 237 | let l:current = bufnr('%') 238 | if ! getbufvar(l:current, '&modified') 239 | enew 240 | silent! execute 'bdelete '.l:current 241 | endif 242 | endfunction 243 | 244 | 245 | " vim: set ts=2 sw=2 tw=80 noet : 246 | -------------------------------------------------------------------------------- /.config/nvim/config/general.vim: -------------------------------------------------------------------------------- 1 | 2 | " General Settings 3 | "--------------------------------------------------------- 4 | " General {{{ 5 | set mouse=nv " Disable mouse in command-line mode 6 | set modeline " automatically setting options from modelines 7 | set report=0 " Don't report on line changes 8 | set errorbells " Trigger bell on error 9 | set visualbell " Use visual bell instead of beeping 10 | set hidden " hide buffers when abandoned instead of unload 11 | set fileformats=unix,dos,mac " Use Unix as the standard file type 12 | set magic " For regular expressions turn magic on 13 | set path=.,** " Directories to search when using gf 14 | set virtualedit=block " Position cursor anywhere in visual block 15 | set synmaxcol=1000 " Don't syntax highlight long lines 16 | set formatoptions+=1 " Don't break lines after a one-letter word 17 | set formatoptions-=t " Don't auto-wrap text 18 | if has('patch-7.3.541') 19 | set formatoptions+=j " Remove comment leader when joining lines 20 | endif 21 | 22 | if has('vim_starting') 23 | set encoding=utf-8 24 | scriptencoding utf-8 25 | endif 26 | 27 | " What to save for views: 28 | set viewoptions-=options 29 | set viewoptions+=slash,unix 30 | 31 | " What to save in sessions: 32 | set sessionoptions-=blank 33 | set sessionoptions-=options 34 | set sessionoptions-=globals 35 | set sessionoptions-=folds 36 | set sessionoptions-=help 37 | set sessionoptions-=buffers 38 | set sessionoptions+=tabpages 39 | 40 | if has('clipboard') 41 | set clipboard& clipboard+=unnamedplus 42 | endif 43 | 44 | " }}} 45 | " Wildmenu {{{ 46 | " -------- 47 | if has('wildmenu') 48 | set nowildmenu 49 | set wildmode=list:longest,full 50 | set wildoptions=tagfile 51 | set wildignorecase 52 | set wildignore+=.git,.hg,.svn,.stversions,*.pyc,*.spl,*.o,*.out,*~,%* 53 | set wildignore+=*.jpg,*.jpeg,*.png,*.gif,*.zip,**/tmp/**,*.DS_Store 54 | set wildignore+=**/node_modules/**,**/bower_modules/**,*/.sass-cache/* 55 | set wildignore+=application/vendor/**,**/vendor/ckeditor/**,media/vendor/** 56 | set wildignore+=__pycache__,*.egg-info 57 | endif 58 | 59 | " }}} 60 | " Vim Directories {{{ 61 | " --------------- 62 | set undofile swapfile nobackup 63 | set directory=$VARPATH/swap//,$VARPATH,~/tmp,/var/tmp,/tmp 64 | set undodir=$VARPATH/undo//,$VARPATH,~/tmp,/var/tmp,/tmp 65 | set backupdir=$VARPATH/backup/,$VARPATH,~/tmp,/var/tmp,/tmp 66 | set viewdir=$VARPATH/view/ 67 | set nospell spellfile=$VIMPATH/spell/en.utf-8.add 68 | 69 | " History saving 70 | set history=2000 71 | if has('nvim') 72 | " ShaDa/viminfo: 73 | " ' - Maximum number of previously edited files marks 74 | " < - Maximum number of lines saved for each register 75 | " @ - Maximum number of items in the input-line history to be 76 | " s - Maximum size of an item contents in KiB 77 | " h - Disable the effect of 'hlsearch' when loading the shada 78 | set shada='300,<50,@100,s10,h 79 | else 80 | set viminfo='300,<10,@50,h,n$VARPATH/viminfo 81 | endif 82 | 83 | " }}} 84 | " Tabs and Indents {{{ 85 | " ---------------- 86 | set textwidth=80 " Text width maximum chars before wrapping 87 | set noexpandtab " Don't expand tabs to spaces. 88 | set tabstop=2 " The number of spaces a tab is 89 | set softtabstop=2 " While performing editing operations 90 | set shiftwidth=2 " Number of spaces to use in auto(indent) 91 | set smarttab " Tab insert blanks according to 'shiftwidth' 92 | set autoindent " Use same indenting on new lines 93 | set smartindent " Smart autoindenting on new lines 94 | set shiftround " Round indent to multiple of 'shiftwidth' 95 | 96 | " }}} 97 | " Timing {{{ 98 | " ------ 99 | set timeout ttimeout 100 | set timeoutlen=750 " Time out on mappings 101 | set updatetime=1000 " Idle time to write swap and trigger CursorHold 102 | 103 | " Time out on key codes 104 | set ttimeoutlen=10 105 | 106 | " }}} 107 | " Searching {{{ 108 | " --------- 109 | set ignorecase " Search ignoring case 110 | set smartcase " Keep case when searching with * 111 | set infercase " Adjust case in insert completion mode 112 | set incsearch " Incremental search 113 | set hlsearch " Highlight search results 114 | set wrapscan " Searches wrap around the end of the file 115 | set showmatch " Jump to matching bracket 116 | set matchpairs+=<:> " Add HTML brackets to pair matching 117 | set matchtime=1 " Tenths of a second to show the matching paren 118 | set cpoptions-=m " showmatch will wait 0.5s or until a char is typed 119 | 120 | " }}} 121 | " Behavior {{{ 122 | " -------- 123 | set nowrap " No wrap by default 124 | set linebreak " Break long lines at 'breakat' 125 | set breakat=\ \ ;:,!? " Long lines break chars 126 | set nostartofline " Cursor in same column for few commands 127 | set whichwrap+=h,l,<,>,[,],~ " Move to following line on certain keys 128 | set splitbelow splitright " Splits open bottom right 129 | set switchbuf=useopen,usetab " Jump to the first open window in any tab 130 | set switchbuf+=vsplit " Switch buffer behavior to vsplit 131 | set backspace=indent,eol,start " Intuitive backspacing in insert mode 132 | set diffopt=filler,iwhite " Diff mode: show fillers, ignore white 133 | set showfulltag " Show tag and tidy search in completion 134 | set complete=. " No wins, buffs, tags, include scanning 135 | set completeopt=menuone " Show menu even for one item 136 | set completeopt+=noselect " Do not select a match in the menu 137 | if has('patch-7.4.775') 138 | set completeopt+=noinsert 139 | endif 140 | 141 | if exists('+inccommand') 142 | set inccommand=nosplit 143 | endif 144 | 145 | " }}} 146 | " Editor UI Appearance {{{ 147 | " -------------------- 148 | set noshowmode " Don't show mode in cmd window 149 | set shortmess=aoOTI " Shorten messages and don't show intro 150 | set scrolloff=2 " Keep at least 2 lines above/below 151 | set sidescrolloff=5 " Keep at least 5 lines left/right 152 | set nonumber " Don't show line numbers 153 | set ruler " Enable default status ruler 154 | set list " Show hidden characters 155 | 156 | set showtabline=2 " Always show the tabs line 157 | set winwidth=30 " Minimum width for active window 158 | set winminwidth=10 " Minimum width for inactive windows 159 | set winheight=1 " Minimum height for active window 160 | set pumheight=15 " Pop-up menu's line height 161 | set helpheight=12 " Minimum help window height 162 | set previewheight=12 " Completion preview height 163 | 164 | set noshowcmd " Don't show command in status line 165 | set cmdheight=2 " Height of the command line 166 | set cmdwinheight=5 " Command-line lines 167 | set noequalalways " Don't resize windows on split or close 168 | set laststatus=2 " Always show a status line 169 | set colorcolumn=80 " Highlight the 80th character limit 170 | set display=lastline 171 | 172 | " Do not display completion messages 173 | " Patch: https://groups.google.com/forum/#!topic/vim_dev/WeBBjkXE8H8 174 | if has('patch-7.4.314') 175 | set shortmess+=c 176 | endif 177 | 178 | " Do not display message when editing files 179 | if has('patch-7.4.1570') 180 | set shortmess+=F 181 | endif 182 | 183 | " For snippet_complete marker 184 | if has('conceal') && v:version >= 703 185 | set conceallevel=2 concealcursor=niv 186 | endif 187 | 188 | " }}} 189 | " Folds {{{ 190 | " ----- 191 | 192 | " FastFold 193 | " Credits: https://github.com/Shougo/shougo-s-github 194 | autocmd MyAutoCmd TextChangedI,TextChanged * 195 | \ if &l:foldenable && &l:foldmethod !=# 'manual' | 196 | \ let b:foldmethod_save = &l:foldmethod | 197 | \ let &l:foldmethod = 'manual' | 198 | \ endif 199 | 200 | autocmd MyAutoCmd BufWritePost * 201 | \ if &l:foldmethod ==# 'manual' && exists('b:foldmethod_save') | 202 | \ let &l:foldmethod = b:foldmethod_save | 203 | \ execute 'normal! zx' | 204 | \ endif 205 | 206 | if has('folding') 207 | set foldenable 208 | set foldmethod=syntax 209 | set foldlevelstart=99 210 | set foldtext=FoldText() 211 | endif 212 | 213 | " Improved Vim fold-text 214 | " See: http://www.gregsexton.org/2011/03/improving-the-text-displayed-in-a-fold/ 215 | function! FoldText() 216 | " Get first non-blank line 217 | let fs = v:foldstart 218 | while getline(fs) =~? '^\s*$' | let fs = nextnonblank(fs + 1) 219 | endwhile 220 | if fs > v:foldend 221 | let line = getline(v:foldstart) 222 | else 223 | let line = substitute(getline(fs), '\t', repeat(' ', &tabstop), 'g') 224 | endif 225 | 226 | let w = winwidth(0) - &foldcolumn - (&number ? 8 : 0) 227 | let foldSize = 1 + v:foldend - v:foldstart 228 | let foldSizeStr = ' ' . foldSize . ' lines ' 229 | let foldLevelStr = repeat('+--', v:foldlevel) 230 | let lineCount = line('$') 231 | let foldPercentage = printf('[%.1f', (foldSize*1.0)/lineCount*100) . '%] ' 232 | let expansionString = repeat('.', w - strwidth(foldSizeStr.line.foldLevelStr.foldPercentage)) 233 | return line . expansionString . foldSizeStr . foldPercentage . foldLevelStr 234 | endfunction 235 | 236 | " }}} 237 | 238 | " vim: set foldmethod=marker ts=2 sw=2 tw=80 noet : 239 | -------------------------------------------------------------------------------- /.config/tmux/config: -------------------------------------------------------------------------------- 1 | # .-. .-. .-. .-. .-. .-. 2 | # `._.' `._.' `._.' `._.' `._.' `._.' ` 3 | # 4 | # github.com/rafi tmux config 5 | # 6 | 7 | # Behavior 8 | #------------------------------------------------- 9 | 10 | set-option -g default-shell $SHELL 11 | set-option -g default-terminal "screen-256color" 12 | # set-option -g default-terminal "tmux18-256color" 13 | 14 | # Reattach each new window to the user bootstrap namespace 15 | if-shell \ 16 | 'test "$(uname -s)" = Darwin' \ 17 | 'set-option -g default-command "exec reattach-to-user-namespace -l $SHELL"' 18 | 19 | set-option -g set-titles on 20 | set-option -g set-titles-string '#T #W tmux{#S}:#I.#P' 21 | 22 | set-window-option -g automatic-rename on 23 | set-window-option -g xterm-keys on 24 | 25 | 26 | # scrollback buffer size increase 27 | set-option -g history-limit 6000 28 | 29 | # Address vim mode switching delay (http://superuser.com/a/252717/65504) 30 | set-option -s escape-time 0 31 | 32 | # tmux messages are displayed for 3 seconds 33 | set-option -g display-time 3000 34 | 35 | # Allow the arrow key to be used immediately after changing windows, default is 500 36 | set-option -g repeat-time 300 37 | 38 | # focus events enabled for terminals that support them 39 | set-option -g focus-events on 40 | 41 | # Rather than constraining window size to the maximum size of any client 42 | # connected to the *session*, constrain window size to the maximum size of any 43 | # client connected to *that window*. Much more reasonable. 44 | set-window-option -g aggressive-resize on 45 | 46 | # Start windows and panes from 1 47 | set-option -g base-index 1 48 | set-window-option -g pane-base-index 1 49 | 50 | # Visual notifications 51 | set-option -g visual-bell off 52 | set-option -g visual-activity off 53 | set-option -g visual-silence off 54 | 55 | # Window Monitoring 56 | set-window-option -g monitor-activity on 57 | set-window-option -g monitor-silence 0 58 | 59 | # Key bindings 60 | #------------------------------------------------- 61 | 62 | # Act like GNU screen, use C-a instead of C-b 63 | unbind-key C-b 64 | set-option -g prefix C-a 65 | 66 | # In nested tmux clients, send prefix with C-a C-a, or C-a a 67 | bind-key C-a send-prefix 68 | bind-key a send-prefix 69 | 70 | # Open new window from current path 71 | bind-key c new-window -c "#{pane_current_path}" 72 | 73 | # Create new session 74 | bind-key N new-session 75 | 76 | # Kill a session 77 | bind-key D choose-tree -sf "kill-session -t '%%'" 78 | 79 | # Use v and g for splitting from current path 80 | unbind-key % 81 | unbind-key '"' 82 | bind-key g split-window -h -c "#{pane_current_path}" 83 | bind-key v split-window -v -c "#{pane_current_path}" 84 | bind-key | split-window -h -c "#{pane_current_path}" 85 | bind-key - split-window -v -c "#{pane_current_path}" 86 | 87 | # Session navigation 88 | bind-key n switch-client -n 89 | bind-key p switch-client -p 90 | 91 | # Window navigation 92 | bind-key -n M-Left previous-window 93 | bind-key -n M-Right next-window 94 | bind-key -n M-9 previous-window 95 | bind-key -n M-0 next-window 96 | 97 | # Window Re-order 98 | bind-key -n M-< swap-window -t -1 99 | bind-key -n M-> swap-window -t +1 100 | 101 | # Pane navigation 102 | bind-key h select-pane -L 103 | bind-key j select-pane -D 104 | bind-key k select-pane -U 105 | bind-key l select-pane -R 106 | 107 | # Smart pane switching with awareness of vim splits. 108 | is_vim="ps -o state= -o comm= -t '#{pane_tty}' \ 109 | | grep -iqE '^[^TXZ ]+ +(\\S+\\/)?g?(view|n?vim?x?)(diff)?$'" 110 | bind-key -n C-h if-shell "$is_vim" "send-keys C-h" "select-pane -L" 111 | bind-key -n C-j if-shell "$is_vim" "send-keys C-j" "select-pane -D" 112 | bind-key -n C-k if-shell "$is_vim" "send-keys C-k" "select-pane -U" 113 | bind-key -n C-l if-shell "$is_vim" "send-keys C-l" "select-pane -R" 114 | bind-key -n C-\ if-shell "$is_vim" "send-keys C-\\" "select-pane -l" 115 | 116 | # Bring back clear screen under tmux prefix 117 | bind-key C-l send-keys 'C-l' 118 | 119 | # Toggle synchronized input to all panes in current window 120 | bind-key S set-window-option synchronize-panes 121 | 122 | # Quick layout shortcuts 123 | bind-key b set-window-option main-pane-width 90\; select-layout main-vertical 124 | bind-key B set-window-option main-pane-height 30\; select-layout main-horizontal 125 | 126 | # Use a tick for renaming the window prompt 127 | unbind-key ',' 128 | bind-key ` command-prompt -I '#W' -p 'Rename window>' "rename-window '%%'" 129 | unbind-key '$' 130 | bind-key '$' command-prompt -I '#S' -p 'Rename session>' "rename-session '%%'" 131 | 132 | # Open a man page in new vertical pane 133 | bind-key / command-prompt -p 'Man>' "split-window -d -v 'exec man %%'" 134 | 135 | # Use Facebook PathPicker to select paths from buffer interactively 136 | # bind-key f capture-pane \; \ 137 | # save-buffer /tmp/tmux-buffer \; \ 138 | # new-window -c "#{pane_current_path}" "sh -c 'cat /tmp/tmux-buffer | fpp -c \"vim -O\" && rm /tmp/tmux-buffer'" 139 | 140 | # Use urlview for displaying all links from buffer 141 | bind-key u capture-pane -J \; save-buffer /tmp/tmux-buffer \; split-window -l 10 "urlview '/tmp/tmux-buffer' && rm /tmp/tmux-buffer" 142 | 143 | # Quick view of processes 144 | bind-key P split-window -h 'exec htop' 145 | 146 | # Help screen: rebind list-keys window into a new pane 147 | bind-key ? split-window -h 'exec tmux list-keys | less' 148 | 149 | # Force a reload of the config file 150 | bind-key r source-file $XDG_CONFIG_HOME/tmux/config \; display-message "Config reloaded." 151 | 152 | #bind-key R respawn-window 153 | bind-key R refresh-client 154 | bind-key * list-clients 155 | 156 | # Search for previous error 157 | bind-key e copy-mode \; send-keys "?error" C-m 158 | 159 | # Disable Ctrl+Arrows to maintain word jump 160 | unbind-key -n C-Left 161 | unbind-key -n C-Right 162 | unbind-key -n C-Up 163 | unbind-key -n C-Down 164 | 165 | # Disable arrows, use 'em for easy pane resizing 166 | bind-key -n M-n resize-pane -L 5 167 | bind-key -n M-. resize-pane -R 5 168 | bind-key -n M-m resize-pane -D 5 169 | bind-key -n M-, resize-pane -U 5 170 | 171 | # Control 172 | #------------------------------------------------- 173 | 174 | # bind vi key-mapping 175 | set-option -g status-keys vi 176 | 177 | # vi-style controls for copy mode 178 | set-window-option -g mode-keys vi 179 | 180 | # Allows scrolling and selecting in copy-mode 181 | set-option -g -q mouse on 182 | 183 | unbind -Tcopy-mode-vi Enter 184 | bind-key Escape copy-mode 185 | bind-key -Tcopy-mode-vi y send -X copy-pipe-and-cancel "xsel -ib --logfile $XDG_CACHE_HOME/xsel.log >/dev/null" 186 | bind-key -Tcopy-mode-vi v send -X begin-selection 187 | bind-key -Tcopy-mode-vi V send -X select-line 188 | bind-key -Tcopy-mode-vi C-v send -X rectangle-toggle 189 | bind-key -Tcopy-mode-vi Escape send -X clear-selection 190 | 191 | # Look n Feel 192 | #------------------------------------------------- 193 | # 194 | # *-attr options accept: none, bright (or bold), dim, underscore, blink, 195 | # reverse, hidden, or italics. 196 | 197 | set-option -g message-fg colour11 198 | set-option -g message-bg colour236 199 | set-option -g message-attr none 200 | set-option -g message-command-fg colour253 201 | set-option -g message-command-bg colour236 202 | set-option -g message-command-attr none 203 | 204 | set-option -g pane-border-fg colour240 205 | set-option -g pane-border-bg default 206 | set-option -g pane-active-border-fg colour4 207 | set-option -g pane-active-border-bg colour235 208 | set-option -g display-panes-active-colour colour220 209 | set-option -g display-panes-colour colour74 210 | 211 | set-window-option -g mode-fg colour11 212 | set-window-option -g mode-bg colour236 213 | set-window-option -g mode-attr none 214 | 215 | set-window-option -g clock-mode-colour colour64 216 | set-window-option -g clock-mode-style 24 217 | 218 | # Status lines 219 | #------------------------------------------------- 220 | 221 | set-option -g status on 222 | set-option -g status-position top 223 | set -g status-justify left 224 | 225 | # Refresh 'status-left' and 'status-right' more often 226 | set-option -g status-interval 3 227 | 228 | set-option -g status-fg colour239 229 | set-option -g status-bg colour236 230 | set-option -g status-attr default 231 | 232 | set-option -g status-left-length 15 233 | set-option -g status-left-fg colour254 234 | set-option -g status-left-bg colour241 235 | set-option -g status-left-attr none 236 | set-option -g status-left '#{?client_prefix,#[fg=colour236]#[bg=colour2],} #S #{?client_prefix,#[fg=colour2],#[fg=colour241]}#[bg=colour235]#[fg=colour234,bg=colour236]░' 237 | set-option -g status-right-fg colour240 238 | set-option -g status-right-bg default 239 | set-option -g status-right-attr none 240 | set-option -g status-right-length 83 241 | set-option -g status-right "#[fg=colour239] #(uptime | sed 's/^.*: //') #[fg=colour237]#[fg=colour245] #[fg=colour237]#[fg=colour250] #h " 242 | 243 | set-window-option -g window-style '' 244 | set-window-option -g window-active-style '' 245 | set-window-option -g pane-active-border-style '' 246 | 247 | set-window-option -g window-status-fg colour247 248 | set-window-option -g window-status-bg colour236 249 | set-window-option -g window-status-attr none 250 | set-window-option -g window-status-separator "" 251 | set-window-option -g window-status-format " #[fg=colour243]#I#[fg=colour247]#F#[default]#W #[fg=colour236,bg=colour235]#[fg=colour234,bg=default]░" 252 | set-window-option -g window-status-current-fg colour251 253 | set-window-option -g window-status-current-bg colour239 254 | set-window-option -g window-status-current-attr none 255 | set-window-option -g window-status-current-format "#[fg=colour235]░#[fg=colour235]#I#[fg=colour235]#F#[default]#W #[fg=colour238]#[fg=colour239,bg=colour235]#[fg=colour234,bg=colour236]░" 256 | 257 | set-window-option -g window-status-activity-fg colour254 258 | set-window-option -g window-status-activity-bg colour236 259 | set-window-option -g window-status-activity-attr none 260 | set-window-option -g window-status-bell-fg colour169 261 | set-window-option -g window-status-bell-bg colour236 262 | set-window-option -g window-status-bell-attr none 263 | set-window-option -g window-status-last-fg colour247 264 | set-window-option -g window-status-last-bg colour236 265 | set-window-option -g window-status-last-attr none 266 | 267 | # vim: set ft=tmux ts=2 sw=2 tw=80 noet : 268 | -------------------------------------------------------------------------------- /.config/bash/dircolors: -------------------------------------------------------------------------------- 1 | # .-. .-. .-. .-. .-. .-. 2 | # `._.' `._.' `._.' `._.' `._.' `._.' ` 3 | # 4 | # github.com/rafi/.config bash/dircolors 5 | # 6 | # Credits: milomouse (github.com/milomouse), json ryan (jasonwryan.com) 7 | 8 | ##+ color (tty, all, none): 9 | COLOR all 10 | 11 | ##+ extra ls options: 12 | OPTIONS -F -b -T 0 13 | 14 | ##+ eightbit (1=on, 0=off) 15 | EIGHTBIT 1 16 | 17 | ##+ Below are the color init strings for the basic file types. A color init 18 | ##+ string consists of one or more of the following numeric codes: 19 | ##+ Attribute codes: 20 | ##+ 00=none 01=bold 04=underscore 05=blink 07=reverse 08=concealed 21 | ##+ Text color codes: 22 | ##+ 30=black 31=red 32=green 33=yellow 34=blue 35=magenta 36=cyan 37=white 23 | ##+ Background color codes: 24 | ##+ 40=black 41=red 42=green 43=yellow 44=blue 45=magenta 46=cyan 47=white 25 | 26 | # No color code at all 27 | NORMAL 00 28 | # Regular file: use no color at all 29 | FILE 00 30 | # Reset to "normal" color 31 | RESET 0 32 | 33 | # Directory 34 | DIR 00;34 35 | LINK 01;31 36 | FIFO 01;33 37 | SOCK 00;33 38 | BLK 40;31;01 39 | CHR 40;37 40 | ORPHAN 01;30 41 | MISSING 01;30 42 | 43 | # File that is setuid (u+s) 44 | SETUID 48;5;160;38;5;230 45 | 46 | # File that is setgid (g+s) 47 | SETGID 48;5;136;38;5;230 48 | 49 | # File with capability 50 | CAPABILITY 30;41 51 | 52 | # Dir that is other-writable (o+w) and not sticky 53 | OTHER_WRITABLE 38;5;154 54 | 55 | # This is for files with execute permission: 56 | EXEC 01;36 57 | 58 | ##+ executables: 59 | .bat 01;37 60 | .btm 01;37 61 | .cmd 01;37 62 | .com 01;37 63 | .exe 01;37 64 | .iso 00;33 65 | ##+ archives: 66 | .7z 01;33 67 | .deb 01;33 68 | .DEB 01;33 69 | .tar 01;33 70 | .TAR 01;33 71 | .tgz 01;33 72 | .TGZ 01;33 73 | .gz 01;33 74 | .GZ 01;33 75 | .bz2 01;33 76 | .BZ2 01;33 77 | .tar.xz 01;33 78 | .tar.gz 01;33 79 | .xz 01;33 80 | .XZ 01;33 81 | .lzma 01;33 82 | .LZMA 01;33 83 | .lzo 01;33 84 | .LZO 01;33 85 | .lzop 01;33 86 | .LZOP 01;33 87 | .rar 01;33 88 | .RAR 01;33 89 | .ace 01;33 90 | .ACE 01;33 91 | .zip 01;33 92 | .ZIP 01;33 93 | ##+ images: 94 | .gif 01;34 95 | .GIF 01;34 96 | .svg 01;34 97 | .SVG 01;34 98 | .png 01;34 99 | .PNG 01;34 100 | .jpg 01;34 101 | .JPG 01;34 102 | .jpeg 01;34 103 | .JPEG 01;34 104 | .bmp 01;34 105 | .BMP 01;34 106 | .xbm 01;34 107 | .XBM 01;34 108 | .xpm 01;34 109 | .XPM 01;34 110 | .tif 01;34 111 | .TIF 01;34 112 | .tiff 01;34 113 | .TIFF 01;34 114 | .tga 01;34 115 | .TGA 01;34 116 | .xcf 01;34 117 | .XCF 01;34 118 | .xcf.gz 01;34 119 | .XCF.GZ 01;34 120 | .blend 01;34 121 | .BLEND 01;34 122 | .pcx 01;34 123 | .PCX 01;34 124 | .ppm 01;34 125 | .PPM 01;34 126 | ##+ audio: 127 | .ogg 00;32 128 | .OGG 00;32 129 | .ogm 00;32 130 | .OGM 00;32 131 | .flac 00;32 132 | .FLAC 00;32 133 | .ape 00;32 134 | .APE 00;32 135 | .ac3 00;32 136 | .AC3 00;32 137 | .dts 00;32 138 | .DTS 00;32 139 | .aiff 00;32 140 | .AIFF 00;32 141 | .aiffc 00;32 142 | .AIFFC 00;32 143 | .aac 00;32 144 | .AAC 00;32 145 | .mp3 00;32 146 | .MP3 00;32 147 | .fla 00;32 148 | .FLA 00;32 149 | .m4a 00;32 150 | .M4A 00;32 151 | .mid 00;32 152 | .MID 00;32 153 | .wav 00;32 154 | .WAV 00;32 155 | .au 00;32 156 | .nes 00;32 157 | .smc 00;32 158 | .fig 00;32 159 | .sfc 00;32 160 | .webm 00;32 161 | .smc.gz 00;32 162 | .fig.gz 00;32 163 | .sfc.gz 00;32 164 | ##+ video: 165 | .mkv 01;32 166 | .MKV 01;32 167 | .ogv 01;32 168 | .OGV 01;32 169 | .mp4 01;32 170 | .MP4 01;32 171 | .m4v 01;32 172 | .M4V 01;32 173 | .mpg 01;32 174 | .MPG 01;32 175 | .mpeg 01;32 176 | .MPEG 01;32 177 | .wmv 01;32 178 | .WMV 01;32 179 | .avi 01;32 180 | .AVI 01;32 181 | .mov 01;32 182 | .MOV 01;32 183 | .fli 01;32 184 | .FLI 01;32 185 | .flc 01;32 186 | .FLC 01;32 187 | .flv 01;32 188 | .FLV 01;32 189 | .swf 01;32 190 | .SWF 01;32 191 | ##+ documents: 192 | .doc 01;37 193 | .docx 01;37 194 | .dif 01;37 195 | .word 01;37 196 | .excel 01;37 197 | .xls 01;37 198 | .xlt 01;37 199 | .pxl 01;37 200 | .slk 01;37 201 | .csv 01;37 202 | .rtf 01;37 203 | .pdb 01;37 204 | .psw 01;37 205 | .ppt 01;37 206 | .pps 01;37 207 | .pot 01;37 208 | .potm 01;37 209 | .pptx 01;37 210 | .ppsx 01;37 211 | .pdf 00;37 212 | .ps 00;37 213 | .txt 00;37 214 | .odt 00;37 215 | .odg 00;37 216 | .ods 00;37 217 | .ots 00;37 218 | .fodt 00;37 219 | .ott 00;37 220 | .uot 00;37 221 | .ssi 00;37 222 | .sti 00;37 223 | .ssx 00;37 224 | .sxc 00;37 225 | .sxd 00;37 226 | .sxw 00;37 227 | .stw 00;37 228 | .txt 00;37 229 | .tex 00;37 230 | .odp 00;37 231 | .otp 00;37 232 | ##+ everything else: 233 | .ackrc 01;35 234 | .asc 00;37 235 | .asm 01;35 236 | .apvlvrc 00;35 237 | .asoundrc 00;35 238 | *autostart 01;31 239 | .awk 00;36 240 | .bash 00;31 241 | .bashrc 00;35 242 | .bash_profile 00;35 243 | .bak 01;31 244 | .bzr 00;36 245 | .c 00;35 246 | .cfg 00;36 247 | .coffee 00;36 248 | .conf 00;35 249 | *COPYING 01;37 250 | .cpp 01;35 251 | .cs 01;35 252 | .css 01;35 253 | .csv 01;35 254 | .def 00;35 255 | .diff 01;33 256 | .dir_colors 00;37 257 | .dirs 00;37 258 | .ebuild 00;35 259 | .enc 00;36 260 | .eps 00;36 261 | .etx 00;36 262 | .ex 00;36 263 | .example 00;36 264 | .fehbg 00;36 265 | .fonts 00;36 266 | .git 00;37 267 | .gitconfig 00;37 268 | .gitignore 00;37 269 | .glivrc 00;35 270 | .gtk-bookmarks 00;37 271 | .gtkrc 00;37 272 | .gtkrc-2.0 00;37 273 | .go 00;35 274 | .h 01;34 275 | .hgignore 01;34 276 | .hgrc 01;35 277 | .hs 01;35 278 | .htm 01;35 279 | .html 01;35 280 | .htoprc 00;35 281 | .info 01;37 282 | .ini 00 283 | .interrobangrc 00;35 284 | .irbrc 00;35 285 | .java 01;35 286 | .jhtm 01;35 287 | .js 01;35 288 | .jsm 01;35 289 | .jsm 01;35 290 | .json 01;35 291 | .jsp 01;35 292 | .larswmrc 01;35 293 | .lisp 00;35 294 | .lesshst 00;37 295 | .log 01;37 296 | .lua 00;35 297 | .mailcap 01;31 298 | *Makefile 00;31 299 | .map 01;32 300 | .markdown 01;32 301 | .md 01;37 302 | .mostrc 01;35 303 | .mkd 01;32 304 | .msmtprc 01;35 305 | .muttrc 01;35 306 | .nfo 01;37 307 | .netrc 00;35 308 | .o 00;34 309 | .offlineimaprc 01;35 310 | .opt 00;36 311 | .pacnew 01;33 312 | .patch 01;33 313 | .pentadactylrc 00;35 314 | .pc 00;36 315 | .php 00;35 316 | .pid 00;33 317 | .pl 00;31 318 | .pod 01;32 319 | .py 00;35 320 | .ratpoisonrc 01;35 321 | .rb 00;35 322 | .rc 01;35 323 | *README 01;37 324 | .rtf 00;37 325 | .recently-used 00;37 326 | .rnd 00;33 327 | .sbclrc 00;35 328 | .sed 01;35 329 | .sh 00;31 330 | .signature 01;33 331 | .spec 00;37 332 | .stumpwmrc 01;35 333 | .t 01;37 334 | .tcl 01;35 335 | .tdy 01;35 336 | .textile 01;35 337 | .theme 00;37 338 | *viminfo 00;37 339 | .xml 01;35 340 | .yml 01;35 341 | .zcompdump 00;35 342 | .zlogin 00;35 343 | .zwc 01;35 344 | .zsh 01;31 345 | .zshrc 00;35 346 | .ttytterrc 00;35 347 | .urlview 00 348 | .vim 01;35 349 | .vimperatorrc 00;35 350 | *vimrc 00;35 351 | .xinitrc 00;35 352 | *xinitrc 00;35 353 | .Xauthority 01;35 354 | .Xdefaults 01;35 355 | *Xdefaults 01;35 356 | *xdefaults 01;35 357 | .Xmodmap 01;35 358 | .xmodmap 01;35 359 | .Xresources 01;35 360 | *Xresources 01;35 361 | *xresources 01;35 362 | 363 | ##+ below, there should be one TERM entry for each termtype that is colorizable 364 | TERM Eterm 365 | TERM ansi 366 | TERM color-xterm 367 | TERM con132x25 368 | TERM con132x30 369 | TERM con132x43 370 | TERM con132x60 371 | TERM con80x25 372 | TERM con80x28 373 | TERM con80x30 374 | TERM con80x43 375 | TERM con80x50 376 | TERM con80x60 377 | TERM cons25 378 | TERM console 379 | TERM cygwin 380 | TERM dtterm 381 | TERM eterm-color 382 | TERM gnome 383 | TERM gnome-256color 384 | TERM jfbterm 385 | TERM konsole 386 | TERM kterm 387 | TERM linux 388 | TERM linux-c 389 | TERM mach-color 390 | TERM mlterm 391 | TERM putty 392 | TERM rxvt 393 | TERM rxvt-256color 394 | TERM rxvt-cygwin 395 | TERM rxvt-cygwin-native 396 | TERM rxvt-unicode 397 | TERM rxvt-unicode-256color 398 | TERM rxvt-unicode256 399 | TERM screen 400 | TERM screen-256color 401 | TERM screen-256color-bce 402 | TERM screen-bce 403 | TERM screen-w 404 | TERM screen.rxvt 405 | TERM screen.linux 406 | TERM terminator 407 | TERM vt100 408 | TERM xterm 409 | TERM xterm-16color 410 | TERM xterm-256color 411 | TERM xterm-88color 412 | TERM xterm-color 413 | TERM xterm-debian 414 | 415 | # vim: set ft=dircolors ts=2 sw=2 tw=80 noet : 416 | -------------------------------------------------------------------------------- /.config/nvim/colors/hybrid.vim: -------------------------------------------------------------------------------- 1 | " File: hybrid.vim 2 | " Maintainer: Andrew Wong (w0ng) 3 | " URL: https://github.com/w0ng/vim-hybrid 4 | " Modified: 27 Jan 2013 07:33 AM AEST 5 | " License: MIT 6 | 7 | " Description:"{{{ 8 | " ---------------------------------------------------------------------------- 9 | " The default RGB colour palette is taken from Tomorrow-Night.vim: 10 | " https://github.com/chriskempson/vim-tomorrow-theme 11 | " 12 | " The reduced RGB colour palette is taken from Codecademy's online editor: 13 | " https://www.codecademy.com/learn 14 | " 15 | " The syntax highlighting scheme is taken from jellybeans.vim: 16 | " https://github.com/nanotech/jellybeans.vim 17 | " 18 | " The is code taken from solarized.vim: 19 | " https://github.com/altercation/vim-colors-solarized 20 | 21 | "}}} 22 | " Requirements And Recommendations:"{{{ 23 | " ---------------------------------------------------------------------------- 24 | " Requirements 25 | " - gVim 7.3+ on Linux, Mac and Windows. 26 | " - Vim 7.3+ on Linux and Mac, using a terminal that supports 256 colours. 27 | " 28 | " Due to the limited 256 palette, colours in Vim and gVim will still be slightly 29 | " different. 30 | " 31 | " In order to have Vim use the same colours as gVim (the way this colour scheme 32 | " is intended), it is recommended that you define the basic 16 colours in your 33 | " terminal. 34 | " 35 | " For Linux users (rxvt-unicode, xterm): 36 | " 37 | " 1. Add the default palette to ~/.Xresources: 38 | " 39 | " https://gist.github.com/3278077 40 | " 41 | " or alternatively, add the reduced contrast palette to ~/.Xresources: 42 | " 43 | " https://gist.github.com/w0ng/16e33902508b4a0350ae 44 | " 45 | " 2. Add to ~/.vimrc: 46 | " 47 | " let g:hybrid_custom_term_colors = 1 48 | " let g:hybrid_reduced_contrast = 1 " Remove this line if using the default palette. 49 | " colorscheme hybrid 50 | " 51 | " For OSX users (iTerm): 52 | " 53 | " 1. Import the default colour preset into iTerm: 54 | " 55 | " https://raw.githubusercontent.com/w0ng/dotfiles/master/iterm2/hybrid.itermcolors 56 | " 57 | " or alternatively, import the reduced contrast color preset into iTerm: 58 | " 59 | " https://raw.githubusercontent.com/w0ng/dotfiles/master/iterm2/hybrid-reduced-contrast.itermcolors 60 | " 61 | " 2. Add to ~/.vimrc: 62 | " 63 | " let g:hybrid_custom_term_colors = 1 64 | " let g:hybrid_reduced_contrast = 1 " Remove this line if using the default palette. 65 | " colorscheme hybrid 66 | 67 | "}}} 68 | " Initialisation:"{{{ 69 | " ---------------------------------------------------------------------------- 70 | 71 | hi clear 72 | 73 | if exists("syntax_on") 74 | syntax reset 75 | endif 76 | 77 | let s:style = &background 78 | 79 | let g:colors_name = "hybrid" 80 | 81 | "}}} 82 | " GUI And Cterm Palettes:"{{{ 83 | " ---------------------------------------------------------------------------- 84 | 85 | let s:palette = {'gui' : {} , 'cterm' : {}} 86 | 87 | if exists("g:hybrid_reduced_contrast") && g:hybrid_reduced_contrast == 1 88 | let s:gui_background = "#232c31" 89 | let s:gui_selection = "#425059" 90 | let s:gui_line = "#2d3c46" 91 | let s:gui_comment = "#6c7a80" 92 | else 93 | let s:gui_background = "#1d1f21" 94 | let s:gui_selection = "#373b41" 95 | let s:gui_line = "#282a2e" 96 | let s:gui_comment = "#707880" 97 | endif 98 | 99 | let s:palette.gui.background = { 'dark' : s:gui_background , 'light' : "#e4e4e4" } 100 | let s:palette.gui.foreground = { 'dark' : "#c5c8c6" , 'light' : "#000000" } 101 | let s:palette.gui.selection = { 'dark' : s:gui_selection , 'light' : "#bcbcbc" } 102 | let s:palette.gui.line = { 'dark' : s:gui_line , 'light' : "#d0d0d0" } 103 | let s:palette.gui.comment = { 'dark' : s:gui_comment , 'light' : "#5f5f5f" } 104 | let s:palette.gui.red = { 'dark' : "#cc6666" , 'light' : "#5f0000" } 105 | let s:palette.gui.orange = { 'dark' : "#de935f" , 'light' : "#875f00" } 106 | let s:palette.gui.yellow = { 'dark' : "#f0c674" , 'light' : "#5f5f00" } 107 | let s:palette.gui.green = { 'dark' : "#b5bd68" , 'light' : "#005f00" } 108 | let s:palette.gui.aqua = { 'dark' : "#8abeb7" , 'light' : "#005f5f" } 109 | let s:palette.gui.blue = { 'dark' : "#81a2be" , 'light' : "#00005f" } 110 | let s:palette.gui.purple = { 'dark' : "#b294bb" , 'light' : "#5f005f" } 111 | let s:palette.gui.window = { 'dark' : "#303030" , 'light' : "#9e9e9e" } 112 | let s:palette.gui.darkcolumn = { 'dark' : "#1c1c1c" , 'light' : "#808080" } 113 | let s:palette.gui.addbg = { 'dark' : "#5F875F" , 'light' : "#d7ffd7" } 114 | let s:palette.gui.addfg = { 'dark' : "#d7ffaf" , 'light' : "#005f00" } 115 | let s:palette.gui.changebg = { 'dark' : "#5F5F87" , 'light' : "#d7d7ff" } 116 | let s:palette.gui.changefg = { 'dark' : "#d7d7ff" , 'light' : "#5f005f" } 117 | let s:palette.gui.delbg = { 'dark' : "#cc6666" , 'light' : "#ffd7d7" } 118 | let s:palette.gui.darkblue = { 'dark' : "#00005f" , 'light' : "#d7ffd7" } 119 | let s:palette.gui.darkcyan = { 'dark' : "#005f5f" , 'light' : "#005f00" } 120 | let s:palette.gui.darkred = { 'dark' : "#5f0000" , 'light' : "#d7d7ff" } 121 | let s:palette.gui.darkpurple = { 'dark' : "#5f005f" , 'light' : "#5f005f" } 122 | 123 | if exists("g:hybrid_custom_term_colors") && g:hybrid_custom_term_colors == 1 124 | let s:cterm_foreground = "15" " White 125 | let s:cterm_selection = "8" " DarkGrey 126 | let s:cterm_line = "0" " Black 127 | let s:cterm_comment = "7" " LightGrey 128 | let s:cterm_red = "9" " LightRed 129 | let s:cterm_orange = "3" " DarkYellow 130 | let s:cterm_yellow = "11" " LightYellow 131 | let s:cterm_green = "10" " LightGreen 132 | let s:cterm_aqua = "14" " LightCyan 133 | let s:cterm_blue = "12" " LightBlue 134 | let s:cterm_purple = "13" " LightMagenta 135 | let s:cterm_delbg = "9" " LightRed 136 | else 137 | let s:cterm_foreground = "250" 138 | let s:cterm_selection = "237" 139 | let s:cterm_line = "235" 140 | let s:cterm_comment = "243" 141 | let s:cterm_red = "167" 142 | let s:cterm_orange = "173" 143 | let s:cterm_yellow = "221" 144 | let s:cterm_green = "143" 145 | let s:cterm_aqua = "109" 146 | let s:cterm_blue = "110" 147 | let s:cterm_purple = "139" 148 | let s:cterm_delbg = "167" 149 | endif 150 | 151 | let s:palette.cterm.background = { 'dark' : "234" , 'light' : "254" } 152 | let s:palette.cterm.foreground = { 'dark' : s:cterm_foreground , 'light' : "16" } 153 | let s:palette.cterm.window = { 'dark' : "236" , 'light' : "247" } 154 | let s:palette.cterm.selection = { 'dark' : s:cterm_selection , 'light' : "250" } 155 | let s:palette.cterm.line = { 'dark' : s:cterm_line , 'light' : "252" } 156 | let s:palette.cterm.comment = { 'dark' : s:cterm_comment , 'light' : "59" } 157 | let s:palette.cterm.red = { 'dark' : s:cterm_red , 'light' : "52" } 158 | let s:palette.cterm.orange = { 'dark' : s:cterm_orange , 'light' : "94" } 159 | let s:palette.cterm.yellow = { 'dark' : s:cterm_yellow , 'light' : "58" } 160 | let s:palette.cterm.green = { 'dark' : s:cterm_green , 'light' : "22" } 161 | let s:palette.cterm.aqua = { 'dark' : s:cterm_aqua , 'light' : "23" } 162 | let s:palette.cterm.blue = { 'dark' : s:cterm_blue , 'light' : "17" } 163 | let s:palette.cterm.purple = { 'dark' : s:cterm_purple , 'light' : "53" } 164 | let s:palette.cterm.darkcolumn = { 'dark' : "234" , 'light' : "244" } 165 | let s:palette.cterm.addbg = { 'dark' : "65" , 'light' : "194" } 166 | let s:palette.cterm.addfg = { 'dark' : "193" , 'light' : "22" } 167 | let s:palette.cterm.changebg = { 'dark' : "60" , 'light' : "189" } 168 | let s:palette.cterm.changefg = { 'dark' : "189" , 'light' : "53" } 169 | let s:palette.cterm.delbg = { 'dark' : s:cterm_delbg , 'light' : "224" } 170 | let s:palette.cterm.darkblue = { 'dark' : "17" , 'light' : "194" } 171 | let s:palette.cterm.darkcyan = { 'dark' : "24" , 'light' : "22" } 172 | let s:palette.cterm.darkred = { 'dark' : "52" , 'light' : "189" } 173 | let s:palette.cterm.darkpurple = { 'dark' : "53" , 'light' : "53" } 174 | 175 | "}}} 176 | " Formatting Options:"{{{ 177 | " ---------------------------------------------------------------------------- 178 | let s:none = "NONE" 179 | let s:t_none = "NONE" 180 | let s:n = "NONE" 181 | let s:c = ",undercurl" 182 | let s:r = ",reverse" 183 | let s:s = ",standout" 184 | let s:b = ",bold" 185 | let s:u = ",underline" 186 | let s:i = ",italic" 187 | 188 | "}}} 189 | " Highlighting Primitives:"{{{ 190 | " ---------------------------------------------------------------------------- 191 | function! s:build_prim(hi_elem, field) 192 | " Given a:hi_elem = bg, a:field = comment 193 | let l:vname = "s:" . a:hi_elem . "_" . a:field " s:bg_comment 194 | let l:gui_assign = "gui".a:hi_elem."=".s:palette.gui[a:field][s:style] " guibg=... 195 | let l:cterm_assign = "cterm".a:hi_elem."=".s:palette.cterm[a:field][s:style] " ctermbg=... 196 | exe "let " . l:vname . " = ' " . l:gui_assign . " " . l:cterm_assign . "'" 197 | endfunction 198 | 199 | let s:bg_none = ' guibg=NONE ctermbg=NONE' 200 | call s:build_prim('bg', 'foreground') 201 | call s:build_prim('bg', 'background') 202 | call s:build_prim('bg', 'selection') 203 | call s:build_prim('bg', 'line') 204 | call s:build_prim('bg', 'comment') 205 | call s:build_prim('bg', 'red') 206 | call s:build_prim('bg', 'orange') 207 | call s:build_prim('bg', 'yellow') 208 | call s:build_prim('bg', 'green') 209 | call s:build_prim('bg', 'aqua') 210 | call s:build_prim('bg', 'blue') 211 | call s:build_prim('bg', 'purple') 212 | call s:build_prim('bg', 'window') 213 | call s:build_prim('bg', 'darkcolumn') 214 | call s:build_prim('bg', 'addbg') 215 | call s:build_prim('bg', 'addfg') 216 | call s:build_prim('bg', 'changebg') 217 | call s:build_prim('bg', 'changefg') 218 | call s:build_prim('bg', 'delbg') 219 | call s:build_prim('bg', 'darkblue') 220 | call s:build_prim('bg', 'darkcyan') 221 | call s:build_prim('bg', 'darkred') 222 | call s:build_prim('bg', 'darkpurple') 223 | 224 | let s:fg_none = ' guifg=NONE ctermfg=NONE' 225 | call s:build_prim('fg', 'foreground') 226 | call s:build_prim('fg', 'background') 227 | call s:build_prim('fg', 'selection') 228 | call s:build_prim('fg', 'line') 229 | call s:build_prim('fg', 'comment') 230 | call s:build_prim('fg', 'red') 231 | call s:build_prim('fg', 'orange') 232 | call s:build_prim('fg', 'yellow') 233 | call s:build_prim('fg', 'green') 234 | call s:build_prim('fg', 'aqua') 235 | call s:build_prim('fg', 'blue') 236 | call s:build_prim('fg', 'purple') 237 | call s:build_prim('fg', 'window') 238 | call s:build_prim('fg', 'darkcolumn') 239 | call s:build_prim('fg', 'addbg') 240 | call s:build_prim('fg', 'addfg') 241 | call s:build_prim('fg', 'changebg') 242 | call s:build_prim('fg', 'changefg') 243 | call s:build_prim('fg', 'darkblue') 244 | call s:build_prim('fg', 'darkcyan') 245 | call s:build_prim('fg', 'darkred') 246 | call s:build_prim('fg', 'darkpurple') 247 | 248 | exe "let s:fmt_none = ' gui=NONE". " cterm=NONE". " term=NONE" ."'" 249 | exe "let s:fmt_bold = ' gui=NONE".s:b. " cterm=NONE".s:b. " term=NONE".s:b ."'" 250 | exe "let s:fmt_bldi = ' gui=NONE".s:b. " cterm=NONE".s:b. " term=NONE".s:b ."'" 251 | exe "let s:fmt_undr = ' gui=NONE".s:u. " cterm=NONE".s:u. " term=NONE".s:u ."'" 252 | exe "let s:fmt_undb = ' gui=NONE".s:u.s:b. " cterm=NONE".s:u.s:b. " term=NONE".s:u.s:b."'" 253 | exe "let s:fmt_undi = ' gui=NONE".s:u. " cterm=NONE".s:u. " term=NONE".s:u ."'" 254 | exe "let s:fmt_curl = ' gui=NONE".s:c. " cterm=NONE".s:c. " term=NONE".s:c ."'" 255 | exe "let s:fmt_ital = ' gui=NONE".s:i. " cterm=NONE".s:i. " term=NONE".s:i ."'" 256 | exe "let s:fmt_stnd = ' gui=NONE".s:s. " cterm=NONE".s:s. " term=NONE".s:s ."'" 257 | exe "let s:fmt_revr = ' gui=NONE".s:r. " cterm=NONE".s:r. " term=NONE".s:r ."'" 258 | exe "let s:fmt_revb = ' gui=NONE".s:r.s:b. " cterm=NONE".s:r.s:b. " term=NONE".s:r.s:b."'" 259 | 260 | exe "let s:sp_none = ' guisp=". s:none ."'" 261 | exe "let s:sp_foreground = ' guisp=". s:palette.gui.foreground[s:style] ."'" 262 | exe "let s:sp_background = ' guisp=". s:palette.gui.background[s:style] ."'" 263 | exe "let s:sp_selection = ' guisp=". s:palette.gui.selection[s:style] ."'" 264 | exe "let s:sp_line = ' guisp=". s:palette.gui.line[s:style] ."'" 265 | exe "let s:sp_comment = ' guisp=". s:palette.gui.comment[s:style] ."'" 266 | exe "let s:sp_red = ' guisp=". s:palette.gui.red[s:style] ."'" 267 | exe "let s:sp_orange = ' guisp=". s:palette.gui.orange[s:style] ."'" 268 | exe "let s:sp_yellow = ' guisp=". s:palette.gui.yellow[s:style] ."'" 269 | exe "let s:sp_green = ' guisp=". s:palette.gui.green[s:style] ."'" 270 | exe "let s:sp_aqua = ' guisp=". s:palette.gui.aqua[s:style] ."'" 271 | exe "let s:sp_blue = ' guisp=". s:palette.gui.blue[s:style] ."'" 272 | exe "let s:sp_purple = ' guisp=". s:palette.gui.purple[s:style] ."'" 273 | exe "let s:sp_window = ' guisp=". s:palette.gui.window[s:style] ."'" 274 | exe "let s:sp_addbg = ' guisp=". s:palette.gui.addbg[s:style] ."'" 275 | exe "let s:sp_addfg = ' guisp=". s:palette.gui.addfg[s:style] ."'" 276 | exe "let s:sp_changebg = ' guisp=". s:palette.gui.changebg[s:style] ."'" 277 | exe "let s:sp_changefg = ' guisp=". s:palette.gui.changefg[s:style] ."'" 278 | exe "let s:sp_darkblue = ' guisp=". s:palette.gui.darkblue[s:style] ."'" 279 | exe "let s:sp_darkcyan = ' guisp=". s:palette.gui.darkcyan[s:style] ."'" 280 | exe "let s:sp_darkred = ' guisp=". s:palette.gui.darkred[s:style] ."'" 281 | exe "let s:sp_darkpurple = ' guisp=". s:palette.gui.darkpurple[s:style] ."'" 282 | 283 | "}}} 284 | " Vim Highlighting: (see :help highlight-groups)"{{{ 285 | " ---------------------------------------------------------------------------- 286 | exe "hi! ColorColumn" .s:fg_none .s:bg_line .s:fmt_none 287 | " Conceal" 288 | " Cursor" 289 | " CursorIM" 290 | exe "hi! CursorColumn" .s:fg_none .s:bg_line .s:fmt_none 291 | exe "hi! CursorLine" .s:fg_none .s:bg_line .s:fmt_none 292 | exe "hi! Directory" .s:fg_blue .s:bg_none .s:fmt_none 293 | exe "hi! DiffAdd" .s:fg_addfg .s:bg_addbg .s:fmt_none 294 | exe "hi! DiffChange" .s:fg_changefg .s:bg_changebg .s:fmt_none 295 | exe "hi! DiffDelete" .s:fg_background .s:bg_delbg .s:fmt_none 296 | exe "hi! DiffText" .s:fg_background .s:bg_blue .s:fmt_none 297 | exe "hi! ErrorMsg" .s:fg_background .s:bg_red .s:fmt_stnd 298 | exe "hi! VertSplit" .s:fg_window .s:bg_none .s:fmt_none 299 | exe "hi! Folded" .s:fg_comment .s:bg_darkcolumn .s:fmt_none 300 | exe "hi! FoldColumn" .s:fg_none .s:bg_darkcolumn .s:fmt_none 301 | exe "hi! SignColumn" .s:fg_none .s:bg_darkcolumn .s:fmt_none 302 | " Incsearch" 303 | exe "hi! LineNr" .s:fg_selection .s:bg_none .s:fmt_none 304 | exe "hi! CursorLineNr" .s:fg_yellow .s:bg_none .s:fmt_none 305 | exe "hi! MatchParen" .s:fg_background .s:bg_changebg .s:fmt_none 306 | exe "hi! ModeMsg" .s:fg_green .s:bg_none .s:fmt_none 307 | exe "hi! MoreMsg" .s:fg_green .s:bg_none .s:fmt_none 308 | exe "hi! NonText" .s:fg_selection .s:bg_none .s:fmt_none 309 | exe "hi! Pmenu" .s:fg_foreground .s:bg_selection .s:fmt_none 310 | exe "hi! PmenuSel" .s:fg_foreground .s:bg_selection .s:fmt_revr 311 | " PmenuSbar" 312 | " PmenuThumb" 313 | exe "hi! Question" .s:fg_green .s:bg_none .s:fmt_none 314 | exe "hi! Search" .s:fg_background .s:bg_yellow .s:fmt_none 315 | exe "hi! SpecialKey" .s:fg_selection .s:bg_none .s:fmt_none 316 | exe "hi! SpellCap" .s:fg_blue .s:bg_darkblue .s:fmt_undr 317 | exe "hi! SpellLocal" .s:fg_aqua .s:bg_darkcyan .s:fmt_undr 318 | exe "hi! SpellBad" .s:fg_red .s:bg_darkred .s:fmt_undr 319 | exe "hi! SpellRare" .s:fg_purple .s:bg_darkpurple .s:fmt_undr 320 | exe "hi! StatusLine" .s:fg_comment .s:bg_background .s:fmt_revr 321 | exe "hi! StatusLineNC" .s:fg_window .s:bg_comment .s:fmt_revr 322 | exe "hi! TabLine" .s:fg_foreground .s:bg_darkcolumn .s:fmt_revr 323 | " TabLineFill" 324 | " TabLineSel" 325 | exe "hi! Title" .s:fg_yellow .s:bg_none .s:fmt_none 326 | exe "hi! Visual" .s:fg_none .s:bg_selection .s:fmt_none 327 | " VisualNos" 328 | exe "hi! WarningMsg" .s:fg_red .s:bg_none .s:fmt_none 329 | " FIXME LongLineWarning to use variables instead of hardcoding 330 | hi LongLineWarning guifg=NONE guibg=#371F1C gui=underline ctermfg=NONE ctermbg=NONE cterm=underline 331 | " WildMenu" 332 | 333 | " Use defined custom background colour for terminal Vim. 334 | if !has('gui_running') && exists("g:hybrid_custom_term_colors") && g:hybrid_custom_term_colors == 1 335 | let s:bg_normal = s:bg_none 336 | else 337 | let s:bg_normal = s:bg_background 338 | endif 339 | exe "hi! Normal" .s:fg_foreground .s:bg_normal .s:fmt_none 340 | 341 | "}}} 342 | " Generic Syntax Highlighting: (see :help group-name)"{{{ 343 | " ---------------------------------------------------------------------------- 344 | exe "hi! Comment" .s:fg_comment .s:bg_none .s:fmt_none 345 | 346 | exe "hi! Constant" .s:fg_red .s:bg_none .s:fmt_none 347 | exe "hi! String" .s:fg_green .s:bg_none .s:fmt_none 348 | " Character" 349 | " Number" 350 | " Boolean" 351 | " Float" 352 | 353 | exe "hi! Identifier" .s:fg_purple .s:bg_none .s:fmt_none 354 | exe "hi! Function" .s:fg_yellow .s:bg_none .s:fmt_none 355 | 356 | exe "hi! Statement" .s:fg_blue .s:bg_none .s:fmt_none 357 | " Conditional" 358 | " Repeat" 359 | " Label" 360 | exe "hi! Operator" .s:fg_aqua .s:bg_none .s:fmt_none 361 | " Keyword" 362 | " Exception" 363 | 364 | exe "hi! PreProc" .s:fg_aqua .s:bg_none .s:fmt_none 365 | " Include" 366 | " Define" 367 | " Macro" 368 | " PreCondit" 369 | 370 | exe "hi! Type" .s:fg_orange .s:bg_none .s:fmt_none 371 | " StorageClass" 372 | exe "hi! Structure" .s:fg_aqua .s:bg_none .s:fmt_none 373 | " Typedef" 374 | 375 | exe "hi! Special" .s:fg_green .s:bg_none .s:fmt_none 376 | " SpecialChar" 377 | " Tag" 378 | " Delimiter" 379 | " SpecialComment" 380 | " Debug" 381 | " 382 | exe "hi! Underlined" .s:fg_blue .s:bg_none .s:fmt_none 383 | 384 | exe "hi! Ignore" .s:fg_none .s:bg_none .s:fmt_none 385 | 386 | exe "hi! Error" .s:fg_red .s:bg_darkred .s:fmt_undr 387 | 388 | exe "hi! Todo" .s:fg_addfg .s:bg_none .s:fmt_none 389 | 390 | " Quickfix window highlighting 391 | exe "hi! qfLineNr" .s:fg_yellow .s:bg_none .s:fmt_none 392 | " qfFileName" 393 | " qfLineNr" 394 | " qfError" 395 | 396 | "}}} 397 | " Diff Syntax Highlighting:"{{{ 398 | " ---------------------------------------------------------------------------- 399 | " Diff 400 | " diffOldFile 401 | " diffNewFile 402 | " diffFile 403 | " diffOnly 404 | " diffIdentical 405 | " diffDiffer 406 | " diffBDiffer 407 | " diffIsA 408 | " diffNoEOL 409 | " diffCommon 410 | hi! link diffRemoved Constant 411 | " diffChanged 412 | hi! link diffAdded Special 413 | " diffLine 414 | " diffSubname 415 | " diffComment 416 | 417 | "}}} 418 | " 419 | " This is needed for some reason: {{{ 420 | 421 | let &background = s:style 422 | 423 | " }}} 424 | " Legal:"{{{ 425 | " ---------------------------------------------------------------------------- 426 | " Copyright (c) 2011 Ethan Schoonover 427 | " Copyright (c) 2009-2012 NanoTech 428 | " Copyright (c) 2012 w0ng 429 | " 430 | " Permission is hereby granted, free of charge, to any per‐ 431 | " son obtaining a copy of this software and associated doc‐ 432 | " umentation files (the “Software”), to deal in the Soft‐ 433 | " ware without restriction, including without limitation 434 | " the rights to use, copy, modify, merge, publish, distrib‐ 435 | " ute, sublicense, and/or sell copies of the Software, and 436 | " to permit persons to whom the Software is furnished to do 437 | " so, subject to the following conditions: 438 | " 439 | " The above copyright notice and this permission notice 440 | " shall be included in all copies or substantial portions 441 | " of the Software. 442 | " 443 | " THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY 444 | " KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO 445 | " THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICU‐ 446 | " LAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 447 | " AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, 448 | " DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CON‐ 449 | " TRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CON‐ 450 | " NECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 451 | " THE SOFTWARE. 452 | 453 | " }}} 454 | -------------------------------------------------------------------------------- /.config/ranger/rc.conf: -------------------------------------------------------------------------------- 1 | # =================================================================== 2 | # This file contains the default startup commands for ranger. 3 | # To change them, it is recommended to create either /etc/ranger/rc.conf 4 | # (system-wide) or ~/.config/ranger/rc.conf (per user) and add your custom 5 | # commands there. 6 | # 7 | # If you copy this whole file there, you may want to set the environment 8 | # variable RANGER_LOAD_DEFAULT_RC to FALSE to avoid loading it twice. 9 | # 10 | # The purpose of this file is mainly to define keybindings and settings. 11 | # For running more complex python code, please create a plugin in "plugins/" or 12 | # a command in "commands.py". 13 | # 14 | # Each line is a command that will be run before the user interface 15 | # is initialized. As a result, you can not use commands which rely 16 | # on the UI such as :delete or :mark. 17 | # =================================================================== 18 | 19 | # =================================================================== 20 | # == Options 21 | # =================================================================== 22 | 23 | # Which viewmode should be used? Possible values are: 24 | # miller: Use miller columns which show multiple levels of the hierarchy 25 | # multipane: Midnight-commander like multipane view showing all tabs next 26 | # to each other 27 | set viewmode miller 28 | #set viewmode multipane 29 | 30 | # How many columns are there, and what are their relative widths? 31 | set column_ratios 1,3,4 32 | 33 | # Which files should be hidden? (regular expression) 34 | set hidden_filter ^\.|\.(?:pyc|pyo|bak|swp)$|^lost\+found$|^__(py)?cache__$ 35 | 36 | # Show hidden files? You can toggle this by typing 'zh' 37 | set show_hidden true 38 | 39 | # Ask for a confirmation when running the "delete" command? 40 | # Valid values are "always", "never", "multiple" (default) 41 | # With "multiple", ranger will ask only if you delete multiple files at once. 42 | set confirm_on_delete multiple 43 | 44 | # Use non-default path for file preview script? 45 | # ranger ships with scope.sh, a script that calls external programs (see 46 | # README.md for dependencies) to preview images, archives, etc. 47 | set preview_script ~/.config/ranger/scope.sh 48 | 49 | # Use the external preview script or display simple plain text or image previews? 50 | set use_preview_script true 51 | 52 | # Automatically count files in the directory, even before entering them? 53 | set automatically_count_files true 54 | 55 | # Open all images in this directory when running certain image viewers 56 | # like feh or sxiv? You can still open selected files by marking them. 57 | set open_all_images true 58 | 59 | # Be aware of version control systems and display information. 60 | set vcs_aware true 61 | 62 | # State of the four backends git, hg, bzr, svn. The possible states are 63 | # disabled, local (only show local info), enabled (show local and remote 64 | # information). 65 | set vcs_backend_git enabled 66 | set vcs_backend_hg disabled 67 | set vcs_backend_bzr disabled 68 | set vcs_backend_svn disabled 69 | 70 | # Use one of the supported image preview protocols 71 | set preview_images false 72 | 73 | # Set the preview image method. Supported methods: 74 | # 75 | # * w3m (default): 76 | # Preview images in full color with the external command "w3mimgpreview"? 77 | # This requires the console web browser "w3m" and a supported terminal. 78 | # It has been successfully tested with "xterm" and "urxvt" without tmux. 79 | # 80 | # * iterm2: 81 | # Preview images in full color using iTerm2 image previews 82 | # (http://iterm2.com/images.html). This requires using iTerm2 compiled 83 | # with image preview support. 84 | # 85 | # This feature relies on the dimensions of the terminal's font. By default, a 86 | # width of 8 and height of 11 are used. To use other values, set the options 87 | # iterm2_font_width and iterm2_font_height to the desired values. 88 | # 89 | # * terminology: 90 | # Previews images in full color in the terminology terminal emulator. 91 | # Supports a wide variety of formats, even vector graphics like svg. 92 | # 93 | # * urxvt: 94 | # Preview images in full color using urxvt image backgrounds. This 95 | # requires using urxvt compiled with pixbuf support. 96 | # 97 | # * urxvt-full: 98 | # The same as urxvt but utilizing not only the preview pane but the 99 | # whole terminal window. 100 | # 101 | # * kitty: 102 | # Preview images in full color using kitty image protocol. 103 | # Requires python PIL or pillow library. 104 | # If ranger does not share the local filesystem with kitty 105 | # the transfer method is changed to encode the whole image; 106 | # while slower, this allows remote previews, 107 | # for example during an ssh session. 108 | # Tmux is unsupported. 109 | set preview_images_method w3m 110 | 111 | # Delay in seconds before displaying an image with the w3m method. 112 | # Increase it in case of experiencing display corruption. 113 | set w3m_delay 0.02 114 | 115 | # Default iTerm2 font size (see: preview_images_method: iterm2) 116 | set iterm2_font_width 8 117 | set iterm2_font_height 11 118 | 119 | # Use a unicode "..." character to mark cut-off filenames? 120 | set unicode_ellipsis true 121 | 122 | # BIDI support - try to properly display file names in RTL languages (Hebrew, Arabic). 123 | # Requires the python-bidi pip package 124 | set bidi_support true 125 | 126 | # Show dotfiles in the bookmark preview box? 127 | set show_hidden_bookmarks true 128 | 129 | # Which colorscheme to use? These colorschemes are available by default: 130 | # default, jungle, snow, solarized 131 | set colorscheme default 132 | 133 | # Preview files on the rightmost column? 134 | # And collapse (shrink) the last column if there is nothing to preview? 135 | set preview_files true 136 | set preview_directories true 137 | set collapse_preview true 138 | 139 | # Save the console history on exit? 140 | set save_console_history true 141 | 142 | # Draw the status bar on top of the browser window (default: bottom) 143 | set status_bar_on_top true 144 | 145 | # Draw a progress bar in the status bar which displays the average state of all 146 | # currently running tasks which support progress bars? 147 | set draw_progress_bar_in_status_bar true 148 | 149 | # Draw borders around columns? (separators, outline, both, or none) 150 | # Separators are vertical lines between columns. 151 | # Outline draws a box around all the columns. 152 | # Both combines the two. 153 | set draw_borders none 154 | 155 | # Display the directory name in tabs? 156 | set dirname_in_tabs true 157 | 158 | # Enable the mouse support? 159 | set mouse_enabled false 160 | 161 | # Display the file size in the main column or status bar? 162 | set display_size_in_main_column true 163 | set display_size_in_status_bar true 164 | 165 | # Display the free disk space in the status bar? 166 | set display_free_space_in_status_bar true 167 | 168 | # Display files tags in all columns or only in main column? 169 | set display_tags_in_all_columns true 170 | 171 | # Set a title for the window? 172 | set update_title true 173 | 174 | # Set the title to "ranger" in the tmux program? 175 | set update_tmux_title true 176 | 177 | # Shorten the title if it gets long? The number defines how many 178 | # directories are displayed at once, 0 turns off this feature. 179 | set shorten_title 3 180 | 181 | # Show hostname in titlebar? 182 | set hostname_in_titlebar true 183 | 184 | # Abbreviate $HOME with ~ in the titlebar (first line) of ranger? 185 | set tilde_in_titlebar true 186 | 187 | # How many directory-changes or console-commands should be kept in history? 188 | set max_history_size 20 189 | set max_console_history_size 50 190 | 191 | # Try to keep so much space between the top/bottom border when scrolling: 192 | set scroll_offset 3 193 | 194 | # Flush the input after each key hit? (Noticeable when ranger lags) 195 | set flushinput true 196 | 197 | # Padding on the right when there's no preview? 198 | # This allows you to click into the space to run the file. 199 | set padding_right true 200 | 201 | # Save bookmarks (used with mX and `X) instantly? 202 | # This helps to synchronize bookmarks between multiple ranger 203 | # instances but leads to *slight* performance loss. 204 | # When false, bookmarks are saved when ranger is exited. 205 | set autosave_bookmarks true 206 | 207 | # Save the "`" bookmark to disk. This can be used to switch to the last 208 | # directory by typing "``". 209 | set save_backtick_bookmark true 210 | 211 | # You can display the "real" cumulative size of directories by using the 212 | # command :get_cumulative_size or typing "dc". The size is expensive to 213 | # calculate and will not be updated automatically. You can choose 214 | # to update it automatically though by turning on this option: 215 | set autoupdate_cumulative_size false 216 | 217 | # Turning this on makes sense for screen readers: 218 | set show_cursor false 219 | 220 | # One of: size, natural, basename, atime, ctime, mtime, type, random 221 | set sort natural 222 | 223 | # Additional sorting options 224 | set sort_reverse false 225 | set sort_case_insensitive true 226 | set sort_directories_first true 227 | set sort_unicode false 228 | 229 | # Enable this if key combinations with the Alt Key don't work for you. 230 | # (Especially on xterm) 231 | set xterm_alt_key false 232 | 233 | # Whether to include bookmarks in cd command 234 | set cd_bookmarks true 235 | 236 | # Changes case sensitivity for the cd command tab completion 237 | set cd_tab_case sensitive 238 | 239 | # Use fuzzy tab completion with the "cd" command. For example, 240 | # ":cd /u/lo/b" expands to ":cd /usr/local/bin". 241 | set cd_tab_fuzzy false 242 | 243 | # Avoid previewing files larger than this size, in bytes. Use a value of 0 to 244 | # disable this feature. 245 | set preview_max_size 0 246 | 247 | # The key hint lists up to this size have their sublists expanded. 248 | # Otherwise the submaps are replaced with "...". 249 | set hint_collapse_threshold 10 250 | 251 | # Add the highlighted file to the path in the titlebar 252 | set show_selection_in_titlebar true 253 | 254 | # The delay that ranger idly waits for user input, in milliseconds, with a 255 | # resolution of 100ms. Lower delay reduces lag between directory updates but 256 | # increases CPU load. 257 | set idle_delay 2000 258 | 259 | # When the metadata manager module looks for metadata, should it only look for 260 | # a ".metadata.json" file in the current directory, or do a deep search and 261 | # check all directories above the current one as well? 262 | set metadata_deep_search false 263 | 264 | # Clear all existing filters when leaving a directory 265 | set clear_filters_on_dir_change false 266 | 267 | # Disable displaying line numbers in main column. 268 | # Possible values: false, absolute, relative. 269 | set line_numbers false 270 | 271 | # When line_numbers=relative show the absolute line number in the 272 | # current line. 273 | set relative_current_zero false 274 | 275 | # Start line numbers from 1 instead of 0 276 | set one_indexed false 277 | 278 | # Save tabs on exit 279 | set save_tabs_on_exit false 280 | 281 | # Enable scroll wrapping - moving down while on the last item will wrap around to 282 | # the top and vice versa. 283 | set wrap_scroll false 284 | 285 | # Set the global_inode_type_filter to nothing. Possible options: d, f and l for 286 | # directories, files and symlinks respectively. 287 | set global_inode_type_filter 288 | 289 | # This setting allows to freeze the list of files to save I/O bandwidth. It 290 | # should be 'false' during start-up, but you can toggle it by pressing F. 291 | set freeze_files false 292 | 293 | # =================================================================== 294 | # == Local Options 295 | # =================================================================== 296 | # You can set local options that only affect a single directory. 297 | 298 | # Examples: 299 | # setlocal path=~/downloads sort mtime 300 | 301 | # =================================================================== 302 | # == Command Aliases in the Console 303 | # =================================================================== 304 | 305 | alias e edit 306 | alias q quit 307 | alias q! quit! 308 | alias qa quitall 309 | alias qa! quitall! 310 | alias qall quitall 311 | alias qall! quitall! 312 | alias setl setlocal 313 | 314 | alias filter scout -prts 315 | alias find scout -aets 316 | alias mark scout -mr 317 | alias unmark scout -Mr 318 | alias search scout -rs 319 | alias search_inc scout -rts 320 | alias travel scout -aefklst 321 | 322 | # =================================================================== 323 | # == Define keys for the browser 324 | # =================================================================== 325 | 326 | # Basic 327 | map Q quitall 328 | map q quit 329 | copymap q ZZ ZQ 330 | 331 | map R reload_cwd 332 | map F set freeze_files! 333 | map reset 334 | map redraw_window 335 | map abort 336 | map change_mode normal 337 | map ~ set viewmode! 338 | 339 | map i display_file 340 | map ? help 341 | map W display_log 342 | map w taskview_open 343 | map S shell $SHELL 344 | 345 | map : console 346 | map ; console 347 | map ! console shell%space 348 | map @ console -p6 shell %%s 349 | map # console shell -p%space 350 | map s console shell%space 351 | map r chain draw_possible_programs; console open_with%%space 352 | map f console find%space 353 | map cd console cd%space 354 | 355 | map chain console; eval fm.ui.console.history_move(-1) 356 | 357 | # Change the line mode 358 | map Mf linemode filename 359 | map Mi linemode fileinfo 360 | map Mm linemode mtime 361 | map Mp linemode permissions 362 | map Ms linemode sizemtime 363 | map Mt linemode metatitle 364 | 365 | # Tagging / Marking 366 | map t tag_toggle 367 | map ut tag_remove 368 | map " tag_toggle tag=%any 369 | map mark_files toggle=True 370 | map v mark_files all=True toggle=True 371 | map uv mark_files all=True val=False 372 | map V toggle_visual_mode 373 | map uV toggle_visual_mode reverse=True 374 | 375 | # For the nostalgics: Midnight Commander bindings 376 | map help 377 | map rename_append 378 | map display_file 379 | map edit 380 | map copy 381 | map cut 382 | map console mkdir%space 383 | map console delete 384 | map exit 385 | 386 | # In case you work on a keyboard with dvorak layout 387 | map move up=1 388 | map move down=1 389 | map move left=1 390 | map move right=1 391 | map move to=0 392 | map move to=-1 393 | map move down=1 pages=True 394 | map move up=1 pages=True 395 | map move right=1 396 | #map console delete 397 | map console touch%space 398 | 399 | # VIM-like 400 | copymap k 401 | copymap j 402 | copymap h 403 | copymap l 404 | copymap gg 405 | copymap G 406 | copymap 407 | copymap 408 | 409 | map J move down=0.5 pages=True 410 | map K move up=0.5 pages=True 411 | copymap J 412 | copymap K 413 | 414 | # Jumping around 415 | map H history_go -1 416 | map L history_go 1 417 | map ] move_parent 1 418 | map [ move_parent -1 419 | map } traverse 420 | map { traverse_backwards 421 | map ) jump_non 422 | 423 | map gh cd ~ 424 | map ge cd /etc 425 | map gu cd /usr 426 | map gd cd /dev 427 | map gl cd -r . 428 | map gL cd -r %f 429 | map go cd /opt 430 | map gv cd /var 431 | map gm cd /media 432 | map gi eval fm.cd('/run/media/' + os.getenv('USER')) 433 | map gM cd /mnt 434 | map gs cd /srv 435 | map gp cd /tmp 436 | map gr cd / 437 | map gR eval fm.cd(ranger.RANGERDIR) 438 | map g/ cd / 439 | map g? cd /usr/share/doc/ranger 440 | 441 | # External Programs 442 | map E edit 443 | map du shell -p du --max-depth=1 -h --apparent-size 444 | map dU shell -p du --max-depth=1 -h --apparent-size | sort -rh 445 | map yp yank path 446 | map yd yank dir 447 | map yn yank name 448 | map y. yank name_without_extension 449 | 450 | # Tmux 451 | map ef shell tmux splitw -h 'nvim %f' 452 | 453 | # Filesystem Operations 454 | map = chmod 455 | 456 | map cw console rename%space 457 | map a rename_append 458 | map A eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%")) 459 | map I eval fm.open_console('rename ' + fm.thisfile.relative_path.replace("%", "%%"), position=7) 460 | 461 | map pp paste 462 | map po paste overwrite=True 463 | map pP paste append=True 464 | map pO paste overwrite=True append=True 465 | map pl paste_symlink relative=False 466 | map pL paste_symlink relative=True 467 | map phl paste_hardlink 468 | map pht paste_hardlinked_subtree 469 | 470 | map dD console delete 471 | 472 | map dd cut 473 | map ud uncut 474 | map da cut mode=add 475 | map dr cut mode=remove 476 | map dt cut mode=toggle 477 | 478 | map yy copy 479 | map uy uncut 480 | map ya copy mode=add 481 | map yr copy mode=remove 482 | map yt copy mode=toggle 483 | 484 | # Temporary workarounds 485 | map dgg eval fm.cut(dirarg=dict(to=0), narg=quantifier) 486 | map dG eval fm.cut(dirarg=dict(to=-1), narg=quantifier) 487 | map dj eval fm.cut(dirarg=dict(down=1), narg=quantifier) 488 | map dk eval fm.cut(dirarg=dict(up=1), narg=quantifier) 489 | map ygg eval fm.copy(dirarg=dict(to=0), narg=quantifier) 490 | map yG eval fm.copy(dirarg=dict(to=-1), narg=quantifier) 491 | map yj eval fm.copy(dirarg=dict(down=1), narg=quantifier) 492 | map yk eval fm.copy(dirarg=dict(up=1), narg=quantifier) 493 | 494 | # Searching 495 | map / console search%space 496 | map n search_next 497 | map N search_next forward=False 498 | map ct search_next order=tag 499 | map cs search_next order=size 500 | map ci search_next order=mimetype 501 | map cc search_next order=ctime 502 | map cm search_next order=mtime 503 | map ca search_next order=atime 504 | 505 | # Tabs 506 | map tab_new 507 | map tab_close 508 | map tab_move 1 509 | map tab_move -1 510 | map tab_move 1 511 | map tab_move -1 512 | map gt tab_move 1 513 | map gT tab_move -1 514 | map gn tab_new 515 | map gc tab_close 516 | map uq tab_restore 517 | map tab_open 1 518 | map tab_open 2 519 | map tab_open 3 520 | map tab_open 4 521 | map tab_open 5 522 | map tab_open 6 523 | map tab_open 7 524 | map tab_open 8 525 | map tab_open 9 526 | map tab_shift 1 527 | map tab_shift -1 528 | 529 | # Sorting 530 | map or set sort_reverse! 531 | map oz set sort=random 532 | map os chain set sort=size; set sort_reverse=False 533 | map ob chain set sort=basename; set sort_reverse=False 534 | map on chain set sort=natural; set sort_reverse=False 535 | map om chain set sort=mtime; set sort_reverse=False 536 | map oc chain set sort=ctime; set sort_reverse=False 537 | map oa chain set sort=atime; set sort_reverse=False 538 | map ot chain set sort=type; set sort_reverse=False 539 | map oe chain set sort=extension; set sort_reverse=False 540 | 541 | map oS chain set sort=size; set sort_reverse=True 542 | map oB chain set sort=basename; set sort_reverse=True 543 | map oN chain set sort=natural; set sort_reverse=True 544 | map oM chain set sort=mtime; set sort_reverse=True 545 | map oC chain set sort=ctime; set sort_reverse=True 546 | map oA chain set sort=atime; set sort_reverse=True 547 | map oT chain set sort=type; set sort_reverse=True 548 | map oE chain set sort=extension; set sort_reverse=True 549 | 550 | map dc get_cumulative_size 551 | 552 | # Settings 553 | map zc set collapse_preview! 554 | map zd set sort_directories_first! 555 | map zh set show_hidden! 556 | map set show_hidden! 557 | copymap 558 | copymap 559 | map zI set flushinput! 560 | map zi set preview_images! 561 | map zm set mouse_enabled! 562 | map zp set preview_files! 563 | map zP set preview_directories! 564 | map zs set sort_case_insensitive! 565 | map zu set autoupdate_cumulative_size! 566 | map zv set use_preview_script! 567 | map zf console filter%space 568 | copymap zf zz 569 | 570 | # Filter stack 571 | map .n console filter_stack add name%space 572 | map .m console filter_stack add mime%space 573 | map .d filter_stack add type d 574 | map .f filter_stack add type f 575 | map .l filter_stack add type l 576 | map .| filter_stack add or 577 | map .& filter_stack add and 578 | map .! filter_stack add not 579 | map .r console filter_stack rotate 580 | map .c filter_stack clear 581 | map .* filter_stack decompose 582 | map .p filter_stack pop 583 | map .. filter_stack show 584 | 585 | # Bookmarks 586 | map ` enter_bookmark %any 587 | map ' enter_bookmark %any 588 | map m set_bookmark %any 589 | map um unset_bookmark %any 590 | 591 | map m draw_bookmarks 592 | copymap m um ` ' 593 | 594 | # Generate all the chmod bindings with some python help: 595 | eval for arg in "rwxXst": cmd("map +u{0} shell -f chmod u+{0} %s".format(arg)) 596 | eval for arg in "rwxXst": cmd("map +g{0} shell -f chmod g+{0} %s".format(arg)) 597 | eval for arg in "rwxXst": cmd("map +o{0} shell -f chmod o+{0} %s".format(arg)) 598 | eval for arg in "rwxXst": cmd("map +a{0} shell -f chmod a+{0} %s".format(arg)) 599 | eval for arg in "rwxXst": cmd("map +{0} shell -f chmod u+{0} %s".format(arg)) 600 | 601 | eval for arg in "rwxXst": cmd("map -u{0} shell -f chmod u-{0} %s".format(arg)) 602 | eval for arg in "rwxXst": cmd("map -g{0} shell -f chmod g-{0} %s".format(arg)) 603 | eval for arg in "rwxXst": cmd("map -o{0} shell -f chmod o-{0} %s".format(arg)) 604 | eval for arg in "rwxXst": cmd("map -a{0} shell -f chmod a-{0} %s".format(arg)) 605 | eval for arg in "rwxXst": cmd("map -{0} shell -f chmod u-{0} %s".format(arg)) 606 | 607 | # =================================================================== 608 | # == Define keys for the console 609 | # =================================================================== 610 | # Note: Unmapped keys are passed directly to the console. 611 | 612 | # Basic 613 | cmap eval fm.ui.console.tab() 614 | cmap eval fm.ui.console.tab(-1) 615 | cmap eval fm.ui.console.close() 616 | cmap eval fm.ui.console.execute() 617 | cmap redraw_window 618 | 619 | copycmap 620 | copycmap 621 | 622 | # Move around 623 | cmap eval fm.ui.console.history_move(-1) 624 | cmap eval fm.ui.console.history_move(1) 625 | cmap eval fm.ui.console.move(left=1) 626 | cmap eval fm.ui.console.move(right=1) 627 | cmap eval fm.ui.console.move(right=0, absolute=True) 628 | cmap eval fm.ui.console.move(right=-1, absolute=True) 629 | cmap eval fm.ui.console.move_word(left=1) 630 | cmap eval fm.ui.console.move_word(right=1) 631 | 632 | copycmap 633 | copycmap 634 | 635 | # Line Editing 636 | cmap eval fm.ui.console.delete(-1) 637 | cmap eval fm.ui.console.delete(0) 638 | cmap eval fm.ui.console.delete_word() 639 | cmap eval fm.ui.console.delete_word(backward=False) 640 | cmap eval fm.ui.console.delete_rest(1) 641 | cmap eval fm.ui.console.delete_rest(-1) 642 | cmap eval fm.ui.console.paste() 643 | 644 | # And of course the emacs way 645 | copycmap 646 | copycmap 647 | copycmap 648 | copycmap 649 | copycmap 650 | copycmap 651 | copycmap 652 | copycmap 653 | copycmap 654 | 655 | # Note: There are multiple ways to express backspaces. (code 263) 656 | # and (code 127). To be sure, use both. 657 | copycmap 658 | 659 | # This special expression allows typing in numerals: 660 | cmap false 661 | 662 | # =================================================================== 663 | # == Pager Keybindings 664 | # =================================================================== 665 | 666 | # Movement 667 | pmap pager_move down=1 668 | pmap pager_move up=1 669 | pmap pager_move left=4 670 | pmap pager_move right=4 671 | pmap pager_move to=0 672 | pmap pager_move to=-1 673 | pmap pager_move down=1.0 pages=True 674 | pmap pager_move up=1.0 pages=True 675 | pmap pager_move down=0.5 pages=True 676 | pmap pager_move up=0.5 pages=True 677 | 678 | copypmap k 679 | copypmap j 680 | copypmap h 681 | copypmap l 682 | copypmap g 683 | copypmap G 684 | copypmap d 685 | copypmap u 686 | copypmap n f 687 | copypmap p b 688 | 689 | # Basic 690 | #pmap redraw_window 691 | pmap pager_close 692 | copypmap q Q i 693 | pmap E edit_file 694 | 695 | # =================================================================== 696 | # == Taskview Keybindings 697 | # =================================================================== 698 | 699 | # Movement 700 | tmap taskview_move up=1 701 | tmap taskview_move down=1 702 | tmap taskview_move to=0 703 | tmap taskview_move to=-1 704 | tmap taskview_move down=1.0 pages=True 705 | tmap taskview_move up=1.0 pages=True 706 | tmap taskview_move down=0.5 pages=True 707 | tmap taskview_move up=0.5 pages=True 708 | 709 | copytmap k 710 | copytmap j 711 | copytmap g 712 | copytmap G 713 | copytmap u 714 | copytmap n f 715 | copytmap p b 716 | 717 | # Changing priority and deleting tasks 718 | tmap J eval -q fm.ui.taskview.task_move(-1) 719 | tmap K eval -q fm.ui.taskview.task_move(0) 720 | tmap dd eval -q fm.ui.taskview.task_remove() 721 | tmap eval -q fm.ui.taskview.task_move(-1) 722 | tmap eval -q fm.ui.taskview.task_move(0) 723 | tmap eval -q fm.ui.taskview.task_remove() 724 | 725 | # Basic 726 | #tmap redraw_window 727 | tmap taskview_close 728 | copytmap q Q w 729 | --------------------------------------------------------------------------------