dot

packages and services management
Log | Files | Refs | README

commit b87b78ab0afe3331968ae4fe0b5568a657bdb733
parent a59370d7afc5be8b69dd02ae343fdbe76810fa7f
Author: josuah <mail@josuah.net>
Date:   Sat,  3 Sep 2016 00:12:42 +0200

Added alignment tool.

Diffstat:
MREADME | 1+
Abin/align | 26++++++++++++++++++++++++++
Mbin/complete | 56++++++++++++++++++++++++++++++++++++++++----------------
Abin/tags | 125+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Atags | 0
Mvim/.vimrc | 34+++++++++++++++++++++-------------
6 files changed, 213 insertions(+), 29 deletions(-)

diff --git a/README b/README @@ -77,6 +77,7 @@ VIM PLUGINS lion http://github.com/tommcdo/vim-lion supertab http://github.com/ervandew/supertab multiple http://github.com/terryma/vim-multiple-cursors + fzy http://github.com/Dkendal/fzy-vim PROJECTS diff --git a/bin/align b/bin/align @@ -0,0 +1,26 @@ +# /\ __ +# _____ / / \/ _____ ____ +# .'__ // / /\ .'__ // __ \ +# / /_/ // / / // /_/ // / / / +# \____/ \/ \/_\__ / \/ \/ - align text at char from stdin +#==============\__,-"=========================================================== + +NL=' +' + +lines="$(tee)" +align="$( + dd if=/dev/tty bs=1 count=1 2> /dev/null +)" +max=0 + +for line in $lines +do + current="${line%%$align*}" + [ ${#current} -gt $max ] && max="${#current}" +done + +printf '%s\n' "$lines" | while IFS="$NL" read -r line +do + printf "%-${max}s%s%s\n" "${line%%$align*}" "$align" "${line#*$align}" +done diff --git a/bin/complete b/bin/complete @@ -5,22 +5,46 @@ # / /__ / /_/ // / / / / // /_/ // // ____// / / ____/ # \____\ \____/ \/ \/ \// ____/ \/ \___\ \/ \___\ - with word in a file #=========================\/==================================================== -# -# print a list of words that can be candidates for a completion -# -# USAGE: -# complete PREFIX -# -# PREFIX part to match from the words, and to remove from the candidates. -# -# -NL=' +help=' +NAME + Complete - complete word or line from stdin with candidates from a file +USAGE + complete OPTION FILE + +DESCRIPTION + STDIN part to match from the words, and to remove from the candidates. + FILE file to search candidates from +OPTION + -w complete by word + -l complete by line +' NL=' ' -sed 's/[[:space:]]/\n/g' | sort -u #| while read word -#do [ -z "${word##$prefix*}" ] && printf '%s\n' "$word" -#done | fzy | { -# IFS="$NL" read -r word -# printf '%s\n' "${word#$prefix}" -#} +[ "$#" = 0 ] && printf '%s\n' "$help" && exit 0 +while [ "$#" -gt 0 ] +do + case "$1" in + -w | -l ) ACTION="$1" ;; + -* ) printf '%s\n' "$help" && exit 0 ;; + * ) FILE="$1" ;; + esac + + shift +done + +PREFIX="$(tee)" + +case "$ACTION" in +-w ) + sed 's/[[:space:]]/\n/g' "$FILE" | sort -u | while read word + do [ -z "${word##$PREFIX*}" ] && printf '%s\n' "$word" + done | fzy | { + IFS="$NL" read -r word + printf '%s\n' "$word" + } + ;; +-l ) + fzy -q "$PREFIX" < "$FILE" + ;; +esac diff --git a/bin/tags b/bin/tags @@ -0,0 +1,125 @@ +$ feeds /^NR > 1 && NR < $(NR-1) {$/ +BEGIN peax 10 +BOOKMARKS bkm 9 +C0 adagio 12 +END peax 25 +FEEDS feeds 9 +FILTER swiper 9 +IFS irc 268 +IFS updd 7 +LAYOUT www 9 +NF feeds 56 +NICK irc 11 +NL comment 10 +NL complete 18 +NL run 11 +PROGRAMS src 8 +R dna 15 +TAB attach 12 +c1 feeds 54 +c2 feeds 57 +c3 feeds 60 +check_read feeds /^check_read()$/ +cmd todo 7 +compile src /^compile()$/ +connect irc /^connect()$/ +copied lsync 54 +d1 lsync 43 +directories lsync 54 +directories www 37 +dna dna 94 +download src /^download()$/ +error src /^error()$/ +exit comment 53 +exit lsync 42 +f2 dna 18 +f3 dna 18 +f4 dna 18 +f5 dna 18 +f6 dna 18 +f7 dna 18 +get feeds /^get()$/ +get feeds 190 +h peax 21 +help lsync 9 +help src 157 +identical lsync 54 +info src /^info()$/ +input irc /^input()$/ +input irc 265 +l1 fig 22 +l1 fig 30 +l1 fig 38 +l1 fig 46 +l1 fig 54 +l1 fig 62 +l1 fig 70 +l1 fig 78 +l1 fig 86 +l1 fig 94 +l1 fig 102 +l1 fig 110 +l1 fig 118 +l1 fig 126 +l1 fig 134 +l1 fig 142 +l1 fig 150 +l1 fig 158 +l1 fig 166 +l1 fig 174 +l1 fig 182 +l1 fig 190 +l1 fig 198 +l1 fig 206 +l1 fig 214 +l1 fig 222 +l1 fig 230 +l1 fig 238 +l1 fig 246 +l1 fig 254 +l1 fig 262 +l1 fig 270 +l1 fig 278 +l1 fig 286 +l1 fig 294 +l1 fig 302 +l1 fig 310 +line updd 11 +list www /^list()$/ +max1 feeds 62 +max2 feeds 63 +middle comment 34 +middle comment 37 +middle comment 49 +music run 40 +nucleotide dna 87 +opt run 35 +opt run 36 +opt run 37 +opt run 38 +opt run 39 +opt run 42 +opt src 125 +output irc /^output()$/ +overwritten lsync 54 +parse feeds /^parse()$/ +parse www /^parse()$/ +path www 41 +print_msg irc /^print_msg()$/ +r lsync 41 +remove src /^remove()$/ +shift lsync 39 +start comment 28 +start comment 31 +start comment 40 +start comment 43 +start comment 46 +t todo 13 +tag bkm 22 +title www 41 +tmp piped 8 +todo todo 1 +v lsync 40 +view feeds /^view()$/ +view feeds 191 +website www 39 diff --git a/tags b/tags diff --git a/vim/.vimrc b/vim/.vimrc @@ -38,20 +38,28 @@ endfunction " MAPPINGS "------------------------------------------------------------------------------- -map <Space> : -map <Space><Space> : -map <Space>s :set -map <Space>w :w<cr> -map <Space>e :call FzyCommand("find -type f", ":e")<cr> -map <Space>v :call FzyCommand("find -type f", ":vs")<cr> -map <Space>g :exec ':' system("swiper '" . expand("%:p") . "'")<cr> +let mapleader = ' ' -map col :set list! <cr>:set list? <cr> -map con :set number!<cr>:set number?<cr> -map cop :set paste! <cr>:set paste? <cr> +map <leader> : +map <leader><leader> : +map <leader>s :set +map <leader>w :w<cr> +map <leader>e :call FzyCommand("find -type f", ":e")<cr> +map <leader>v :call FzyCommand("find -type f", ":vs")<cr> +map <leader>g :exec ':' system("swiper '" . expand("%:p") . "'")<cr>:redraw!<cr> -map ]<Space> mzo<Esc>k`z -map [<Space> mzO<Esc>k`z<C-e> +map col :set list! <cr>:set list? <cr> +map con :set number! <cr>:set number? <cr> +map cop :set paste! <cr>:set paste? <cr> +map coh :set hlsearch! <cr>:set hlsearch? <cr> + +map ]<leader> mzo<Esc>k`z +map [<leader> mzO<Esc>k`z<C-e> + +imap <c-n> <esc>viW!complete -w %<cr>:redraw!<cr>Ea +imap <c-x><c-l> <esc>V! complete -l %<cr>:redraw!<cr>A + +vmap <tab> !align<cr>:redraw!<cr> " ABBREVIATIONS @@ -71,4 +79,4 @@ highlight SpecialKey cterm=bold ctermfg=0 " PLUGINS "------------------------------------------------------------------------------- -pathogen#infect() +execute pathogen#infect()