Updated vimrc, i3, and zsh configs, minor updates to others

This commit is contained in:
Mike Cugini 2018-08-06 10:58:32 -04:00
parent 4f90a6ad06
commit 1020685fcb
9 changed files with 454 additions and 356 deletions

View File

@ -1,56 +1,9 @@
! DPI settings ! DPI settings
Xft.dpi: 276 Xft.dpi: 276
!Xft.dpi: 220
Xft.autohint: 0 Xft.autohint: 0
Xft.lcdfilter: lcddefault Xft.lcdfilter: lcddefault
Xft.hintstyle: hintfull Xft.hintstyle: hintfull
Xft.hinting: 1 Xft.hinting: 1
Xft.antialias: 1 Xft.antialias: 1
Xft.rgba: rgb Xft.rgba: rgb
! urxvt config
URxvt.scrollBar: False
!URxvt.font: xft:Source Code Pro:size=10
URxvt.font: xft:Inconsolata :size=10
URxvt.perl-ext-common: default,clipboard
URxvt.keysym.M-c: perl:clipboard:copy
URxvt.keysym.M-v: perl:clipboard:paste
URxvt.keysym.M-C-c: perl:clipboard:paste_escaped
! terminal colours
URxvt.foreground:#a0a0a0
URxvt.background:#1b1d1e
!molokai inspired colors
!!black
URxvt.color0: #1b1d1e
URxvt.color8: #505354
!red
URxvt.color1: #f92672
URxvt.color9: #ff5995
!green
URxvt.color2: #82b414
URxvt.color10: #b6e354
!yellow
URxvt.color3: #fd971f
URxvt.color11: #feed6c
!blue
URxvt.color4: #56c2d6
URxvt.color12: #8cedff
!magenta
URxvt.color5: #8c54fe
URxvt.color13: #9e6ffe
!cyan
URxvt.color6: #465457
URxvt.color14: #899ca1
!white
URxvt.color7: #ccccc6
URxvt.color15: #f8f8f2

View File

@ -8,9 +8,19 @@
# i3 config file (v4) # i3 config file (v4)
# #
# Please see http://i3wm.org/docs/userguide.html for a complete reference! # Please see http://i3wm.org/docs/userguide.html for a complete reference!
set $mod Mod4 set $mod Mod4
exec --no-startup-id /usr/bin/unity-settings-daemon
exec xrandr --dpi 200 #109 #200 # 163
exec compton -CGb
exec --no-startup-id feh --bg-fill ~/Pictures/dark_spots_texture_background_50355_3840x2160.jpg
exec --no-startup-id "xautolock -time 10 -locker 'i3lock -e -i /home/cugini/Pictures/dark_spots_texture_background_50355_3840x2160.png'"
exec synclient TapButton3=2 ClickFinger3=2
exec --no-startup-id nm-applet
exec --no-startup-id udiskie -t
exec --no-startup-id dropbox start
# Font for window titles. Will also be used by the bar unless a different font # Font for window titles. Will also be used by the bar unless a different font
# is used in the bar {} block below. # is used in the bar {} block below.
#font pango:M+ 1m, FontAwesome, monospace 8 #font pango:M+ 1m, FontAwesome, monospace 8
@ -31,7 +41,8 @@ bindsym $mod+Return exec st
bindsym $mod+Shift+q kill bindsym $mod+Shift+q kill
# start dmenu (a program launcher) # start dmenu (a program launcher)
bindsym $mod+d exec dmenu_run -fn 'Monotype Noto Sans-8' bindsym $mod+d exec dmenu_run -fn 'Monotype Noto Sans-10'
#bindsym $mod+d exec --no-startup-id i3-dmenu-desktop --dmenu="dmenu_run -fn 'Monotype Noto Sans-8'"
# There also is the (new) i3-dmenu-desktop which only displays applications # There also is the (new) i3-dmenu-desktop which only displays applications
# shipping a .desktop file. It is a wrapper around dmenu, so you need that # shipping a .desktop file. It is a wrapper around dmenu, so you need that
# installed. # installed.
@ -120,7 +131,7 @@ bindsym $mod+Control+l move workspace to output right
# scratchpad setup # scratchpad setup
# make current window a scratchpad # make current window to scratchpad
bindsym $mod+Shift+minus move scratchpad bindsym $mod+Shift+minus move scratchpad
# show the first scratchpad window # show the first scratchpad window
@ -157,22 +168,29 @@ mode "resize" {
bindsym Escape mode "default" bindsym Escape mode "default"
} }
bindsym $mod+r mode "resize" #bindsym $mod+r mode "resize"
# Start i3bar to display a workspace bar (plus the system information i3status # Start i3bar to display a workspace bar (plus the system information i3status
# finds out, if available) # finds out, if available)
bar { bar {
status_command i3status #status_command i3status
status_command i3status | ~/bin/my_i3status.py
} }
# brightness control bindsym XF86AudioPlay exec playerctl play-pause && killall -USR1 i3status
bindsym XF86MonBrightnessDown exec xbacklight -steps 1 -time 0 -dec 5 bindsym XF86AudioPrev exec playerctl previous
bindsym XF86MonBrightnessUp exec xbacklight -steps 1 -time 0 -inc 10 bindsym XF86AudioNext exec playerctl next
bindsym XF86AudioRaiseVolume exec amixer -q set Master 4%+ unmute && killall -USR1 i3status # brightness control
bindsym XF86AudioLowerVolume exec amixer -q set Master 4%- unmute && killall -USR1 i3status bindsym XF86MonBrightnessDown exec xbacklight -time 100 -dec 5
bindsym XF86AudioMute exec amixer -q set Master toggle && killall -USR1 i3status bindsym XF86MonBrightnessUp exec xbacklight -time 200 -inc 10
bindsym XF86AudioRaiseVolume exec ~/bin/raise_volume && killall -USR1 i3status
bindsym XF86AudioLowerVolume exec ~/bin/lower_volume && killall -USR1 i3status
bindsym XF86AudioMute exec pactl set-sink-mute @DEFAULT_SINK@ toggle && killall -USR1 i3status
#lock and suspend #lock and suspend
bindsym $mod+p exec i3lock #bindsym $mod+p exec i3lock
# bindsym $mod+p exec xdg-screensaver lock
bindsym $mod+p exec dm-tool lock
bindsym $mod+Shift+p exec systemctl suspend bindsym $mod+Shift+p exec systemctl suspend

