From fd09841ac44858e90913c74befde9dc2fd7b33c3 Mon Sep 17 00:00:00 2001 From: Alison Watson Date: Fri, 5 Jul 2019 22:09:01 -0400 Subject: [PATCH] spaces->tabs --- applications/fish | 10 +- applications/ncmpcpp-bind | 30 +++--- applications/sharenix.json | 46 ++++----- applications/zshrc | 6 +- fonts/conflist | 6 ++ network/sharenix.json | 26 ----- scripts/cmds/crtolf.fish | 14 +-- scripts/cmds/find-stereo.fish | 16 +-- scripts/cmds/flac2mp3.fish | 10 +- scripts/cmds/update-vim-plugins.fish | 46 ++++----- scripts/cmds/vnc.fish | 2 +- scripts/fish/cheat.fish | 2 +- scripts/fish/megadl.fish | 2 +- scripts/fish/os.fish | 18 ++-- scripts/fish/prompt.fish | 12 +-- scripts/fish/ql.fish | 32 +++--- scripts/fish/rebuild.fish | 2 +- scripts/sharenix.fish | 24 ++--- scripts/text/mid.awk | 9 +- scripts/text/newcomments.sed | 10 +- scripts/text/newcomments2.sed | 6 +- scripts/text/oldcomments.sed | 46 +++++---- vim/vimrc | 144 +++++++++++++-------------- 23 files changed, 252 insertions(+), 267 deletions(-) delete mode 100644 network/sharenix.json diff --git a/applications/fish b/applications/fish index bfc88e8..002f5ed 100644 --- a/applications/fish +++ b/applications/fish @@ -1,16 +1,16 @@ if status is-interactive - and not status is-login - and test -z "$TMUX" + and not status is-login + and test -z "$TMUX" - exec tmux new-session + exec tmux new-session end for f in ~/src/scripts/fish/* - source $f + source $f end if test -f ~/.cargo/env - source ~/.cargo/env + source ~/.cargo/env end ## EOF diff --git a/applications/ncmpcpp-bind b/applications/ncmpcpp-bind index 95c4b3c..cd7129d 100644 --- a/applications/ncmpcpp-bind +++ b/applications/ncmpcpp-bind @@ -1,37 +1,37 @@ def_key "/" - find + find def_key "/" - find_item_forward + find_item_forward def_key "j" - scroll_down + scroll_down def_key "k" - scroll_up + scroll_up def_key "ctrl-b" - page_up + page_up def_key "ctrl-f" - page_down + page_down def_key "g" - move_home + move_home def_key "G" - move_end + move_end def_key "h" - previous_column + previous_column def_key "l" - next_column + next_column def_key "." - show_lyrics + show_lyrics def_key "n" - next_found_item + next_found_item def_key "N" - previous_found_item + previous_found_item def_key "J" - move_sort_order_down + move_sort_order_down def_key "K" - move_sort_order_up + move_sort_order_up diff --git a/applications/sharenix.json b/applications/sharenix.json index 416a383..679ff46 100644 --- a/applications/sharenix.json +++ b/applications/sharenix.json @@ -1,26 +1,26 @@ { - "DefaultFileUploader": "Greyserv", - "DefaultImageUploader": "Greyserv", - "DefaultUrlShortener": null, - "XineramaHead": 0, - "NotificationTime": 30, - "NotifyUploading": true, - "NotifyCommand": "", - "ClipboardTime": 1, - "SaveFolder": "/home/marrub/Pictures/ShareNix", - "OrganizedFolders": false, + "DefaultFileUploader": "Greyserv", + "DefaultImageUploader": "Greyserv", + "DefaultUrlShortener": null, + "XineramaHead": 0, + "NotificationTime": 30, + "NotifyUploading": true, + "NotifyCommand": "", + "ClipboardTime": 1, + "SaveFolder": "/home/marrub/Pictures/ShareNix", + "OrganizedFolders": false, - "Services": [ - { - "Name": "Greyserv", - "DestinationType": "None", - "RequestType": "POST", - "RequestURL": "https://fuck.greyserv.net/", - "FileFormName": "file_1", - "ResponseType": "Text", - "URL": null, - "ThumbnailURL": null, - "DeletionURL": null - } - ] + "Services": [ + { + "Name": "Greyserv", + "DestinationType": "None", + "RequestType": "POST", + "RequestURL": "https://fuck.greyserv.net/", + "FileFormName": "file_1", + "ResponseType": "Text", + "URL": null, + "ThumbnailURL": null, + "DeletionURL": null + } + ] } diff --git a/applications/zshrc b/applications/zshrc index 2bf8516..7d4b857 100644 --- a/applications/zshrc +++ b/applications/zshrc @@ -1,5 +1,5 @@ [[ -o interactive && ! -o login && -z $TMUX ]] && - exec tmux new-session + exec tmux new-session HISTFILE=~/.zsh/hist HISTSIZE=100000 @@ -25,5 +25,5 @@ PROMPT='%#' RPROMPT='%2~' [[ -n $TMUX ]] && - echo "Word of the moment: $(shuf -n1 /usr/share/dict/words)" | - awk -f ~/src/scripts/mid.awk col=$COLUMNS + echo "Word of the moment: $(shuf -n1 /usr/share/dict/words)" | + awk -f ~/src/scripts/mid.awk col=$COLUMNS diff --git a/fonts/conflist b/fonts/conflist index ec8238f..fa558ea 100644 --- a/fonts/conflist +++ b/fonts/conflist @@ -1,6 +1,9 @@ /etc/fonts/conf.d/10-scale-bitmap-fonts.conf /etc/fonts/conf.d/10-sub-pixel-rgb.conf /etc/fonts/conf.d/11-lcdfilter-default.conf +/etc/fonts/conf.d/20-unhint-small-dejavu-sans-mono.conf +/etc/fonts/conf.d/20-unhint-small-dejavu-sans.conf +/etc/fonts/conf.d/20-unhint-small-dejavu-serif.conf /etc/fonts/conf.d/30-metric-aliases.conf /etc/fonts/conf.d/30-win32-aliases.conf /etc/fonts/conf.d/40-nonlatin.conf @@ -10,6 +13,9 @@ /etc/fonts/conf.d/50-user.conf /etc/fonts/conf.d/51-local.conf /etc/fonts/conf.d/56-ttf-twemoji-color.conf +/etc/fonts/conf.d/57-dejavu-sans-mono.conf +/etc/fonts/conf.d/57-dejavu-sans.conf +/etc/fonts/conf.d/57-dejavu-serif.conf /etc/fonts/conf.d/60-generic.conf /etc/fonts/conf.d/60-latin.conf /etc/fonts/conf.d/65-fonts-persian.conf diff --git a/network/sharenix.json b/network/sharenix.json deleted file mode 100644 index 416a383..0000000 --- a/network/sharenix.json +++ /dev/null @@ -1,26 +0,0 @@ -{ - "DefaultFileUploader": "Greyserv", - "DefaultImageUploader": "Greyserv", - "DefaultUrlShortener": null, - "XineramaHead": 0, - "NotificationTime": 30, - "NotifyUploading": true, - "NotifyCommand": "", - "ClipboardTime": 1, - "SaveFolder": "/home/marrub/Pictures/ShareNix", - "OrganizedFolders": false, - - "Services": [ - { - "Name": "Greyserv", - "DestinationType": "None", - "RequestType": "POST", - "RequestURL": "https://fuck.greyserv.net/", - "FileFormName": "file_1", - "ResponseType": "Text", - "URL": null, - "ThumbnailURL": null, - "DeletionURL": null - } - ] -} diff --git a/scripts/cmds/crtolf.fish b/scripts/cmds/crtolf.fish index 01338e0..523c5cb 100755 --- a/scripts/cmds/crtolf.fish +++ b/scripts/cmds/crtolf.fish @@ -1,14 +1,14 @@ #!/usr/bin/env fish for f in (find . -type f) - set ftype (file -b --mime-type "$f") - set basetype (string split "/" "$ftype") + set ftype (file -b --mime-type "$f") + set basetype (string split "/" "$ftype") - if test "$basetype[1]" = "text" - set tmp (mktemp) - mac2unix -n "$f" "$tmp" - mv "$tmp" "$f" - end + if test "$basetype[1]" = "text" + set tmp (mktemp) + mac2unix -n "$f" "$tmp" + mv "$tmp" "$f" + end end ## EOF diff --git a/scripts/cmds/find-stereo.fish b/scripts/cmds/find-stereo.fish index b28f350..1682c95 100755 --- a/scripts/cmds/find-stereo.fish +++ b/scripts/cmds/find-stereo.fish @@ -3,15 +3,15 @@ set filter 'pan=mono|c0=0.5*FL+-0.5*FR,silenceremove=start_periods=1:detection=peak' for f in $argv - set out (ffmpeg -nostdin -loglevel error -i "$f" -filter_complex "$filter" -t 0.00002 -f crc -) + set out (ffmpeg -nostdin -loglevel error -i "$f" -filter_complex "$filter" -t 0.00002 -f crc -) - if test "$out" != 'CRC=0x00000001' - set other /tmp/(basename "$f") - echo "$f is stereo, converting" - ffmpeg -i "$f" -ac 1 "$other" && mv "$other" "$f" - else - echo "$f is mono" - end + if test "$out" != 'CRC=0x00000001' + set other /tmp/(basename "$f") + echo "$f is stereo, converting" + ffmpeg -i "$f" -ac 1 "$other" && mv "$other" "$f" + else + echo "$f is mono" + end end ## EOF diff --git a/scripts/cmds/flac2mp3.fish b/scripts/cmds/flac2mp3.fish index 55a263a..d3d4bdf 100755 --- a/scripts/cmds/flac2mp3.fish +++ b/scripts/cmds/flac2mp3.fish @@ -1,14 +1,14 @@ #!/usr/bin/env fish function fail - echo "failed to process $f, exiting" - exit 1 + echo "failed to process $f, exiting" + exit 1 end for f in ./*.flac - ffmpeg -i "$f" -q:a 0 -vn (basename "$f" ".flac")".mp3" - or fail - echo "$f success" + ffmpeg -i "$f" -q:a 0 -vn (basename "$f" ".flac")".mp3" + or fail + echo "$f success" end read -P "success. delete files? [yn] " yn diff --git a/scripts/cmds/update-vim-plugins.fish b/scripts/cmds/update-vim-plugins.fish index 6a5848d..509dcb2 100755 --- a/scripts/cmds/update-vim-plugins.fish +++ b/scripts/cmds/update-vim-plugins.fish @@ -1,45 +1,45 @@ #!/usr/bin/env fish function pull_plugins - for plugin in ./* - cd $plugin + for plugin in ./* + cd $plugin - echo "Updating $plugin" + echo "Updating $plugin" - git stash - git pull -f + git stash + git pull -f - set res $status + set res $status - if test $res != 0; and test $res != 128 - echo "error $res in $PWD" - exit 1 - end + if test $res != 0; and test $res != 128 + echo "error $res in $PWD" + exit 1 + end - if test -d doc - echo "generating tags for $PWD" - vim --cmd "helptags doc/" --cmd "q" - end + if test -d doc + echo "generating tags for $PWD" + vim --cmd "helptags doc/" --cmd "q" + end - cd .. - end + cd .. + end end function cd_and_pull - cd $argv[1] - pull_plugins - cd .. + cd $argv[1] + pull_plugins + cd .. end cd ~/.vim/pack for folder in ./* - cd $folder + cd $folder - test -d start; and cd_and_pull start - test -d opt; and cd_and_pull opt + test -d start; and cd_and_pull start + test -d opt; and cd_and_pull opt - cd .. + cd .. end ## EOF diff --git a/scripts/cmds/vnc.fish b/scripts/cmds/vnc.fish index dc75c44..d02a173 100755 --- a/scripts/cmds/vnc.fish +++ b/scripts/cmds/vnc.fish @@ -1,5 +1,5 @@ #!/usr/bin/env fish while true - x11vnc -forever -scale 0.25 + x11vnc -forever -scale 0.25 end diff --git a/scripts/fish/cheat.fish b/scripts/fish/cheat.fish index e11146f..afe3bec 100644 --- a/scripts/fish/cheat.fish +++ b/scripts/fish/cheat.fish @@ -1,5 +1,5 @@ function cheat.sh -d 'Grabs a sheet from cheat.sh' -a arg - curl cheat.sh/$arg + curl cheat.sh/$arg end complete -c cheat.sh -xa '(curl -s cheat.sh/:list)' diff --git a/scripts/fish/megadl.fish b/scripts/fish/megadl.fish index 9ac2159..ce2c49c 100755 --- a/scripts/fish/megadl.fish +++ b/scripts/fish/megadl.fish @@ -1,5 +1,5 @@ function megadl-all - megadl (cat ~/dl) + megadl (cat ~/dl) end ## EOF diff --git a/scripts/fish/os.fish b/scripts/fish/os.fish index e78d49e..11eb238 100644 --- a/scripts/fish/os.fish +++ b/scripts/fish/os.fish @@ -1,13 +1,13 @@ switch (uname) - case Linux - set -gx CC clang - set -gx CXX clang++ - case Darwin - set -gx CMAKE_PREFIX_PATH /usr/local/opt/qt/ - set -gx DISTCC_HOSTS "192.168.1.2,cpp" - set -gx fish_user_paths "/usr/local/opt/ruby/bin" $fish_user_paths - set -gx LDFLAGS "-L/usr/local/opt/ruby/lib" - set -gx CPPFLAGS "-I/usr/local/opt/ruby/include" + case Linux + set -gx CC clang + set -gx CXX clang++ + case Darwin + set -gx CMAKE_PREFIX_PATH /usr/local/opt/qt/ + set -gx DISTCC_HOSTS "192.168.1.2,cpp" + set -gx fish_user_paths "/usr/local/opt/ruby/bin" $fish_user_paths + set -gx LDFLAGS "-L/usr/local/opt/ruby/lib" + set -gx CPPFLAGS "-I/usr/local/opt/ruby/include" end ## EOF diff --git a/scripts/fish/prompt.fish b/scripts/fish/prompt.fish index 78a7a87..ad2e794 100644 --- a/scripts/fish/prompt.fish +++ b/scripts/fish/prompt.fish @@ -1,18 +1,18 @@ function fish_prompt - echo (set_color c792ea)"$hostname% "(set_color normal) + echo (set_color c792ea)"$hostname% "(set_color normal) end function fish_right_prompt - echo (set_color c3e88d)(pwd)(set_color normal) + echo (set_color c3e88d)(pwd)(set_color normal) end function fish_greeting - set_color c50ed2 + set_color c50ed2 - echo "Word of the moment: "(shuf -n1 /usr/share/dict/words) | - awk -f ~/src/scripts/text/mid.awk col=$COLUMNS + echo "Word of the moment: "(shuf -n1 /usr/share/dict/words) | + awk -f ~/src/scripts/text/mid.awk col=$COLUMNS - set_color normal + set_color normal end ## EOF diff --git a/scripts/fish/ql.fish b/scripts/fish/ql.fish index 30560ad..60b2679 100644 --- a/scripts/fish/ql.fish +++ b/scripts/fish/ql.fish @@ -1,30 +1,30 @@ function ql -d 'Changes directory to a quicklink' -a name - if not set -q quicklink_$name name - echo (set_color red)"error: no quicklink named $name"(set_color normal) - return - end + if not set -q quicklink_$name name + echo (set_color red)"error: no quicklink named $name"(set_color normal) + return + end - set name quicklink_$name + set name quicklink_$name - cd $$name + cd $$name end function ql-r -w ql -d 'Removes a quicklink' -a name - if not set -q name - echo (set_color red)"error: not enough arguments"(set_color normal) - return - end + if not set -q name + echo (set_color red)"error: not enough arguments"(set_color normal) + return + end - set -Ue quicklink_$name + set -Ue quicklink_$name end function ql-s -d 'Saves the working directory as a quicklink' -a name - if not set -q name - echo (set_color red)"error: not enough arguments"(set_color normal) - return - end + if not set -q name + echo (set_color red)"error: not enough arguments"(set_color normal) + return + end - set -U quicklink_$name $PWD + set -U quicklink_$name $PWD end complete -c ql -xa '(set -U | rg -or \'$1\' \'^quicklink_(.+) \')' diff --git a/scripts/fish/rebuild.fish b/scripts/fish/rebuild.fish index a82ab3e..eb1fdfb 100644 --- a/scripts/fish/rebuild.fish +++ b/scripts/fish/rebuild.fish @@ -1,5 +1,5 @@ function rebuild - $HOME/src/scripts/rebuild.rkt $argv + $HOME/src/scripts/rebuild.rkt $argv end ## EOF diff --git a/scripts/sharenix.fish b/scripts/sharenix.fish index 94c6c88..9fac2e1 100755 --- a/scripts/sharenix.fish +++ b/scripts/sharenix.fish @@ -1,22 +1,22 @@ #!/usr/bin/env fish function notify - notify-send -a sharenix -i dialog-information $argv + notify-send -a sharenix -i dialog-information $argv end function run_spectacle - set f "$HOME/Pictures/"(date "+%y%m%d-%H%M%S")".png" + set f "$HOME/Pictures/"(date "+%y%m%d-%H%M%S")".png" - spectacle -b $argv -n -o "$f" + spectacle -b $argv -n -o "$f" - if test -f "$f" - notify -u low -c transfer "Uploading..." - if sharenix -s Greyserv "$f" - notify -u low -c transfer.complete "Upload completed" - else - notify -u normal -c transfer.error "Upload failed" - end - end + if test -f "$f" + notify -u low -c transfer "Uploading..." + if sharenix -s Greyserv "$f" + notify -u low -c transfer.complete "Upload completed" + else + notify -u normal -c transfer.error "Upload failed" + end + end - rm "$f" + rm "$f" end diff --git a/scripts/text/mid.awk b/scripts/text/mid.awk index 382b716..f9832ac 100644 --- a/scripts/text/mid.awk +++ b/scripts/text/mid.awk @@ -1,5 +1,6 @@ -{ z = col - length - y = int(z / 2) - x = z - y - printf "%*s%s%*s\n", x, "", $0, y, "" +{ + z = col - length + y = int(z / 2) + x = z - y + printf "%*s%s%*s\n", x, "", $0, y, "" } diff --git a/scripts/text/newcomments.sed b/scripts/text/newcomments.sed index fdb77a0..80b5003 100755 --- a/scripts/text/newcomments.sed +++ b/scripts/text/newcomments.sed @@ -1,22 +1,22 @@ 1{ - i\ + i\ /* ---------------------------------------------------------------------------|\ * } 1,3{ - s/\/\// */ + s/\/\// */ } 4{ - c\ + c\ *\ * ---------------------------------------------------------------------------|\ * } 5{ - s/\/\/ \w\+\..: \(.\+\)/ * \1/ + s/\/\/ \w\+\..: \(.\+\)/ * \1/ } 6{ - i\ + i\ *\ * ---------------------------------------------------------------------------|\ */ diff --git a/scripts/text/newcomments2.sed b/scripts/text/newcomments2.sed index 6e3103c..a28ac3a 100755 --- a/scripts/text/newcomments2.sed +++ b/scripts/text/newcomments2.sed @@ -1,13 +1,13 @@ 1{ - i\ + i\ /* ---------------------------------------------------------------------------|\ * } 1,3{ - s/\/\// */ + s/\/\// */ } 4{ - c\ + c\ *\ * ---------------------------------------------------------------------------|\ */\ diff --git a/scripts/text/oldcomments.sed b/scripts/text/oldcomments.sed index 998301a..8c1d5e4 100755 --- a/scripts/text/oldcomments.sed +++ b/scripts/text/oldcomments.sed @@ -1,21 +1,25 @@ -$! { N - N - s/\/\/-+\|\n// - t m1 - b mE -:m1; s/ / MARKER/ - h - s/.+MARKER// - s/ /-/g - x - s/MARKER.+// - x - H - x - s/ \n-/ --/ - t m2 - b mE -:m2; N - N - s/\/\/\n//g -:mE; } +$! { + N + N + s/\/\/-+\|\n// + t m1 + b mE +:m1 + s/ / MARKER/ + h + s/.+MARKER// + s/ /-/g + x + s/MARKER.+// + x + H + x + s/ \n-/ --/ + t m2 + b mE +:m2 + N + N + s/\/\/\n//g +:mE +} diff --git a/vim/vimrc b/vim/vimrc index 92b1c6e..200a77b 100644 --- a/vim/vimrc +++ b/vim/vimrc @@ -64,10 +64,10 @@ set incsearch " tabulation (3 spaces, auto-indent when my muscle memory demands it) set autoindent -set expandtab +set noexpandtab set smarttab set shiftwidth=3 -set softtabstop=-1 +set tabstop=3 " limits, what/when/how to save and encodings set undolevels=10000 @@ -124,72 +124,72 @@ let g:polyglot_disabled=['c++11'] " gui and terminal specific settings if has('gui_running') - set guicursor+=i:hor10-Cursor - set guicursor+=a:blinkon0 - set guioptions=agit + set guicursor+=i:hor10-Cursor + set guicursor+=a:blinkon0 + set guioptions=agit - set lines=48 - set columns=80 + set lines=48 + set columns=80 else - " use 256-color terminal capabilities - set t_Co=256 - let base16colorspace=256 - set termguicolors + " use 256-color terminal capabilities + set t_Co=256 + let base16colorspace=256 + set termguicolors endif " GUI-specific settings if has('gui_running') - if has('gui_win32') - set guifont=PxPlus_IBM_EGA8:h12:cDEFAULT:qDRAFT - elseif has('gui_gtk') - set guifont=IBM\ Plex\ Mono\ weight=453\ 10 - set linespace=-2 - elseif has('gui_macvim') - set guifont=IBMPlexMono-Text:h14 - set linespace=-3 - set blurradius=20 - set macligatures - set macmeta - set transparency=10 - endif + if has('gui_win32') + set guifont=PxPlus_IBM_EGA8:h12:cDEFAULT:qDRAFT + elseif has('gui_gtk') + set guifont=IBM\ Plex\ Mono\ weight=453\ 10 + set linespace=-2 + elseif has('gui_macvim') + set guifont=IBMPlexMono-Text:h14 + set linespace=-3 + set blurradius=20 + set macligatures + set macmeta + set transparency=10 + endif endif " OS-specific settings if has('win32') - " windows sucks - let $PATH='G:\msys64\usr\bin;'.$PATH + " windows sucks + let $PATH='G:\msys64\usr\bin;'.$PATH - set shellslash + set shellslash - " netrw - let key='G:/msys64/home/marrub/.ssh/id_rsa' + " netrw + let key='G:/msys64/home/marrub/.ssh/id_rsa' - let g:netrw_cygwin=0 - let g:netrw_ignorenetrc=1 - let g:netrw_list_cmd="ssh -i " . key . " USEPORT HOSTNAME ls -Fa " - let g:netrw_ssh_cmd="ssh -i " . key - let g:netrw_scp_cmd="scp -q -i " . key - let g:netrw_sftp_cmd="sftp -i " . key - let g:netrw_silent=1 + let g:netrw_cygwin=0 + let g:netrw_ignorenetrc=1 + let g:netrw_list_cmd="ssh -i " . key . " USEPORT HOSTNAME ls -Fa " + let g:netrw_ssh_cmd="ssh -i " . key + let g:netrw_scp_cmd="scp -q -i " . key + let g:netrw_sftp_cmd="sftp -i " . key + let g:netrw_silent=1 - " gutentags - let g:gutentags_cache_dir=$VIM.'/vimtags/' + " gutentags + let g:gutentags_cache_dir=$VIM.'/vimtags/' - " swap files - set directory=$VIM/vimtemp// + " swap files + set directory=$VIM/vimtemp// else - if has('mac') - set rubydll=/usr/local/opt/ruby/lib/libruby.dylib - endif + if has('mac') + set rubydll=/usr/local/opt/ruby/lib/libruby.dylib + endif - " gutentags - let g:gutentags_cache_dir=$HOME.'/.vim/tags/' + " gutentags + let g:gutentags_cache_dir=$HOME.'/.vim/tags/' - " searching - set grepprg=rg\ --vimgrep\ -n + " searching + set grepprg=rg\ --vimgrep\ -n - " swap files - set directory=$HOME/.vim/temp// + " swap files + set directory=$HOME/.vim/temp// endif " set up colors and file types @@ -222,44 +222,44 @@ filetype indent on " Automatic headers fu! FillLine() ruby<< - tw = VIM::evaluate("&tw").to_i - tw = 80 if tw == 0 - lin = $curbuf.line - rep = tw - lin.length - 3 - if rep > 0 - $curbuf.line += " " + "-" * rep + "|" - end + tw = VIM::evaluate("&tw").to_i + tw = 80 if tw == 0 + lin = $curbuf.line + rep = tw - lin.length - 3 + if rep > 0 + $curbuf.line += " " + "-" * rep + "|" + end . endfu " File size fu! FileSize() - let fs=line2byte(line('$')+1)-1 - if fs < 0 - return "" - else - return fs - endif + let fs=line2byte(line('$')+1)-1 + if fs < 0 + return "" + else + return fs + endif endfu " Strip whitespace on buffer write fu! s:StripWhite() ruby<< - for ln in 1..$curbuf.length - rs = $curbuf[ln].rstrip - if $curbuf[ln] != rs - $curbuf[ln] = rs - end - end + for ln in 1..$curbuf.length + rs = $curbuf[ln].rstrip + if $curbuf[ln] != rs + $curbuf[ln] = rs + end + end . endfu " Close empty buffers fu! s:CloseEmptyBuffers() - let bufs = filter(range(1, bufnr('$')), 'buflisted(v:val) && empty(bufname(v:val)) && bufwinnr(v:val) < 0 && !getbufvar(v:val, "&modified")') - if !empty(bufs) - execute 'bdelete' join(bufs, ' ') - endif + let bufs = filter(range(1, bufnr('$')), 'buflisted(v:val) && empty(bufname(v:val)) && bufwinnr(v:val) < 0 && !getbufvar(v:val, "&modified")') + if !empty(bufs) + execute 'bdelete' join(bufs, ' ') + endif endfu " Commands -------------------------------------------------------------------|