diff options
-rwxr-xr-x | .config/herbstluftwm/panel.sh | 2 | ||||
-rwxr-xr-x | .config/init/funcs/audio-convert | 50 | ||||
-rw-r--r-- | .config/init/helpers | 175 | ||||
-rw-r--r-- | .config/ranger/rifle.conf | 3 | ||||
-rw-r--r-- | .vimrc | 191 | ||||
-rw-r--r-- | .zprofile | 11 | ||||
-rw-r--r-- | .zshrc-linux-desktop | 14 |
7 files changed, 226 insertions, 220 deletions
diff --git a/.config/herbstluftwm/panel.sh b/.config/herbstluftwm/panel.sh index 3c3d178..79b3cce 100755 --- a/.config/herbstluftwm/panel.sh +++ b/.config/herbstluftwm/panel.sh @@ -111,7 +111,7 @@ update_winlist() { update_date() { #\uE015 echo -n "${sep}%{A:date:} " - LANG=ja_JP.UTF-8 date +$'%a, %b %d, %H:%M:%S' | tr -d '\n' + echo -n "$(LANG=ja_JP.UTF-8 date +$'%m月%d日 (%a) %H:%M:%S') [$(TZ=Japan LANG=ja_JP.UTF-8 date +'%m/%d:%H')]" | tr -d '\n' echo " %{A}" } diff --git a/.config/init/funcs/audio-convert b/.config/init/funcs/audio-convert index 24c5d62..9d153d4 100755 --- a/.config/init/funcs/audio-convert +++ b/.config/init/funcs/audio-convert @@ -1,5 +1,5 @@ #!/usr/bin/env zsh -# concatenate multiple audio files into one +# use parallel jobs to convert audio files from one format to another source "$HOME/.config/init/helpers" || exit 1 @@ -24,21 +24,13 @@ local pid trap_abort() { echo "" - print-error "process interrupted" - # race condition-y, but eh - repeat 5; do - [[ -z $pid ]] && sleep 0.1 || break - done - [[ -z $pid ]] || kill -s SIGKILL $pid - exit 1 + abort "process interrupted" } trap 'trap_abort' SIGABRT SIGHUP SIGINT SIGQUIT SIGTERM local codecpat='^(opus|mp3|vorbis|flac)$' local bitratepat='^[1-9][0-9]*k$' -local metadatapat='^(true|false)$' -local jobcountpat='^[1-9][0-9]*$' local qpatvorbis='^([0-9]|10)$' local qpatmp3='^[0-9]$' @@ -54,6 +46,7 @@ local qstr local jobcount +local args local parseerr=$(2>&1 zparseopts -D -E -M -A args \ c: -codec:=c \ b: -bitrate:=b \ @@ -61,6 +54,7 @@ local parseerr=$(2>&1 zparseopts -D -E -M -A args \ d: -dest:=d -destination:=d \ j: -jobs:=j \ m:: -metadata::=m \ + f:: -force::=f \ h -help=h | cut -d ' ' -f 2-) [[ -z $parseerr ]] || abort $parseerr @@ -72,6 +66,7 @@ zparseopts -D -E -M -A args \ d: -dest:=d -destination:=d \ j: -jobs:=j \ m:: -metadata::=m \ + f:: -force::=f \ h -help=h local optarg @@ -106,24 +101,26 @@ for opt in ${(@k)args}; do ;; -q) qstr=$optarg ;; -d) dirstr=$optarg ;; - -j) [[ $optarg =~ $jobcountpat ]] || \ + -j) [[ $optarg =~ $posunsignedpat ]] || \ abort "job count must be a non-negative integer" jobcount=$optarg ;; -m) if [[ $optarg ]]; then - [[ $optarg =~ $metadatapat ]] || \ - abort "metadata must be either \`true\` or \`false\`" + [[ $optarg =~ $boolpat ]] || \ + abort "metadata must be a boolean value (e.g. \`true\` or \`false\`)" - [[ $optarg == "false" ]] && metastr="" \ + [[ $optarg =~ $booltpat ]] && metastr=("-map_metadata" "0") \ || metastr=("-map_metadata" "-1") else - metastr=("-map_metadata" "-1") + metastr=("-map_metadata" "0") fi ;; -h) usage ;; esac done +[[ $#@ -eq 0 ]] && abort "no input files specified" + [[ -z $codecstr ]] && codecstr='libopus' [[ -z $bitratestr ]] && bitratestr='35k' [[ -z $codecprintstr ]] && codecprintstr='opus' @@ -135,17 +132,17 @@ done if [[ ! -z $qstr ]]; then [[ -z $bitratset ]] || abort "-b and -q are not compatible" [[ $codecstr == "libopus" ]] && abort "-q cannot be used with opus" - [[ $codecstr == "libflac" ]] && abort "-q cannot be used with flac" + [[ $codecstr == "flac" ]] && abort "-q cannot be used with flac" [[ $codecstr == "libvorbis" ]] && [[ ! $qstr =~ $qpatvorbis ]] \ && abort "for vorbis, -q must be in the range [0-10]" [[ $codecstr == "libmp3lame" ]] && [[ ! $qstr =~ $qpatmp3 ]] \ && abort "for mp3, -q must be in the range [0-9]" -else fi -[[ $codecstr == "flac" ]] && bitratestr='' - -[[ $#@ -eq 0 ]] && abort "no input files specified" +if [[ $codecstr == "flac" ]]; then + bitratestr='' + [[ -z $bitrateset ]] || abort "-b cannot be used with flac" +fi local roots=(${@:t:r}) local uniqroots=(${(u)roots}) @@ -182,6 +179,7 @@ local jobstr=$jobcount coproc { local joblist=() + local c while read -d $'\0' c; do [[ $c == "done" ]] && break local f=${c:s/file:/} @@ -206,24 +204,20 @@ coproc { echo "done" } -pid=$! - repeat $jobcount; do if [[ $#@ -gt 0 ]]; then - 1>&p printf "%s\0" $@[1] + 1>&p printf "file:%s\0" $@[1] shift fi done while read -p line; do [[ $line == "done" ]] && coproc exit && break - echo "$line" + echo $line if [[ $#@ -gt 0 ]]; then - 1>&p printf "%s\0" "file:${@[1]}" + 1>&p printf "file:%s\0" $@[1] shift else - 1>&p printf "%s\0" "done" + 1>&p printf "done\0" fi done | progress-bar $filecount "using $jobstr to convert $totalstr to $codecprintstr" - -2>/dev/null wait $pid diff --git a/.config/init/helpers b/.config/init/helpers index 37ae17a..e1ac96e 100644 --- a/.config/init/helpers +++ b/.config/init/helpers @@ -1,3 +1,42 @@ +#!/usr/bin/env zsh + +# patterns for option matching +boolpat='^(true|yes|on|1|false|no|off|0)$' +booltpat='^(true|yes|on|1)$' +boolfpat='^(false|no|off|0)$' + +intpat='^[-+]?[0-9]+$' +unsignedpat='^[0-9]+$' +posunsignedpat='^[1-9][0-9]*$' +floatpat='^[-+]?[0-9]+(\.[0-9]*|e(0|[-+]?[1-9][0-9]*)|\.[0-9]*e(0|[-+]?[1-9][0-9]*$' + +termcolourpat='^(black|light_black|red|light_red|green|light_green|yellow|light_yellow|blue|light_blue|magenta|light_magenta|cyan|light_cyan|white|light_white)$' + +# $1 - colour +termcolourpat2escape() { + [[ $#@ -eq 1 ]] || {echo 'badcolour'; return 1} + [[ $1 =~ $termcolourpat ]] || {echo 'badcolour'; return 1} + + case $1 in + 'black') printf '\e[30m' ;; + 'light_black') printf '\e[1;30m' ;; + 'red') printf '\e[31m' ;; + 'light_red') printf '\e[1;31m' ;; + 'green') printf '\e[32m' ;; + 'light_green') printf '\e[1;32m' ;; + 'yellow') printf '\e[33m' ;; + 'light_yellow') printf '\e[1;33m' ;; + 'blue') printf '\e[34m' ;; + 'light_blue') printf '\e[1;34m' ;; + 'magenta') printf '\e[35m' ;; + 'light_magenta') printf '\e[1;35m' ;; + 'cyan') printf '\e[36m' ;; + 'light_cyan') printf '\e[1;36m' ;; + 'white') printf '\e[37m' ;; + 'light_white') printf '\e[1;37m' ;; + esac +} + # $1 - message print-error() { 1>&2 echo "\e[1;31merror:\e[0m $1" @@ -9,23 +48,41 @@ abort() { exit 1 } +# $1 - seconds +sec2time() { + zmodload zsh/datetime || return 1 + + if [[ $1 -lt 0 ]]; then + printf "??:??:??" + return 0 + fi + + if [[ $1 -lt 86400 ]]; then + TZ=UTC strftime '%H:%M:%S' $1 + return 0 + fi + + if [[ $1 -ge 8640000 ]]; then + printf "forever?" + return 0 + fi + + printf "~%02d days" "$(($1 / 86400))" +} + # $1 - count # $2 - message (opt) -# $3 - colourpat (opt) +# $3 - colour (opt) progress-bar() { - - zmodload zsh/datetime zsh/mathfunc || return 1 + zmodload zsh/mathfunc zsh/datetime || return 1 [[ $#@ -ne 0 ]] && [[ $#@ -lt 4 ]] || return 1 - local countpat='^[1-9][0-9]*$' - local colourpat='^(black|light_black|red|light_red|green|light_green|yellow|light_yellow|blue|light_blue|magenta|light_magenta|cyan|light_cyan|white|light_white)$' - local count - [[ $1 =~ $countpat ]] && count=$1 || return 1 - if [[ ! -z $3 ]]; then - [[ $3 =~ $colourpat ]] || return 1 - fi + [[ $1 =~ $posunsignedpat ]] && count=$1 || return 1 + [[ ! -z $3 ]] && { + [[ $3 =~ $termcolourpat ]] || return 1 + } local message local colour @@ -33,35 +90,19 @@ progress-bar() { [[ -z $2 ]] && message='waiting' || message=$2 [[ -z $3 ]] && colour='yellow' || colour=$3 - case $colour in - 'black') colour='\e[30m' ;; - 'light_black') colour='\e[1;30m' ;; - 'red') colour='\e[31m' ;; - 'light_red') colour='\e[1;31m' ;; - 'green') colour='\e[32m' ;; - 'light_green') colour='\e[1;32m' ;; - 'yellow') colour='\e[33m' ;; - 'light_yellow') colour='\e[1;33m' ;; - 'blue') colour='\e[34m' ;; - 'light_blue') colour='\e[1;34m' ;; - 'magenta') colour='\e[35m' ;; - 'light_magenta') colour='\e[1;35m' ;; - 'cyan') colour='\e[36m' ;; - 'light_cyan') colour='\e[1;36m' ;; - 'white') colour='\e[37m' ;; - 'light_white') colour='\e[1;37m' ;; - esac + colour=$(termcolourpat2escape $colour) local i=0 local starttime=$EPOCHREALTIME local lasttime=$starttime - local thistime=$starttime + local thistime=$starttime + local now=$starttime local elapsed=0 while true; do - - local now=$EPOCHREALTIME [[ $i -eq $count ]] && break + now=$EPOCHREALTIME + local width=$COLUMNS local statwidth=$(( ($#count * 2) + 35)) local progwidth=$(($width - $statwidth - 3)) @@ -70,19 +111,10 @@ progress-bar() { if [[ $i -eq 0 ]]; then eta='??:??:??' else - local left=$(( ($count - $i) * ($elapsed / $i) - ($now - $lasttime) )) - if [[ $left -ge 86400 ]]; then - eta=' days...' - elif [[ $left -le 0 ]]; then - eta='00:00:00' - else - eta=$(strftime '%H:%M:%S' ${$(( ceil($left + 802800) )):s/\./}) - fi + eta=$(sec2time ${$(( ceil( ($count - $i) * ($elapsed / $i) - ($now - $lasttime) ) )):s/\./}) fi - local rt=$(($now - $starttime)) - [[ $rt -ge 86400 ]] && rt=' days...' \ - || rt=$(strftime '%H:%M:%S' ${$(( floor($rt + 802800) )):s/\./}) + local rt=$(sec2time ${$(( floor( ($now - $starttime) ) )):s/\./} ) local fpart="" local epart="" @@ -96,7 +128,7 @@ progress-bar() { $i \ read -t 0.2 \ - && thistime=$EPOCHREALTIME \ + && thistime=$EPOCHREALTIME \ && elapsed=$(($elapsed - $lasttime + $thistime)) \ && lasttime=$thistime \ && i=$(($i + 1)) @@ -104,23 +136,21 @@ progress-bar() { printf "\e[F" done - [[ $i -eq $count ]] && echo "\e[G\e[32m$message... done!\e[0m\e[J" \ + [[ $i -eq $count ]] \ + && echo "\e[G\e[32m$message... done in $(sec2time ${$(( floor($elapsed) )):s/\./})\e[0m\e[J" \ || echo "\e[G\e[31m$message... failed!\e[0m\e[J" } # $1 - pid # $2 - message (opt) -# $3 - colourpat (opt) +# $3 - colour (opt) wait-anim() { [[ $#@ -ne 0 ]] && [[ $#@ -lt 4 ]] || return 1 - local pidpat='^[1-9][0-9]*$' - local colourpat='^(black|light_black|red|light_red|green|light_green|yellow|light_yellow|blue|light_blue|magenta|light_magenta|cyan|light_cyan|white|light_white)$' - - [[ $1 =~ $pidpat ]] || return 1 - if [[ ! -z $3 ]]; then - [[ $3 =~ $colourpat ]] || return 1 - fi + [[ $1 =~ $posunsignedpat ]] || return 1 + [[ ! -z $3 ]] && { + [[ $3 =~ $termcolourpat ]] || return 1 + } local message local colour @@ -128,28 +158,9 @@ wait-anim() { [[ -z $2 ]] && message='waiting' || message=$2 [[ -z $3 ]] && colour='yellow' || colour=$3 - case $colour in - 'black') colour='\e[30m' ;; - 'light_black') colour='\e[1;30m' ;; - 'red') colour='\e[31m' ;; - 'light_red') colour='\e[1;31m' ;; - 'green') colour='\e[32m' ;; - 'light_green') colour='\e[1;32m' ;; - 'yellow') colour='\e[33m' ;; - 'light_yellow') colour='\e[1;33m' ;; - 'blue') colour='\e[34m' ;; - 'light_blue') colour='\e[1;34m' ;; - 'magenta') colour='\e[35m' ;; - 'light_magenta') colour='\e[1;35m' ;; - 'cyan') colour='\e[36m' ;; - 'light_cyan') colour='\e[1;36m' ;; - 'white') colour='\e[37m' ;; - 'light_white') colour='\e[1;37m' ;; - esac + colour=$(termcolourpat2escape $colour) - local curframe local frames - case $(($RANDOM % 7)) in 0) frames=('▁' '▂' '▃' '▄' '▅' '▆' '▇' '█' '▇' '▆' '▅' '▄' '▃' '▂') ;; 1) frames=(' ' '▖' '▚' '▝' ' ' '▘' '▞' '▗') ;; @@ -160,19 +171,23 @@ wait-anim() { 6) frames=('O' 'o' '.' 'o') ;; esac - local rval - - { - wait $1 - rval=$? - echo "done" - } | while true; do + local curframe + coproc while true; do [[ -z $curframe ]] && curframe=0 - printf "\e[G\e[K|\e[1;32m${frames[$(($curframe + 1))]}\e[0m| $colour$message...\e[0m" + printf "\e[G\e[K|\e[1;32m${frames[$(($curframe + 1))]}\e[0m| $colour$message...\e[0m\n" curframe=$(( ($curframe + 1) % $#frames )) read -t 0.2 && break done + while read -p line; do + printf $line + done & + local printer=$! + + local rval + 2>/dev/null wait $1 && rval=$? && echo "done" >&p + 2>/dev/null wait $printer + [[ $rval -eq 0 ]] && printf "\e[G\e[K\e[32m$message... done!\e[0m\n" \ || printf "\e[G\e[K\e[31m$message... failed!\e[0m\n" diff --git a/.config/ranger/rifle.conf b/.config/ranger/rifle.conf index 1be6a2b..07eb3cf 100644 --- a/.config/ranger/rifle.conf +++ b/.config/ranger/rifle.conf @@ -125,6 +125,9 @@ ext tar|gz, has tar = tar vvxf "$@" # roms ext nes|gb|gb[ca]|s[wmf]c, has mednafen, X, flag f = mednafen "$1" +# fonts +ext sfd|ttf|otf|woff|woff2|pcf|bdf, has fontforge, X, flag f = fontforge "$1" + # makefiles name ^[mM]akefile$ = make name ^[mM]akefile$ = make new @@ -48,7 +48,6 @@ Plugin 'itchyny/lightline.vim' Plugin 'tomtom/tcomment_vim' Plugin 'SirVer/ultisnips' -Plugin 'honza/vim-snippets' Plugin 'junegunn/vader.vim' @@ -236,6 +235,18 @@ endif cnoremap <PageUp> <up> cnoremap <PageDown> <down> +fun! s:goyo_enter() + set formatoptions+=a +endfun + +fun! s:goyo_leave() + set formatoptions-=a +endfun + +autocmd! User GoyoEnter nested call <SID>goyo_enter() +autocmd! User GoyoLeave nested call <SID>goyo_leave() + +nnoremap <Leader>w :execute "silent Goyo"<CR><C-l> """"""""""""""""""""""" @@ -253,49 +264,49 @@ if has('autocmd') "set various filetype-specific settings. augroup filetypesettings - au FileType asm call Settings_asm() - au FileType bash call Settings_shell() - au FileType c call Settings_c() - au FileType coffee call Settings_coffee() - au FileType conf call Settings_conf() - au FileType cpp call Settings_c() - au FileType crystal call Settings_crystal() - au FileType cs call Settings_c() - au FileType css call Settings_css() - au FileType d call Settings_c() - au FileType elixir call Settings_elixir() - au FileType javascript call Settings_c() - au FileType tex call Settings_tex() - au FileType haskell call Settings_haskell() - au FileType html call Settings_html() - au FileType xhtml call Settings_html() - au FileType ia64 call Settings_ia64() - au FileType make call Settings_script() - au FileType mail call Settings_mail() - au FileType markdown call Settings_markdown() - au FileType matlab call Settings_matlab() - au FileType mips call Settings_mips() - au FileType mkd call Settings_text() - au FileType nim call Settings_nim() - au FileType ocaml call Settings_ocaml() - au FileType perl call Settings_perl() - au FileType php call Settings_html() - au FileType python call Settings_script() - au FileType ruby call Settings_elixir () - au FileType rust call Settings_rust() - au FileType scss call Settings_css() - au FileType sh call Settings_script() - au FileType text call Settings_text() - au FileType vim call Settings_vim() - au FileType yaml call Settings_script2() - au FileType zig call Settings_c() - au FileType zsh call Settings_shell() - au FileType z80 call Settings_z80() + au FileType asm call <SID>settings_asm() + au FileType bash call <SID>settings_shell() + au FileType c call <SID>settings_c() + au FileType coffee call <SID>settings_coffee() + au FileType conf call <SID>settings_conf() + au FileType cpp call <SID>settings_c() + au FileType crystal call <SID>settings_crystal() + au FileType cs call <SID>settings_c() + au FileType css call <SID>settings_css() + au FileType d call <SID>settings_c() + au FileType elixir call <SID>settings_elixir() + au FileType javascript call <SID>settings_c() + au FileType tex call <SID>settings_tex() + au FileType haskell call <SID>settings_haskell() + au FileType html call <SID>settings_html() + au FileType xhtml call <SID>settings_html() + au FileType ia64 call <SID>settings_ia64() + au FileType make call <SID>settings_script() + au FileType mail call <SID>settings_mail() + au FileType markdown call <SID>settings_markdown() + au FileType matlab call <SID>settings_matlab() + au FileType mips call <SID>settings_mips() + au FileType mkd call <SID>settings_text() + au FileType nim call <SID>settings_nim() + au FileType ocaml call <SID>settings_ocaml() + au FileType perl call <SID>settings_perl() + au FileType php call <SID>settings_html() + au FileType python call <SID>settings_script() + au FileType ruby call <SID>settings_script2() + au FileType rust call <SID>settings_rust() + au FileType scss call <SID>settings_css() + au FileType sh call <SID>settings_script() + au FileType text call <SID>settings_text() + au FileType vim call <SID>settings_vim() + au FileType yaml call <SID>settings_script2() + au FileType zig call <SID>settings_c() + au FileType zsh call <SID>settings_shell() + au FileType z80 call <SID>settings_z80() augroup END "do other stuff augroup filetypemisc - au FileType * call Settings_skel_read() + au FileType * call <SID>settings_skel_read() augroup END endif "autocmd @@ -305,7 +316,7 @@ endif "autocmd " "command for reading filetype skeletons -fun! Settings_skel_read() +fun! s:settings_skel_read() "is the buffer not empty? if line('$') != 1 || col('$') != 1 return 1 @@ -321,25 +332,8 @@ fun! Settings_skel_read() exec "silent! normal! ggJ/%START%\<CR>:s/%START%//\<CR>" endfun -"a 'writing mode' for prose-y formats -fun! s:goyo_enter() - setlocal formatoptions+=a -endfun - -fun! s:goyo_leave() - setlocal formatoptions+=a -endfun - -fun! Settings_sub_wmodetoggle() - if &fo =~ 'a' - Goyo! - else - Goyo - endif -endfun - "run vader tests on the current file -fun! Settings_sub_test_vim() +fun! s:settings_sub_test_vim() "check first if curbuf is a file if @% != '' && filereadable(@%) let l:real = '' @@ -371,7 +365,7 @@ endfun " Settings Functions " -fun! Settings_asm() +fun! s:settings_asm() "settings setlocal foldmethod=syntax "mappings @@ -379,7 +373,7 @@ fun! Settings_asm() nnoremap <buffer> -_ O;<Space> endfun -fun! Settings_c() +fun! s:settings_c() "settings setlocal foldmethod=syntax setlocal shiftwidth=4 @@ -391,24 +385,24 @@ fun! Settings_c() inoremap <buffer> {<CR> }<Esc>i{<CR><Esc>O endfun -fun! Settings_coffee() - call Settings_script2() +fun! s:settings_coffee() + call <SID>settings_script2() setlocal foldmethod=syntax nnoremap <buffer> -_ O###<CR><C-u>###<Esc>O<C-u> endfun -fun! Settings_conf() - call Settings_script() +fun! s:settings_conf() + call <SID>settings_script() setlocal expandtab endfun -fun! Settings_crystal() - call Settings_script2() +fun! s:settings_crystal() + call <SID>settings_script2() setlocal expandtab endfun -fun! Settings_css() - call Settings_c() +fun! s:settings_css() + call <SID>settings_c() "settings setlocal shiftwidth=2 setlocal tabstop=2 @@ -416,12 +410,12 @@ fun! Settings_css() "mappings endfun -fun! Settings_elixir() - call Settings_script2() +fun! s:settings_elixir() + call <SID>settings_script2() inoremap <buffer> do<CR> end<Esc>hhido<CR><Esc>O endfun -fun! Settings_ia64() +fun! s:settings_ia64() "settings setlocal foldmethod=syntax "mappings @@ -429,7 +423,7 @@ fun! Settings_ia64() nnoremap <buffer> -_ O<Space>*/<Esc>hhi/*<Space> endfun -fun! Settings_haskell() +fun! s:settings_haskell() "settings setlocal shiftwidth=4 setlocal tabstop=4 @@ -439,7 +433,7 @@ fun! Settings_haskell() nnoremap <buffer> -- O--<Space> endfun -fun! Settings_html() +fun! s:settings_html() "settings setlocal foldmethod=syntax setlocal shiftwidth=4 @@ -449,7 +443,7 @@ fun! Settings_html() nnoremap <buffer> -- O<Space>--><Esc>3hi<!--<Space> endfun -fun! Settings_markdown() +fun! s:settings_markdown() "settings setlocal shiftwidth=4 setlocal tabstop=4 @@ -458,17 +452,15 @@ fun! Settings_markdown() setlocal spell "mappings nnoremap <buffer> -- O<Space>--><Esc>3hi<!--<Space> - nnoremap <buffer> <Leader>w :call Settings_sub_wmodetoggle()<CR> endfun -fun! Settings_mail() +fun! s:settings_mail() "settings setlocal spell "mappings - nnoremap <buffer> <Leader>w :call Settings_sub_wmodetoggle()<CR> endfun -fun! Settings_matlab() +fun! s:settings_matlab() "settings setlocal shiftwidth=4 setlocal tabstop=4 @@ -477,7 +469,7 @@ fun! Settings_matlab() nnoremap <buffer> -- O%<Space> endfun -fun! Settings_mips() +fun! s:settings_mips() "settings setlocal shiftwidth=6 setlocal tabstop=6 @@ -487,22 +479,23 @@ fun! Settings_mips() nnoremap <buffer> -_ O#<Space> endfun -fun! Settings_nim() - call Settings_script() +fun! s:settings_nim() + call <SID>settings_script() nnoremap <buffer> -- O<Space>]#<Esc>hhi#[<Space> endfun -fun! Settings_ocaml() +fun! s:settings_ocaml() "settings setlocal shiftwidth=2 setlocal tabstop=2 setlocal softtabstop=2 "mappings - nnoremap <buffer> -- O<Space>*)<Esc>hhi(**<Space> - nnoremap <buffer> -_ A<Space>*)<Esc>hhi(*<Space> + nnoremap <buffer> -- O<Space>*)<Esc>hhi(*<Space> + nnoremap <buffer> -_ A<Space>*)<Esc>hhi<Space>(*<Space> + nnoremap <buffer> __ O<Space>*)<Esc>hhi(**<Space> endfun -fun! Settings_script() +fun! s:settings_script() "settings setlocal shiftwidth=4 setlocal tabstop=4 @@ -511,7 +504,7 @@ fun! Settings_script() nnoremap <buffer> -- O#<Space> endfun -fun! Settings_script2() +fun! s:settings_script2() "settings setlocal shiftwidth=2 setlocal tabstop=2 @@ -520,22 +513,22 @@ fun! Settings_script2() nnoremap <buffer> -- O#<Space> endfun -fun! Settings_perl() - call Settings_script() +fun! s:settings_perl() + call <SID>settings_script() inoremap <buffer> {<CR> }<Esc>i{<CR><Esc>O endfun -fun! Settings_rust() - call Settings_c() +fun! s:settings_rust() + call <SID>settings_c() nnoremap <buffer> -_ O///<Space> endfun -fun! Settings_shell() - call Settings_script() +fun! s:settings_shell() + call <SID>settings_script() inoremap <buffer> {<CR> }<Esc>i{<CR><Esc>O endfun -fun! Settings_tex() +fun! s:settings_tex() "settings setlocal noautoindent setlocal nocindent @@ -551,10 +544,9 @@ fun! Settings_tex() nnoremap <buffer> <Leader>C :!latex -output-format=pdf "%"<CR> nnoremap <buffer> <Leader>x :!xelatex "%"<CR><CR> nnoremap <buffer> <Leader>X :!xelatex "%"<CR> - nnoremap <buffer> <Leader>w :call Settings_sub_wmodetoggle()<CR> endfun -fun! Settings_text() +fun! s:settings_text() "settings setlocal noautoindent setlocal nocindent @@ -565,20 +557,19 @@ fun! Settings_text() setlocal softtabstop=4 setlocal spell "mappings - nnoremap <buffer> <Leader>w :call Settings_sub_wmodetoggle()<CR> endfun -fun! Settings_vim() +fun! s:settings_vim() "settings setlocal shiftwidth=4 setlocal tabstop=4 setlocal softtabstop=4 "mappings nnoremap <buffer> -- O" - nnoremap <buffer> <Leader>t :call Settings_sub_test_vim()<CR> + nnoremap <buffer> <Leader>t :call <SID>settings_sub_test_vim()<CR> endfun -fun! Settings_z80() +fun! s:settings_z80() "settings setlocal shiftwidth=6 setlocal tabstop=6 @@ -1,15 +1,12 @@ emulate sh -c 'source /etc/profile' +############# STORE VIMTAGS IN TMP ############ export QT_STYLE_OVERRIDE=gtk -############# STORE VIMTAGS IN RAM ############ +############# STORE VIMTAGS IN TMP ############ [[ -d /tmp/ ]] && \ touch /tmp/.vimtags && ln -sf /tmp/.vimtags . -######### MAKE CABAL BUILDS AVAILABLE ######### -[[ -d ~/.cabal/bin ]] && \ - PATH=$PATH:~/.cabal/bin - ############# INITIALISE CONFIGS ############## [[ -f ~/.config/init/init.sh ]] && \ ~/.config/init/init.sh @@ -38,7 +35,7 @@ func_init_checkreq() { if [[ -d ~/.config/init/funcs/ && -d ~/.config/init/funcreqs ]]; then rm -rf /tmp/funcs mkdir -p /tmp/funcs - PATH=$PATH:/tmp/funcs + path+=(/tmp/funcs) for f in $HOME/.config/init/funcreqs/*; do source "$f" func_init_checkreq $func_init_prereqs , $func_init_checks @@ -52,3 +49,5 @@ fi ############# CONNECTING OVER SSH ############# [[ -f ~/.zprofile-dtach ]] && \ source ~/.zprofile-dtach + +export PATH diff --git a/.zshrc-linux-desktop b/.zshrc-linux-desktop index dc6c78f..148e3d2 100644 --- a/.zshrc-linux-desktop +++ b/.zshrc-linux-desktop @@ -1,9 +1,13 @@ ################### ALIASES ################## -alias ssh-socks='ssh -C2qTnN -F /dev/null -D 9853 airen-no-jikken.icu' +if [[ $(whence sshfs) != "" ]] then + alias smutt='ssh -t shmibs@airen-no-jikken.icu mutt' + alias kmutt='ssh -t k@airen-no-jikken.icu mutt' +fi -if [[ "$(whence sshfs)" != "" ]] then - alias smounth='mkdir -p ~/airen-no-jikken.icu; sshfs airen-no-jikken.icu: ~/airen-no-jikken.icu' - alias smountw='mkdir -p ~/airen-no-jikken.icu; sshfs airen-no-jikken.icu:/usr/local/www/apache24/data/ ~/airen-no-jikken.icu' - alias sumount='fusermount -u ~/airen-no-jikken.icu; rmdir ~/airen-no-jikken.icu' +if [[ $(whence sshfs) != "" ]] then + alias smount='mkdir -p ~/mount-shmibs && sshfs shmibs@airen-no-jikken.icu: ~/mount-shmibs || rmdir ~/mount-shmibs' + alias kmount'mkdir -p ~/mount-k && sshfs k@airen-no-jikken.icu: ~/mount-k || rmdir ~/mount-k' + alias sumount='fusermount -u ~/mount-shmibs && rmdir ~/mount-shmibs' + alias kumount='fusermount -u ~/mount-shmibs && rmdir ~/mount-k' fi |