diff options
Diffstat (limited to 'stow/vim/.vim/ftplugin/sh')
-rw-r--r-- | stow/vim/.vim/ftplugin/sh/sh.vim | 3 | ||||
-rw-r--r-- | stow/vim/.vim/ftplugin/sh/snippets/template.txt | 18 |
2 files changed, 13 insertions, 8 deletions
diff --git a/stow/vim/.vim/ftplugin/sh/sh.vim b/stow/vim/.vim/ftplugin/sh/sh.vim index cc52e08..58d39fe 100644 --- a/stow/vim/.vim/ftplugin/sh/sh.vim +++ b/stow/vim/.vim/ftplugin/sh/sh.vim @@ -11,13 +11,12 @@ setlocal textwidth=110 let mapleader = " " nnoremap <buffer> <leader>C :sp ~/.vim/ftplugin/sh/sh.vim<CR><CR> -nnoremap <buffer> <leader>sh :read ~/.vim/ftplugin/sh/snippets/template.txt<CR><CR> nnoremap <buffer> <leader>+x :!chmod 744 %<CR><CR> nnoremap <buffer> <leader>x :w<CR>:!./%<Space> nnoremap <buffer> <leader>X :w<CR>:!./%<CR><CR> -nnoremap <buffer> <leader>e :Errors<CR> let mapleader = "," +inoremap <buffer> <leader>sh <Esc>:read ~/.vim/ftplugin/sh/snippets/template.txt<CR><CR> inoremap <buffer> <leader>if <Esc>:read ~/.vim/ftplugin/sh/snippets/if.txt<CR>kdd/<+++><CR>cf> inoremap <buffer> <leader>case <Esc>:read ~/.vim/ftplugin/sh/snippets/case.txt<CR>kdd/<+++><CR>cf> diff --git a/stow/vim/.vim/ftplugin/sh/snippets/template.txt b/stow/vim/.vim/ftplugin/sh/snippets/template.txt index 64d3a2e..171dcf8 100644 --- a/stow/vim/.vim/ftplugin/sh/snippets/template.txt +++ b/stow/vim/.vim/ftplugin/sh/snippets/template.txt @@ -4,7 +4,15 @@ # # Usage: template.sh [-ac] [-b OPTARG] FILE... -usageMessage="Usage: template.sh [-ac] [-b OPTARG] FILE..." +usageMessage="Usage: ${0} [-ac] [-b OPTARG] FILE..." + +error() { + printf '%s error: %s\n' "$0" "$*" >&2 +} + +errorAndUsage() { + printf '%s error: %s\n%s\n' "$0" "$*" "$usageMessage" >&2 +} # Process options while getopts ':ab:c' opt; do @@ -15,7 +23,7 @@ while getopts ':ab:c' opt; do ;; 'b' ) - echo b $OPTARG + echo b "$OPTARG" ;; 'c' ) @@ -23,11 +31,9 @@ while getopts ':ab:c' opt; do ;; '?' ) - printf "${usageMessage}\n" + printf '%s\n' "$usageMessage" exit 1 esac done -shift $(($OPTIND - 1)) - -<++> +shift $((OPTIND - 1)) |