rearranging
This commit is contained in:
parent
b36f2ea8f6
commit
feda5db467
4 changed files with 198 additions and 7 deletions
13
vim/.vimrc
13
vim/.vimrc
|
@ -62,6 +62,13 @@ set mat=2
|
|||
"=> Functions
|
||||
set autowrite
|
||||
set mouse=a
|
||||
|
||||
"=> Leader
|
||||
" With a map leader it's possible to do extra key combinations
|
||||
" like <leader>w saves the current file
|
||||
let mapleader = ","
|
||||
let g:mapleader = ","
|
||||
|
||||
" :W sudo saves the file
|
||||
" (useful for handling the permission-denied error)
|
||||
command W w !sudo tee % > /dev/null
|
||||
|
@ -81,12 +88,6 @@ nnoremap <leader>a ggVG
|
|||
nnoremap <leader>P "0p
|
||||
vnoremap <leader>P "0p
|
||||
|
||||
"=> Leader
|
||||
" With a map leader it's possible to do extra key combinations
|
||||
" like <leader>w saves the current file
|
||||
let mapleader = ","
|
||||
let g:mapleader = ","
|
||||
|
||||
" => Visual mode related
|
||||
""""""""""""""""""""""""""""""
|
||||
" Visual mode pressing * or # searches for the current selection
|
||||
|
|
161
zsh/.zsh/complete.zsh
Normal file
161
zsh/.zsh/complete.zsh
Normal file
|
@ -0,0 +1,161 @@
|
|||
#
|
||||
# Sets completion options.
|
||||
#
|
||||
# Authors:
|
||||
# Robby Russell <robby@planetargon.com>
|
||||
# Sorin Ionescu <sorin.ionescu@gmail.com>
|
||||
#
|
||||
|
||||
# Return if requirements are not found.
|
||||
if [[ "$TERM" == 'dumb' ]]; then
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Add zsh-completions to $fpath.
|
||||
fpath=("${0:h}/external/src" $fpath)
|
||||
|
||||
#
|
||||
# Options
|
||||
#
|
||||
|
||||
setopt COMPLETE_IN_WORD # Complete from both ends of a word.
|
||||
setopt ALWAYS_TO_END # Move cursor to the end of a completed word.
|
||||
setopt PATH_DIRS # Perform path search even on command names with slashes.
|
||||
setopt AUTO_MENU # Show completion menu on a successive tab press.
|
||||
setopt AUTO_LIST # Automatically list choices on ambiguous completion.
|
||||
setopt AUTO_PARAM_SLASH # If completed parameter is a directory, add a trailing slash.
|
||||
setopt EXTENDED_GLOB # Needed for file modification glob modifiers with compinit
|
||||
unsetopt MENU_COMPLETE # Do not autoselect the first completion entry.
|
||||
unsetopt FLOW_CONTROL # Disable start/stop characters in shell editor.
|
||||
|
||||
# Load and initialize the completion system ignoring insecure directories with a
|
||||
# cache time of 20 hours, so it should almost always regenerate the first time a
|
||||
# shell is opened each day.
|
||||
autoload -Uz compinit
|
||||
_comp_files=(${ZDOTDIR:-$HOME}/.zcompdump(Nm-20))
|
||||
if (( $#_comp_files )); then
|
||||
compinit -i -C
|
||||
else
|
||||
compinit -i
|
||||
fi
|
||||
unset _comp_files
|
||||
|
||||
#
|
||||
# Styles
|
||||
#
|
||||
|
||||
# Use caching to make completion for commands such as dpkg and apt usable.
|
||||
zstyle ':completion::complete:*' use-cache on
|
||||
zstyle ':completion::complete:*' cache-path "${ZDOTDIR:-$HOME}/.zcompcache"
|
||||
|
||||
# Case-insensitive (all), partial-word, and then substring completion.
|
||||
if zstyle -t ':prezto:module:completion:*' case-sensitive; then
|
||||
zstyle ':completion:*' matcher-list 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||
setopt CASE_GLOB
|
||||
else
|
||||
zstyle ':completion:*' matcher-list 'm:{a-zA-Z}={A-Za-z}' 'r:|[._-]=* r:|=*' 'l:|=* r:|=*'
|
||||
unsetopt CASE_GLOB
|
||||
fi
|
||||
|
||||
# Group matches and describe.
|
||||
zstyle ':completion:*:*:*:*:*' menu select
|
||||
zstyle ':completion:*:matches' group 'yes'
|
||||
zstyle ':completion:*:options' description 'yes'
|
||||
zstyle ':completion:*:options' auto-description '%d'
|
||||
zstyle ':completion:*:corrections' format ' %F{green}-- %d (errors: %e) --%f'
|
||||
zstyle ':completion:*:descriptions' format ' %F{yellow}-- %d --%f'
|
||||
zstyle ':completion:*:messages' format ' %F{purple} -- %d --%f'
|
||||
zstyle ':completion:*:warnings' format ' %F{red}-- no matches found --%f'
|
||||
zstyle ':completion:*:default' list-prompt '%S%M matches%s'
|
||||
zstyle ':completion:*' format ' %F{yellow}-- %d --%f'
|
||||
zstyle ':completion:*' group-name ''
|
||||
zstyle ':completion:*' verbose yes
|
||||
|
||||
# Fuzzy match mistyped completions.
|
||||
zstyle ':completion:*' completer _complete _match _approximate
|
||||
zstyle ':completion:*:match:*' original only
|
||||
zstyle ':completion:*:approximate:*' max-errors 1 numeric
|
||||
|
||||
# Increase the number of errors based on the length of the typed word. But make
|
||||
# sure to cap (at 7) the max-errors to avoid hanging.
|
||||
zstyle -e ':completion:*:approximate:*' max-errors 'reply=($((($#PREFIX+$#SUFFIX)/3>7?7:($#PREFIX+$#SUFFIX)/3))numeric)'
|
||||
|
||||
# Don't complete unavailable commands.
|
||||
zstyle ':completion:*:functions' ignored-patterns '(_*|pre(cmd|exec))'
|
||||
|
||||
# Array completion element sorting.
|
||||
zstyle ':completion:*:*:-subscript-:*' tag-order indexes parameters
|
||||
|
||||
# Directories
|
||||
zstyle ':completion:*:default' list-colors ${(s.:.)LS_COLORS}
|
||||
zstyle ':completion:*:*:cd:*' tag-order local-directories directory-stack path-directories
|
||||
zstyle ':completion:*:*:cd:*:directory-stack' menu yes select
|
||||
zstyle ':completion:*:-tilde-:*' group-order 'named-directories' 'path-directories' 'users' 'expand'
|
||||
zstyle ':completion:*' squeeze-slashes true
|
||||
|
||||
# History
|
||||
zstyle ':completion:*:history-words' stop yes
|
||||
zstyle ':completion:*:history-words' remove-all-dups yes
|
||||
zstyle ':completion:*:history-words' list false
|
||||
zstyle ':completion:*:history-words' menu yes
|
||||
|
||||
# Environmental Variables
|
||||
zstyle ':completion::*:(-command-|export):*' fake-parameters ${${${_comps[(I)-value-*]#*,}%%,*}:#-*-}
|
||||
|
||||
# Populate hostname completion. But allow ignoring custom entries from static
|
||||
# */etc/hosts* which might be uninteresting.
|
||||
zstyle -a ':prezto:module:completion:*:hosts' etc-host-ignores '_etc_host_ignores'
|
||||
|
||||
zstyle -e ':completion:*:hosts' hosts 'reply=(
|
||||
${=${=${=${${(f)"$(cat {/etc/ssh_,~/.ssh/known_}hosts(|2)(N) 2> /dev/null)"}%%[#| ]*}//\]:[0-9]*/ }//,/ }//\[/ }
|
||||
${=${(f)"$(cat /etc/hosts(|)(N) <<(ypcat hosts 2> /dev/null))"}%%(\#${_etc_host_ignores:+|${(j:|:)~_etc_host_ignores}})*}
|
||||
${=${${${${(@M)${(f)"$(cat ~/.ssh/config 2> /dev/null)"}:#Host *}#Host }:#*\**}:#*\?*}}
|
||||
)'
|
||||
|
||||
# Don't complete uninteresting users...
|
||||
zstyle ':completion:*:*:*:users' ignored-patterns \
|
||||
adm amanda apache avahi beaglidx bin cacti canna clamav daemon \
|
||||
dbus distcache dovecot fax ftp games gdm gkrellmd gopher \
|
||||
hacluster haldaemon halt hsqldb ident junkbust ldap lp mail \
|
||||
mailman mailnull mldonkey mysql nagios \
|
||||
named netdump news nfsnobody nobody nscd ntp nut nx openvpn \
|
||||
operator pcap postfix postgres privoxy pulse pvm quagga radvd \
|
||||
rpc rpcuser rpm shutdown squid sshd sync uucp vcsa xfs '_*'
|
||||
|
||||
# ... unless we really want to.
|
||||
zstyle '*' single-ignored show
|
||||
|
||||
# Ignore multiple entries.
|
||||
zstyle ':completion:*:(rm|kill|diff):*' ignore-line other
|
||||
zstyle ':completion:*:rm:*' file-patterns '*:all-files'
|
||||
|
||||
# Kill
|
||||
zstyle ':completion:*:*:*:*:processes' command 'ps -u $LOGNAME -o pid,user,command -w'
|
||||
zstyle ':completion:*:*:kill:*:processes' list-colors '=(#b) #([0-9]#) ([0-9a-z-]#)*=01;36=0=01'
|
||||
zstyle ':completion:*:*:kill:*' menu yes select
|
||||
zstyle ':completion:*:*:kill:*' force-list always
|
||||
zstyle ':completion:*:*:kill:*' insert-ids single
|
||||
|
||||
# Man
|
||||
zstyle ':completion:*:manuals' separate-sections true
|
||||
zstyle ':completion:*:manuals.(^1*)' insert-sections true
|
||||
|
||||
# Media Players
|
||||
zstyle ':completion:*:*:mpg123:*' file-patterns '*.(mp3|MP3):mp3\ files *(-/):directories'
|
||||
zstyle ':completion:*:*:mpg321:*' file-patterns '*.(mp3|MP3):mp3\ files *(-/):directories'
|
||||
zstyle ':completion:*:*:ogg123:*' file-patterns '*.(ogg|OGG|flac):ogg\ files *(-/):directories'
|
||||
zstyle ':completion:*:*:mocp:*' file-patterns '*.(wav|WAV|mp3|MP3|ogg|OGG|flac):ogg\ files *(-/):directories'
|
||||
|
||||
# Mutt
|
||||
if [[ -s "$HOME/.mutt/aliases" ]]; then
|
||||
zstyle ':completion:*:*:mutt:*' menu yes select
|
||||
zstyle ':completion:*:mutt:*' users ${${${(f)"$(<"$HOME/.mutt/aliases")"}#alias[[:space:]]}%%[[:space:]]*}
|
||||
fi
|
||||
|
||||
# SSH/SCP/RSYNC
|
||||
zstyle ':completion:*:(ssh|scp|rsync):*' tag-order 'hosts:-host:host hosts:-domain:domain hosts:-ipaddr:ip\ address *'
|
||||
zstyle ':completion:*:(scp|rsync):*' group-order users files all-files hosts-domain hosts-host hosts-ipaddr
|
||||
zstyle ':completion:*:ssh:*' group-order users hosts-domain hosts-host users hosts-ipaddr
|
||||
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-host' ignored-patterns '*(.|:)*' loopback ip6-loopback localhost ip6-localhost broadcasthost
|
||||
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-domain' ignored-patterns '<->.<->.<->.<->' '^[-[:alnum:]]##(.[-[:alnum:]]##)##' '*@*'
|
||||
zstyle ':completion:*:(ssh|scp|rsync):*:hosts-ipaddr' ignored-patterns '^(<->.<->.<->.<->|(|::)([[:xdigit:].]##:(#c,2))##(|%*))' '127.0.0.<->' '255.255.255.255' '::1' 'fe80::*'
|
30
zsh/.zsh/systemd.zsh
Normal file
30
zsh/.zsh/systemd.zsh
Normal file
|
@ -0,0 +1,30 @@
|
|||
#
|
||||
# Defines systemctl aliases.
|
||||
#
|
||||
# Authors:
|
||||
# Augusto Rocha Elesbão <aelesbao@gmail.com>
|
||||
#
|
||||
|
||||
# Return if requirements are not found.
|
||||
if (( ! $+commands[systemctl] )); then
|
||||
return 1
|
||||
fi
|
||||
|
||||
user_commands=(
|
||||
list-units is-active status show help list-unit-files
|
||||
is-enabled list-jobs show-environment
|
||||
)
|
||||
|
||||
for c in $user_commands; do; alias sc-$c="systemctl $c"; done
|
||||
|
||||
unset user_commands
|
||||
|
||||
sudo_commands=(
|
||||
start stop reload restart try-restart isolate kill
|
||||
reset-failed enable disable reenable preset mask unmask
|
||||
link load cancel set-environment unset-environment
|
||||
)
|
||||
|
||||
for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done
|
||||
|
||||
unset sudo_commands
|
|
@ -9,7 +9,6 @@ setopt path_dirs
|
|||
setopt prompt_subst
|
||||
setopt nonomatch
|
||||
setopt automenu
|
||||
setopt prompt_subst
|
||||
|
||||
#Load libraries
|
||||
for f in ~/.zsh/*.zsh; do
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue