summary refs log tree commit diff stats
path: root/user/zsh/zshrc
diff options
context:
space:
mode:
authorAlan Pearce2023-03-25 21:39:23 +0100
committerAlan Pearce2023-03-25 21:39:23 +0100
commit363c634d3af8bc81b1b9a66e6a07dcc12aaf7983 (patch)
tree72c8d7ac701b0a974fb7fd634498d2f7c5f67b17 /user/zsh/zshrc
parent85aed2343af26b278eb8254846554881f8e35330 (diff)
downloadnixfiles-363c634d3af8bc81b1b9a66e6a07dcc12aaf7983.tar.lz
nixfiles-363c634d3af8bc81b1b9a66e6a07dcc12aaf7983.tar.zst
nixfiles-363c634d3af8bc81b1b9a66e6a07dcc12aaf7983.zip
zsh: add `field` as a simplified `cut` that works more like `awk`
Diffstat (limited to 'user/zsh/zshrc')
-rw-r--r--user/zsh/zshrc5
1 files changed, 5 insertions, 0 deletions
diff --git a/user/zsh/zshrc b/user/zsh/zshrc
index d843ce2f..dce20aeb 100644
--- a/user/zsh/zshrc
+++ b/user/zsh/zshrc
@@ -21,6 +21,11 @@ dc () {
 }
 compdef '_dispatch docker-compose docker-compose' dc
 
+field () {
+  awk "{ print \$${1:-0} }"
+}
+alias f=field
+
 backward-argument () {
   local WORDCHARS="\!\`~#@$%^&*()-_=+[{]}\|;:,<.>/?\'\""
   zle backward-word