mirror of
https://github.com/wellle/tmux-complete.vim.git
synced 2026-05-26 11:24:33 +02:00
Escape matched word, Create regex in vim script
This commit is contained in:
@@ -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
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user