Skip to content

Instantly share code, notes, and snippets.

@ericbn
ericbn / .vimrc
Last active Sep 19, 2021
Vim Powerline-like status line without the need of any plugin
View .vimrc
" Statusline (requires Powerline font)
set statusline=
set statusline+=%(%{&buflisted?bufnr('%'):''}\ \ %)
set statusline+=%< " Truncate line here
set statusline+=%f\ " File path, as typed or relative to current directory
set statusline+=%{&modified?'+\ ':''}
set statusline+=%{&readonly?'\ ':''}
set statusline+=%= " Separation point between left and right aligned items
set statusline+=\ %{&filetype!=#''?&filetype:'none'}
set statusline+=%(\ %{(&bomb\|\|&fileencoding!~#'^$\\\|utf-8'?'\ '.&fileencoding.(&bomb?'-bom':''):'')
View test_keys.zsh
getseq () {
trap "stty ${$(stty -g 2>/dev/null):-echo -raw}" 0 1 2 15
stty raw -echo
local k='' seq='' i
for ((i=10; i>0; --i)); do
read -t -k 1 k && break
sleep 1
done
[[ -n $k ]] || return 1
[[ $k = $'\012' || $k = $'\015' || $k = ' ' ]] && return 0
View test_keys_output.txt
# xterm on Android termux
TERM=xterm-256color
Wait for prompt before pressing each key.
Press SPACE to skip to the next key.
Don't press any key within 10 seconds to abort.
Ready [y/N]? y
) Started application mode
) F1: ^[OP
) F2: ^[OQ
) F3: ^[OR