Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: scratchpad text



On Oct 26,  7:43pm, Eric Smith wrote:
}
} > Replace sc/rc with tsl/fsl to use the status line if your terminal has
} > one (which you can test for by examining $terminfo[hs]).
} 
} [eric@pepper ~] $ echo $terminfo[hs]
} no
} 
} How would I change this?

Use a different terminal emulator ...


On Oct 26,  7:50pm, Eric Smith wrote:
}
} Getting greedy now:
} May we have colours?
} 
} And a nice easy way to recall the scratchpad text to edit at will.

Well ... combining this with my previous suggestion ...

    autoload -Uz sticky-note
    zle -N sticky-note
    sticky-note -b

    zle-line-init() {
      local STICKYFILE=${STICKYFILE:-$HOME/.zsticky}
      local STICKYSIZE=${STICKYSIZE:-1000}

      if [[ -n "$STICKYFILE" && -s "$STICKYFILE" ]]
      then
	fc -ap $STICKYFILE $STICKYSIZE $STICKYSIZE
	print -nr "$terminfo[sc]$terminfo[home]"
	print -nr "$bg[yellow]$fg[black]"
	print -n -- "$(fc -n -l -1)"
	print -nr "$reset_color$terminfo[rc]"
      fi
    }
    zle -N zle-line-init

The print -n -- "$(fc ...)" is there to convert e.g. "\n" in the stored
history into a real newline in the display.  I may need to fix that in
sticky-note itself.

You can pick your own keybinding to invoke sticky-note as a widget,
e.g.

    bindkey ^X^Y sticky-note

You can then move up and down through previous notes to edit.



Messages sorted by: Reverse Date, Date, Thread, Author