Skip to content

jonathanpoelen/zsh_scripts

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Docs

Each file is self-documented. Some widgets support zstyle option and NUMERIC variable.

Config

# in ~/.zshrc
ZSH_SCRIPT=the-project-path
fpath+=(${ZSH_SCRIPT}/widgets ${ZSH_SCRIPT}/functions)
autoload list-of-function-and-widget-used
zle -N a-widget
zle -N an-another-widget
# ...

bindkey bindkey '^[^K' jln-kill-arg # bind a widget on ctrl+alt+k

Some examples

jln-glob

alias ng='jln-glob numeric ; jln-glob-pop' # sort numerically

# 3 files listed in lexicographic order
echo *
# file-1 file-11 file-2

# 3 files listed in natural order
ng echo *
# file-1 file-2 file-11

smart-sudo

alias l='ls -CF'
smart-sudo l # run sudo ls -CF

Sudo replacement

# in ~/.zshrc
alias sudo='nocorrect smart-sudo'
# or alias sudo=smart-sudo
compdef _sudo smart-sudo

jln-transpose-arg

$ cp a-file 'another file'
                          ^ cursor
# jln-transpose-arg
$ cp 'another file' a-file
                          ^ cursor
$ cp a-file 'another file' one-more-file
        ^ cursor
# jln-transpose-arg
$ cp 'another file' a-file one-more-file
                           ^ cursor

jln-save-command-line

$ git log -p --
# jln-save-command-line
# we continue to write
$ git log -p -- unfichier
# after validation, the command line is filled with the saved one
$ git log -p --

Tests

./test/all.zsh [function|widget...]

Releases

No releases published

Packages

 
 
 

Languages