Tag Info

Hot answers tagged

18

It's possible to do this without a plugin using the w command, so the buffer contents can be used in a shell command: :w !diff -au "%" - > changes.patch (% is substituted with the path of the file being edited, - reads the buffer from stdin)


6

The indexed color palette has the actual rendering open to interpretation - on actual hardware, there were different standards (especially brown vs. dark yellow, brown is more useful and nicer to look at). Just check out this: https://en.wikipedia.org/wiki/Color_Graphics_Adapter On terminal emulators, it depends on the configuration. Most emulators have a ...


4

You almost have it with your second command. You did it correctly with the first, just use the same shell sequence expansion: vim directory_{0..10}/results/output.txt You should see something in the shell about opening 11 files. Then you can use vim to iterate through each one.


4

kJ k: move up a line J: join next line.


3

This is a typical case where a recursive macro can help. Just put your key sequence in a recursive macro and run it. Summarizing the wiki article, in order not to anger the SE gods: qqq - clear the q register qq - start recording a macro q /\msin\zs(Enter - find sin(, and leave the cursor on ( cs(] - replace (...) by [...] (use ] instead of [ to avoid ...


2

grep -oP '(?<="title":").*?(?=")' <INPUT_FILE> Explanation grep -oP: Use grep, printing only matches -o using Perl syntax -p. (?<="title":"): Perl lookbehind. Match a string that has "title":" before it. .*?: The actual part to match (and print). Match a "non-greedy" amount of characters before the lookahead (next). (?="): Perl lookahead. ...


1

You could also filter the buffer through diff using the %! syntax: :%! diff -au "%" - This will fill the buffer with the diff, rather than writing it to disk; you may want to set readonly so you don't clobber the original by accident (OTOH, that shouldn't be a serious problem because you have the file under version control, right?). Of course, it helps ...



Only top voted, non community-wiki answers of a minimum length are eligible