New answers tagged

5

I think I figured this out myself. I believe the problem was that my job was being deleted before the zip command finished. I guess Vim deletes a job object if there are no references to it. So the solution was to turn my job variable into a script-local variable to prevent it from being deleted. So, I changed my line let job = ... to let s:job = .... I ...


0

Afaik this string is hardcoded into vim (and translated). You would have to patch and recompile vim yourself. The relevant code is here (thanks @Rich).


3

It's possible to get Vim to handle all the necessary escaping for you by calling shellescape(). If you pass in a non-zero value for its second argument, this will escape characters in a manner suitable for passing as a command line argument to a ! command or filter: :exe "'<,'>!awk" shellescape('!x[$0]++', 1) You can wrap this into a command that ...


3

From :h :range! Filter {range} lines through the external program {filter}. Vim replaces the optional bangs with the latest given command and appends the optional [arg]. The second ! is replaced with last shell cmd, I guess it expand to some command that read the temp file, escape it should work: '<,'>! awk '\!a[$...


4

When I run :%!awk '!x[$0]++' in my vim, I get E34: No previous command. I fixed it by escaping the ! (see :help :!). Mapping: " ~/.vim/autoload/uniq.vim function uniq#operator(type, ...) abort let l:visual = a:0 if l:visual '<,'>!awk '\!x[$0]++' else '[,']!awk '\!x[$0]++' endif endfunction " ~/.vim/plugin/uniq.vim nnoremap U :set ...


1

The output you're getting in your terminal that is messing up the text in Vim is likely from the running sxhkd binary that you're spawning in background. As a possible way to fix this, you can redirect its output to /dev/null when you launch it from the autocmd. Instead of ending the external command with: sxhkd & Use instead: sxhkd >/dev/null 2&...


Top 50 recent answers are included