View File

@ -7,6 +7,7 @@
# If the above line is not correctly displayed, fix your editor first! # If the above line is not correctly displayed, fix your editor first!
general { general {
output_format="i3bar"
colors = true colors = true
interval = 5 interval = 5
} }
@ -14,19 +15,20 @@ general {
order += "volume master" order += "volume master"
order += "disk /" order += "disk /"
#order += "run_watch DHCP" #order += "run_watch DHCP"
#order += "run_watch VPN" order += "path_exists VPN"
order += "wireless _first_" order += "wireless _first_"
#order += "ethernet _first_" order += "ethernet _first_"
order += "battery 0" order += "battery 0"
order += "load" order += "load"
order += "tztime local" order += "tztime local"
order += "tztime utc"
volume master { volume master {
format = " %volume" format = " %volume"
format_muted = " %volume" format_muted = " %volume"
device = "default" device = "default"
mixer = "Master" mixer = "Master"
mixer_idx = 0 mixer_idx = 0
} }
wireless _first_ { wireless _first_ {
@ -44,24 +46,35 @@ ethernet _first_ {
battery 0 { battery 0 {
format = "%status %percentage %remaining" format = "%status %percentage %remaining"
status_bat = "" status_bat = ""
status_chr = "" status_chr = ""
status_full = "" status_full = ""
#status_full = "" #status_full = ""
hide_seconds = true hide_seconds = true
integer_battery_capacity = true integer_battery_capacity = true
} }
run_watch DHCP { run_watch DHCP {
pidfile = "/var/run/dhclient*.pid" pidfile = "/var/run/dhclient*.pid"
} }
run_watch VPN { #run_watch VPN {
pidfile = "/var/run/vpnc/pid" # pidfile = "/var/run/vpnc/pid"
#}
path_exists VPN {
#path = "/proc/sys/net/ipv4/conf/vpn0"
path = "/proc/sys/net/ipv4/conf/tun0"
} }
tztime local { tztime local {
format = "%Y-%m-%d %I:%M:%S %p" format = "%Y-%m-%d %I:%M:%S %p"
timezone = "US/Eastern"
}
tztime utc {
format = "%Z: %H:%M"
timezone = "Etc/UTC"
} }
load { load {

View File

@ -1,6 +1,8 @@
# setup 256 color # setup 256 color
set -g default-terminal "screen-256color" set -g default-terminal "screen-256color"
set -ga terminal-overrides ",st-256color:Tc"
# increase scrollback # increase scrollback
set -g history-limit 10000 set -g history-limit 10000

224
vimrc
View File

@ -5,12 +5,23 @@ call pathogen#infect()
set nocompatible set nocompatible
set encoding=utf-8 set encoding=utf-8
set shortmess+=c
set showcmd set showcmd
set noshowmode
set completeopt-=preview
set completeopt+=noinsert
set completeopt+=noselect
if has("termguicolors")
set termguicolors
endif
set background=dark set background=dark
set termguicolors "colorscheme molokai "gruvbox zenburn
colorscheme molokai "gruvbox zenburn " colorscheme material-monokai
let g:molokai_original = 1 "let g:molokai_original = 1
colorscheme deep-space
"always show status bar "always show status bar
set laststatus=2 set laststatus=2
@ -20,51 +31,15 @@ syntax enable
filetype plugin on filetype plugin on
filetype plugin indent on filetype plugin indent on
"Go specific settings
set rtp+=$GOROOT/misc/vim
au BufRead,BufNewFile *.go set list noexpandtab syntax=go listchars=tab:\|\ ,trail:-
set completeopt-=preview
function! InsertTabWrapper()
if pumvisible()
return "\<c-n>"
endif
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-x>\<c-o>"
endif
endfunction
inoremap <expr><tab> InsertTabWrapper()
inoremap <expr><s-tab> pumvisible()?"\<c-p>":"\<c-d>"
let g:deoplete#enable_at_startup = 1
let g:syntastic_go_checkers = ['go', 'goimports', 'govet', 'golint']
let g:deoplete#sources#go#gocode_binary = '~/bin/gocode'
let g:deoplete#sources#go#use_cache = 1
let g:deoplete#sources#go#json_directory = '~/.cache/deoplete/go/$GOOS_$GOARCH'
let g:go_fmt_command = "goimports"
let g:go_highlight_functions = 1
let g:go_highlight_methods = 1
let g:go_highlight_fields = 1
let g:go_highlight_structs = 1
let g:go_highlight_interfaces = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
if filereadable(expand("~/.vim/local.vim"))
source ~/.vim/local.vim
endif
"indent and tab "indent and tab
set nowrap set nowrap
set expandtab set expandtab
set tabstop=4 shiftwidth=4 softtabstop=4 set tabstop=4 shiftwidth=4 softtabstop=4
set backspace=indent,eol,start set backspace=indent,eol,start
"turn paste mode on and off with F3
set pastetoggle=<F3>
"search "search
set hlsearch set hlsearch
set incsearch set incsearch
@ -79,54 +54,129 @@ set wildmode=longest:full,full
nnoremap <space> za nnoremap <space> za
vnoremap <space> zf vnoremap <space> zf
"turn paste mode on and off with F3 "Better split navigation
set pastetoggle=<F3> nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
set splitbelow
set splitright
function! s:goyo_enter()
set wrap
Limelight
endfunction
function! s:goyo_leave()
set nowrap
Limelight!
endfunction
autocmd! User GoyoEnter nested call <SID>goyo_enter()
autocmd! User GoyoLeave nested call <SID>goyo_leave()
au BufRead,BufNewFile *.txt :Goyo
let g:goyo_width = 120
" choose the fastest available searcher
if executable('rg')
let g:ctrlp_user_command = 'rg --files %s'
set grepprg=rg\ --no-heading\ --vimgrep\ --smart-case
elseif executable('ag')
let g:ctrlp_user_command = 'ag %s -l --nocolor -g ""'
set grepprg=ag\ --nogroup\ --nocolor
endif
" vim-signify
let g:signify_vcs_list = [ 'git', 'hg' ]
let g:signify_sign_change = "~"
"Go specific settings
set rtp+=$GOROOT/misc/vim
au BufRead,BufNewFile *.go set list noexpandtab syntax=go listchars=tab:\|\ ,trail:-
autocmd FileType go map <buffer> <c-d> :GoDoc<CR>
" FZF
set rtp+=$HOME/.fzf
command! -bang -nargs=* RgFzf
\ call fzf#run(fzf#wrap('rgfzf', {'source': "rg --files"}, <bang>0))
" nmap <c-p> :Files<CR>
nmap <c-p> :RgFzf<CR>
nnoremap <C-g>b :Buffers<CR>
nnoremap <C-g>g :Rg<CR>
nnoremap <C-g>l :BLines<CR>
nnoremap <C-g>c :Commands<CR>
" use ripgrep instead of ag/grep
command! -bang -nargs=* Rg
\ call fzf#vim#grep(
\ 'rg --column --line-number --no-heading --color=always '.shellescape(<q-args>), 1,
\ <bang>0 ? fzf#vim#with_preview('up:60%')
\ : fzf#vim#with_preview('right:50%:hidden', '?'),
\ <bang>0)
function! InsertTabWrapper()
if pumvisible()
return "\<c-n>"
endif
let col = col('.') - 1
if !col || getline('.')[col - 1] !~ '\k'
return "\<tab>"
else
return "\<c-x>\<c-o>"
endif
endfunction
inoremap <expr><tab> InsertTabWrapper()
inoremap <expr><s-tab> pumvisible()?"\<c-p>":"\<c-d>"
" let g:LanguageClient_serverCommands = {
" \ 'python': ['pyls'],
" \ }
let g:go_fmt_command = "goimports"
let g:syntastic_go_checkers = ['go', 'goimports', 'govet', 'golint']
let g:go_highlight_functions = 1
let g:go_highlight_function_calls = 1
let g:go_highlight_methods = 1
let g:go_highlight_types = 1
let g:go_highlight_fields = 1
let g:go_highlight_operators = 1
let g:go_highlight_build_constraints = 1
"let g:go_highlight_variable_declarations = 1
"let g:go_highlight_variable_assignments = 1
" vim-jedi settings
" disable vim-jedi autocomplete as we get it with deoplete-jedi
" but we want all the other functionality
let g:jedi#completions_enabled = 0
let g:jedi#use_splits_not_buffers = 'winwidth'
" deoplete configuration
let g:deoplete#enable_at_startup = 1
" deoplete Go
let g:deoplete#sources#go#sort_class = ['package', 'func', 'type', 'var', 'const']
let g:deoplete#sources#go#gocode_binary = '/home/cugini/go/bin/gocode'
let g:deoplete#sources#go#use_cache = 1
let g:deoplete#sources#go#json_directory = '~/.cache/deoplete/go/$GOOS_$GOARCH'
" deoplete Rust
let g:deoplete#sources#rust#racer_binary = '/home/cugini/.cargo/bin/racer'
let g:deoplete#sources#rust#rust_source_path = '/home/cugini/Projects/rust/src'
" deoplete Python (jedi)
let g:deoplete#sources#jedi#python_path = '/usr/drte/v1/python-2.7.7/bin/python2.7'
let g:deoplete#sources#jedi#extra_path = ['/home/cugini/src/server','/home/cugini/src/server/pip']
"configure tagbar "configure tagbar
nmap <F8> :TagbarToggle<CR> nmap <F8> :TagbarToggle<CR>
let g:tagbar_width = 60 let g:tagbar_width = 60
let g:tagbar_sort = 0 let g:tagbar_sort = 0
let g:tagbar_type_scala = { if filereadable(expand("~/.vim/local.vim"))
\ 'ctagstype' : 'Scala', source ~/.vim/local.vim
\ 'kinds' : [ endif
\ 'p:packages:1',
\ 'V:values',
\ 'v:variables',
\ 'T:types',
\ 't:traits',
\ 'o:objects',
\ 'a:aclasses',
\ 'c:classes',
\ 'r:cclasses',
\ 'm:methods'
\ ]
\ }
let g:tagbar_type_go = {
\ 'ctagstype' : 'go',
\ 'kinds' : [
\ 'p:package',
\ 'i:imports:1',
\ 'c:constants',
\ 'v:variables',
\ 't:types',
\ 'n:interfaces',
\ 'w:fields',
\ 'e:embedded',
\ 'm:methods',
\ 'r:constructor',
\ 'f:functions'
\ ],
\ 'sro' : '.',
\ 'kind2scope' : {
\ 't' : 'ctype',
\ 'n' : 'ntype'
\ },
\ 'scope2kind' : {
\ 'ctype' : 't',
\ 'ntype' : 'n'
\ },
\ 'ctagsbin' : 'gotags',
\ 'ctagsargs' : '-sort -silent'
\ }

View File

@ -1,125 +1,255 @@
#compdef rg #compdef rg
##
# zsh completion function for ripgrep
#
# Run ci/test_complete.sh after building to ensure that the options supported by
# this function stay in synch with the `rg` binary.
#
# @see https://github.com/zsh-users/zsh/blob/master/Etc/completion-style-guide
#
# Based on code from the zsh-users project — see copyright notice below.
_rg() { _rg() {
typeset -A opt_args local state_descr ret curcontext="${curcontext:-}"
local ret=1 local -a context line state
local -A opt_args val_args
local -a rg_args
local context curcontext="$curcontext" state line # Sort by long option name to match `rg --help`
_arguments -s -S -C \ rg_args=(
"*-e+[A regular expression used for searching.]" \ '(-A -C --after-context --context)'{-A+,--after-context=}'[specify lines to show after each match]:number of lines'
"*--regexp+[A regular expression used for searching.]" \ '(-B -C --before-context --context)'{-B+,--before-context=}'[specify lines to show before each match]:number of lines'
"--color+[When to use color. \[default: auto\]]: :(never auto always ansi)" \ '(-i -s -S --ignore-case --case-sensitive --smart-case)'{-s,--case-sensitive}'[search case-sensitively]'
"*--colors+[Configure color settings and styles.]" \ '--color=[specify when to use colors in output]:when:( never auto always ansi )'
"-E+[Specify the text encoding of files to search.]" \ '*--colors=[specify color settings and styles]: :->colorspec'
"--encoding+[Specify the text encoding of files to search.]" \ '--column[show column numbers]'
"*-g+[Include or exclude files/directories.]" \ '(-A -B -C --after-context --before-context --context)'{-C+,--context=}'[specify lines to show before and after each match]:number of lines'
"*--glob+[Include or exclude files/directories.]" \ '--context-separator=[specify string used to separate non-continuous context lines in output]:separator'
"*-t+[Only search files matching TYPE.]" \ '(-c --count)'{-c,--count}'[only show count of matches for each file]'
"*--type+[Only search files matching TYPE.]" \ '--debug[show debug messages]'
"*-T+[Do not search files matching TYPE.]" \ '--dfa-size-limit=[specify upper size limit of generated DFA]:DFA size'
"*--type-not+[Do not search files matching TYPE.]" \ '(-E --encoding)'{-E+,--encoding=}'[specify text encoding of files to search]: :_rg_encodings'
"-A+[Show NUM lines after each match.]" \ '*'{-f+,--file=}'[specify file containing patterns to search for]:file:_files'
"--after-context+[Show NUM lines after each match.]" \ "(1)--files[show each file that would be searched (but don't search)]"
"-B+[Show NUM lines before each match.]" \ '(-l --files-with-matches --files-without-match)'{-l,--files-with-matches}'[only show names of files with matches]'
"--before-context+[Show NUM lines before each match.]" \ '(-l --files-with-matches --files-without-match)--files-without-match[only show names of files without matches]'
"-C+[Show NUM lines before and after each match.]" \ '(-F --fixed-strings)'{-F,--fixed-strings}'[treat pattern as literal string instead of regular expression]'
"--context+[Show NUM lines before and after each match.]" \ '(-L --follow)'{-L,--follow}'[follow symlinks]'
"--context-separator+[Set the context separator string. \[default: --\]]" \ '*'{-g+,--glob=}'[include or exclude files for searching that match the specified glob]:glob'
"--dfa-size-limit+[The upper size limit of the generated dfa.]" \ '(: -)'{-h,--help}'[display help information]'
"*-f+[Search for patterns from the given file.]" \ '(-p --no-heading --pretty --vimgrep)--heading[show matches grouped by file name]'
"*--file+[Search for patterns from the given file.]" \ '--hidden[search hidden files and directories]'
"*--ignore-file+[Specify additional ignore files.]" \ '*--iglob=[include or exclude files for searching that match the specified case-insensitive glob]:glob'
"-m+[Limit the number of matches.]" \ '(-i -s -S --case-sensitive --ignore-case --smart-case)'{-i,--ignore-case}'[search case-insensitively]'
"--max-count+[Limit the number of matches.]" \ '--ignore-file=[specify additional ignore file]:file:_files'
"--max-filesize+[Ignore files larger than NUM in size.]" \ '(-v --invert-match)'{-v,--invert-match}'[invert matching]'
"--maxdepth+[Descend at most NUM directories.]" \ '(-n -N --line-number --no-line-number)'{-n,--line-number}'[show line numbers]'
"--path-separator+[Path separator to use when printing file paths.]" \ '(-w -x --line-regexp --word-regexp)'{-x,--line-regexp}'[only show matches surrounded by line boundaries]'
"-r+[Replace matches with string given.]" \ '(-M --max-columns)'{-M+,--max-columns=}'[specify max length of lines to print]:number of bytes'
"--replace+[Replace matches with string given.]" \ '(-m --max-count)'{-m+,--max-count=}'[specify max number of matches per file]:number of matches'
"--regex-size-limit+[The upper size limit of the compiled regex.]" \ '--max-filesize=[specify size above which files should be ignored]:file size'
"-j+[The approximate number of threads to use.]" \ '--maxdepth=[specify max number of directories to descend]:number of directories'
"--threads+[The approximate number of threads to use.]" \ '(--mmap --no-mmap)--mmap[search using memory maps when possible]'
"-M+[Don't print lines longer than this limit in bytes.]" \ '(-H --with-filename --no-filename)--no-filename[suppress all file names]'
"--max-columns+[Don't print lines longer than this limit in bytes.]" \ "(-p --heading --pretty --vimgrep)--no-heading[don't group matches by file name]"
"*--type-add+[Add a new glob for a file type.]" \ "(--no-ignore-parent)--no-ignore[don't respect ignore files]"
"*--type-clear+[Clear globs for given file type.]" \ "--no-ignore-parent[don't respect ignore files in parent directories]"
"(-f --file -e --regexp --type-list)--files[Print each file that would be searched.]" \ "--no-ignore-vcs[don't respect version control ignore files]"
"(-f --file --files -e --regexp)--type-list[Show all supported file types.]" \ '(-n -N --line-number --no-line-number)'{-N,--no-line-number}'[suppress line numbers]'
"-a[Search binary files as if they were text.]" \ '--no-messages[suppress all error messages]'
"--text[Search binary files as if they were text.]" \ "(--mmap --no-mmap)--no-mmap[don't search using memory maps]"
"-c[Only show count of matches for each file.]" \ '(-0 --null)'{-0,--null}'[print NUL byte after file names]'
"--count[Only show count of matches for each file.]" \ '(-o --only-matching -r --replace)'{-o,--only-matching}'[show only matching part of each line]'
"-F[Treat the pattern as a literal string.]" \ '--path-separator=[specify path separator to use when printing file names]:separator'
"--fixed-strings[Treat the pattern as a literal string.]" \ '(-p --heading --no-heading --pretty --vimgrep)'{-p,--pretty}'[alias for --color=always --heading -n]'
"-i[Case insensitive search.]" \ '(-q --quiet)'{-q,--quiet}'[suppress normal output]'
"--ignore-case[Case insensitive search.]" \ '--regex-size-limit=[specify upper size limit of compiled regex]:regex size'
"-n[Show line numbers.]" \ '(1 -f --file)*'{-e+,--regexp=}'[specify pattern]:pattern'
"--line-number[Show line numbers.]" \ '(-o --only-matching -r --replace)'{-r+,--replace=}'[specify string used to replace matches]:replace string'
"-N[Suppress line numbers.]" \ '(-i -s -S --ignore-case --case-sensitive --smart-case)'{-S,--smart-case}'[search case-insensitively if the pattern is all lowercase]'
"--no-line-number[Suppress line numbers.]" \ '(-j --threads)--sort-files[sort results by file path (disables parallelism)]'
"-q[Do not print anything to stdout.]" \ '(-a --text)'{-a,--text}'[search binary files as if they were text]'
"--quiet[Do not print anything to stdout.]" \ '(-j --sort-files --threads)'{-j+,--threads=}'[specify approximate number of threads to use]:number of threads'
"*-u[Reduce the level of "smart" searching.]" \ '*'{-t+,--type=}'[only search files matching specified type]: :_rg_types'
"*--unrestricted[Reduce the level of "smart" searching.]" \ '*--type-add=[add new glob for file type]: :->typespec'
"-v[Invert matching.]" \ '*--type-clear=[clear globs previously defined for specified file type]: :_rg_types'
"--invert-match[Invert matching.]" \ # This should actually be exclusive with everything but other type options
"-w[Only show matches surrounded by word boundaries.]" \ '(:)--type-list[show all supported file types and their associated globs]'
"--word-regexp[Only show matches surrounded by word boundaries.]" \ '*'{-T+,--type-not=}"[don't search files matching specified type]: :_rg_types"
"--column[Show column numbers]" \ '*'{-u,--unrestricted}'[reduce level of "smart" searching]'
"--debug[Show debug messages.]" \ '(: -)'{-V,--version}'[display version information]'
"-l[Only show the paths with at least one match.]" \ '(-p --heading --no-heading --pretty)--vimgrep[show results in vim-compatible format]'
"--files-with-matches[Only show the paths with at least one match.]" \ '(-H --no-filename --with-filename)'{-H,--with-filename}'[display the file name for matches]'
"--files-without-match[Only show the paths that contains zero matches.]" \ '(-w -x --line-regexp --word-regexp)'{-w,--word-regexp}'[only show matches surrounded by word boundaries]'
"-H[Show file name for each match.]" \ '(-e -f --file --files --regexp --type-list)1: :_rg_pattern'
"--with-filename[Show file name for each match.]" \ '(--type-list)*:file:_files'
"--no-filename[Never show the file name for a match.]" \ )
"--heading[Show matches grouped by each file.]" \
"--no-heading[Don't group matches by each file.]" \ [[ ${_RG_COMPLETE_LIST_ARGS:-} == (1|t*|y*) ]] && {
"--hidden[Search hidden files and directories.]" \ printf '%s\n' "${rg_args[@]}"
"-L[Follow symbolic links.]" \ return 0
"--follow[Follow symbolic links.]" \ }
"--mmap[Searching using memory maps when possible.]" \
"--no-messages[Suppress all error messages.]" \ _arguments -s -S : "${rg_args[@]}" && return 0
"--no-mmap[Never use memory maps.]" \
"--no-ignore[Don't respect ignore files.]" \ while (( $#state )); do
"--no-ignore-parent[Don't respect ignore files in parent directories.]" \ case "${state[1]}" in
"--no-ignore-vcs[Don't respect VCS ignore files]" \ colorspec)
"-0[Print NUL byte after file names]" \ # @todo I don't like this because it allows you to do weird things like
"--null[Print NUL byte after file names]" \ # `line:line:bg:`. Also, i would like the `compadd -q` behaviour
"(-r --replace)-o[Print only matched parts of a line.]" \ [[ -prefix *:none: ]] && return 1
"(-r --replace)--only-matching[Print only matched parts of a line.]" \ [[ -prefix *:*:*:* ]] && return 1
"-p[Alias for --color always --heading -n.]" \
"--pretty[Alias for --color always --heading -n.]" \ _values -S ':' 'color/style type' \
"-s[Search case sensitively.]" \ 'column[specify coloring for column numbers]: :->attribute' \
"--case-sensitive[Search case sensitively.]" \ 'line[specify coloring for line numbers]: :->attribute' \
"-S[Smart case search.]" \ 'match[specify coloring for match text]: :->attribute' \
"--smart-case[Smart case search.]" \ 'path[specify color for file names]: :->attribute' && return 0
"--sort-files[Sort results by file path. Implies --threads=1.]" \
"--vimgrep[Show results in vim compatible format.]" \ [[ "${state}" == 'attribute' ]] &&
"-h[Prints help information. Use --help for more details.]" \ _values -S ':' 'color/style attribute' \
"--help[Prints help information. Use --help for more details.]" \ 'none[clear color/style for type]' \
"-V[Prints version information]" \ 'bg[specify background color]: :->color' \
"--version[Prints version information]" \ 'fg[specify foreground color]: :->color' \
"1:: :_rg_commands" \ 'style[specify text style]: :->style' && return 0
&& ret=0
[[ "${state}" == 'color' ]] &&
_values -S ':' 'color value' \
black blue green red cyan magenta yellow white && return 0
[[ "${state}" == 'style' ]] &&
_values -S ':' 'style value' \
bold nobold intense nointense && return 0
;;
typespec)
if compset -P '[^:]##:include:'; then
_sequence -s ',' _rg_types && return 0
# @todo This bit in particular could be better, but it's a little
# complex, and attempting to solve it seems to run us up against a crash
# bug — zsh # 40362
elif compset -P '[^:]##:'; then
_message 'glob or include directive' && return 1
elif [[ ! -prefix *:* ]]; then
_rg_types -qS ':' && return 0
fi
;;
esac
shift state
done
return 1
} }
(( $+functions[_rg_commands] )) || # zsh 5.1 refuses to complete options if a 'match-less' operand like our pattern
_rg_commands() { # could be 'completed' instead. We can use _guard() to avoid this problem, but
local commands; commands=( # it introduces another one: zsh won't print the message if we try to complete
"PATTERN:A regular expression used for searching." \ # the pattern after having passed `--`. To work around *that* problem, we can
"PATH:A file or directory to search." \ # use this function to bypass the _guard() when `--` is on the command line.
) # This is inaccurate (it'd get confused by e.g. `rg -e --`), but zsh's handling
_describe -t commands 'rg commands' commands "$@" # of `--` isn't accurate anyway
} _rg_pattern() {
(( $+functions[_rg_commands] )) || if (( ${words[(I)--]} )); then
_rg_commands() { _message 'pattern'
local commands; commands=( else
"PATTERN:A regular expression used for searching." \ _guard '^-*' 'pattern'
"PATH:A file or directory to search." \ fi
)
_describe -t commands 'rg commands' commands "$@"
} }
_rg "$@" # Complete encodings
_rg_encodings() {
local -a expl
local -aU _encodings
# This is impossible to read, but these encodings rarely if ever change, so it
# probably doesn't matter. They are derived from the list given here:
# https://encoding.spec.whatwg.org/#concept-encoding-get
_encodings=(
{{,us-}ascii,arabic,chinese,cyrillic,greek{,8},hebrew,korean}
logical visual mac {,cs}macintosh x-mac-{cyrillic,roman,ukrainian}
866 ibm{819,866} csibm866
big5{,-hkscs} {cn-,cs}big5 x-x-big5
cp{819,866,125{0..8}} x-cp125{0..8}
csiso2022{jp,kr} csiso8859{6,8}{e,i}
csisolatin{{1..6},9} csisolatin{arabic,cyrillic,greek,hebrew}
ecma-{114,118} asmo-708 elot_928 sun_eu_greek
euc-{jp,kr} x-euc-jp cseuckr cseucpkdfmtjapanese
{,x-}gbk csiso58gb231280 gb18030 {,cs}gb2312 gb_2312{,-80} hz-gb-2312
iso-2022-{cn,cn-ext,jp,kr}
iso8859{,-}{{1..11},13,14,15}
iso-8859-{{1..11},{6,8}-{e,i},13,14,15,16} iso_8859-{{1..9},15}
iso_8859-{1,2,6,7}:1987 iso_8859-{3,4,5,8}:1988 iso_8859-9:1989
iso-ir-{58,100,101,109,110,126,127,138,144,148,149,157}
koi{,8,8-r,8-ru,8-u,8_r} cskoi8r
ks_c_5601-{1987,1989} ksc{,_}5691 csksc56011987
latin{1..6} l{{1..6},9}
shift{-,_}jis csshiftjis {,x-}sjis ms_kanji ms932
utf{,-}8 utf-16{,be,le} unicode-1-1-utf-8
windows-{31j,874,949,125{0..8}} dos-874 tis-620 ansi_x3.4-1968
x-user-defined auto
)
_wanted rg-encodings expl 'encoding' compadd -a "${@}" - _encodings
}
# Complete file types
_rg_types() {
local -a expl
local -aU _types
_types=( ${${(f)"$( _call_program rg-types rg --type-list )"}%%:*} )
_wanted rg-types expl 'file type' compadd -a "${@}" - _types
}
_rg "${@}"
# ------------------------------------------------------------------------------
# Copyright (c) 2011 Github zsh-users - http://github.com/zsh-users
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
# * Neither the name of the zsh-users nor the
# names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL ZSH-USERS BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ------------------------------------------------------------------------------
# Description
# -----------
#
# Completion script for ripgrep
#
# ------------------------------------------------------------------------------
# Authors
# -------
#
# * arcizan <ghostrevery@gmail.com>
# * MaskRay <i@maskray.me>
#
# ------------------------------------------------------------------------------
# Local Variables:
# mode: shell-script
# coding: utf-8-unix
# indent-tabs-mode: nil
# sh-indentation: 2
# sh-basic-offset: 2
# End:
# vim: ft=zsh sw=2 ts=2 et

View File

@ -1,34 +0,0 @@
# Changing/making/removing directory
setopt auto_pushd
setopt pushd_ignore_dups
setopt pushdminus
alias -g ...='../..'
alias -g ....='../../..'
alias -g .....='../../../..'
alias -g ......='../../../../..'
alias -- -='cd -'
alias 1='cd -'
alias 2='cd -2'
alias 3='cd -3'
alias 4='cd -4'
alias 5='cd -5'
alias 6='cd -6'
alias 7='cd -7'
alias 8='cd -8'
alias 9='cd -9'
alias md='mkdir -p'
alias rd=rmdir
alias d='dirs -v | head -10'
# List directory contents
alias lsa='ls -lah'
alias l='ls -lah'
alias ll='ls -lh'
alias la='ls -lAh'
# Push and pop directories on directory stack
alias pu='pushd'
alias po='popd'

View File

@ -1,55 +1,20 @@
# ls colors # ls colors
autoload -U colors && colors autoload -U colors && colors
# Enable ls colors # default LSCOLORS
export LSCOLORS="Gxfxcxdxbxegedabagacad" export LSCOLORS="Gxfxcxdxbxegedabagacad"
# TODO organise this chaotic logic if [[ -f $HOME/.dircolors ]]; then
eval $(dircolors -b $HOME/.dircolors)
if [[ "$DISABLE_LS_COLORS" != "true" ]]; then elif [[ -z "$LS_COLORS" ]]; then
# Find the option for using colors in ls, depending on the version (( $+commands[dircolors] )) && eval "$(dircolors -b)"
if [[ "$OSTYPE" == netbsd* ]]; then
# On NetBSD, test if "gls" (GNU ls) is installed (this one supports colors);
# otherwise, leave ls as is, because NetBSD's ls doesn't support -G
gls --color -d . &>/dev/null && alias ls='gls --color=tty'
elif [[ "$OSTYPE" == openbsd* ]]; then
# On OpenBSD, "gls" (ls from GNU coreutils) and "colorls" (ls from base,
# with color and multibyte support) are available from ports. "colorls"
# will be installed on purpose and can't be pulled in by installing
# coreutils, so prefer it to "gls".
gls --color -d . &>/dev/null && alias ls='gls --color=tty'
colorls -G -d . &>/dev/null && alias ls='colorls -G'
elif [[ "$OSTYPE" == darwin* ]]; then
# this is a good alias, it works by default just using $LSCOLORS
ls -G . &>/dev/null && alias ls='ls -G'
# only use coreutils ls if there is a dircolors customization present ($LS_COLORS or .dircolors file)
# otherwise, gls will use the default color scheme which is ugly af
[[ -n "$LS_COLORS" || -f "$HOME/.dircolors" ]] && gls --color -d . &>/dev/null && alias ls='gls --color=tty'
else
# For GNU ls, we use the default ls color theme. They can later be overwritten by themes.
if [[ -z "$LS_COLORS" ]]; then
(( $+commands[dircolors] )) && eval "$(dircolors -b)"
fi
ls --color -d . &>/dev/null && alias ls='ls --color=tty' || { ls -G . &>/dev/null && alias ls='ls -G' }
# Take advantage of $LS_COLORS for completion as well.
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
fi
fi fi
# Take advantage of $LS_COLORS for completion as well.
zstyle ':completion:*' list-colors "${(s.:.)LS_COLORS}"
setopt auto_cd setopt auto_cd
setopt multios setopt multios
setopt prompt_subst setopt prompt_subst
[[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO="" [[ -n "$WINDOW" ]] && SCREEN_NO="%B$WINDOW%b " || SCREEN_NO=""
# Apply theming defaults
PS1="%n@%m:%~%# "
# git theming default: Variables for theming the git info prompt
ZSH_THEME_GIT_PROMPT_PREFIX="git:(" # Prefix at the very beginning of the prompt, before the branch name
ZSH_THEME_GIT_PROMPT_SUFFIX=")" # At the very end of the prompt
ZSH_THEME_GIT_PROMPT_DIRTY="*" # Text to display if the branch is dirty
ZSH_THEME_GIT_PROMPT_CLEAN="" # Text to display if the branch is clean

View File

@ -1,5 +1,6 @@
# path to my zsh configs # path to my zsh configs
ZSH=$HOME/.zsh ZSH=$HOME/.zsh
ZSH_CACHE_DIR=$ZSH/cache
# load the things # load the things
fpath=($ZSH/functions $ZSH/completions $fpath) fpath=($ZSH/functions $ZSH/completions $fpath)