Escape matched word, Create regex in vim script

This commit is contained in:
Daniel K
2014-03-19 08:33:30 +01:00
parent 041c290591
commit c2efcf4ad5
2 changed files with 4 additions and 4 deletions
+1 -1
View File
@@ -10,7 +10,7 @@ function! CompleteScript(findstart, base)
endif
" find months matching with "a:base"
let command = 'sh ' . shellescape(expand(s:script)) . ' ' . shellescape(a:base)
let command = 'sh ' . shellescape(expand(s:script)) . ' ' . shellescape('^' . escape(a:base, '*^$][.\') . '.')
let words = system(command)
for word in split(words)
call complete_add(word)
+3 -3
View File
@@ -19,11 +19,11 @@ grep -v -F "$(tmux display-message -p '11-#{session_id} ')" |
cut -d' ' -f2 |
# capture panes
xargs -n1 tmux capture-pane -J -p -t |
# filter on pattern and append replaced copy
sed -e "/$1./p;s/[^a-zA-Z0-9_]/ /g" |
# copy lines and split words
sed -e 'p;s/[^a-zA-Z0-9_]/ /g' |
# split on spaces
tr -s '[:space:]' '\n' |
# filter out words not beginning with pattern
grep "^$1." |
grep "$1" |
# sort and remove duplicates
sort -u