From 2b851312434213e81b0ecb5d0478d07fd4b045e8 Mon Sep 17 00:00:00 2001 From: Frank Terbeck Date: Mon, 28 Nov 2011 22:05:06 +0100 Subject: [PATCH] zshrc: Move linenr to its own file Signed-off-by: Frank Terbeck --- etc/zsh/zshrc | 23 ----------------------- usr_share_grml/zsh/functions/linenr | 21 +++++++++++++++++++++ 2 files changed, 21 insertions(+), 23 deletions(-) create mode 100644 usr_share_grml/zsh/functions/linenr diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index 6409850..8726dbc 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -3589,29 +3589,6 @@ fi # fi #} -#f2# Print a specific line of file(s). -linenr () { - emulate -L zsh - if [ $# -lt 2 ] ; then - print "Usage: linenr [,] " ; return 1 - elif [ $# -eq 2 ] ; then - local number=$1 - local file=$2 - command ed -s $file <<< "${number}n" - else - local number=$1 - shift - for file in "$@" ; do - if [ ! -d $file ] ; then - echo "${file}:" - command ed -s $file <<< "${number}n" 2> /dev/null - else - continue - fi - done | less - fi -} - #f2# Find history events by search pattern and list them by date. whatwhen() { emulate -L zsh diff --git a/usr_share_grml/zsh/functions/linenr b/usr_share_grml/zsh/functions/linenr new file mode 100644 index 0000000..20d3862 --- /dev/null +++ b/usr_share_grml/zsh/functions/linenr @@ -0,0 +1,21 @@ +# Print a specific line of file(s). +emulate -L zsh + +if [ $# -lt 2 ] ; then + print "Usage: linenr [,] " ; return 1 +elif [ $# -eq 2 ] ; then + local number=$1 + local file=$2 + command ed -s $file <<< "${number}n" +else + local number=$1 + shift + for file in "$@" ; do + if [ ! -d $file ] ; then + echo "${file}:" + command ed -s $file <<< "${number}n" 2> /dev/null + else + continue + fi + done | less +fi -- 2.1.4