Posts tonen met het label vim. Alle posts tonen
Posts tonen met het label vim. Alle posts tonen

vrijdag 30 maart 2018

Using search and replace in vim

:s/\v(.*)/- \1/g (very magic)

:s/\(.*\)/- \1/g

The above commands do the same thing: adding a dash before the line. 
So, 
What shall we do with the drunken sailor?

becomes:
- What shall we do with the drunken sailor?

donderdag 9 november 2017

Marvim plugin

De Marvim plugin is een vim plugin. Deze is in staat om macro's te saven.
Dit doe je door "qq" te gebruiken. Met andere woorden je creert gewoon een macro. Deze save je met een naam met F3.

Vervolgens kun je deze zoeken met F2 en deze opnieuw uitvoeren.

De macro's worden opgeslagen in .marvim in de home directory.

Let op: de macro's moeten met "qq" opgenomen worden. "qe" bijvoorbeeld werkt niet.


vrijdag 4 augustus 2017

Moving through code


"Browsing through code
:set mps+=<:>

matchpairs does the job for me in Vim. See above.

This is the page that discusses it and more: http://vim.wikia.com/wiki/Moving_to_matching_braces

There is also a vim plugin that offers more but I haven't looked into it.

Thank you for your answers, both of you.

maandag 26 juni 2017

Putting brackets around words

What shall we do with the drunken sailor early in the morning

"What", "shall", "we", "do", "with", "the", "drunken", "sailor", "early", "in", "the", "morning",

And it can be done in Vim with this command:
%s/\w\+/"&",/g

dinsdag 13 juni 2017

Selecting text from SVG files

  1. :vnew is more effcient than :vsplit followed by :enew.
  2. yit is more efficient than vit followed by y.
  3. Okay I'm being facetious. Sorry. To actually answer your question, macros (:help complex-repeats) can playback commands that move the cursor to other windows, so you can use them for this sort of task. You might need to tweak this to work with the contents of your file, but the basic steps are:
    1. /tspan<cr>: Search for the first tag.
    2. f>l: Jump into the element contents.
    3. qq: Start recording into the q register.
    4. yit : Yank the text.
    5. ctrl-w w: Move cursor to your other window.
    6. p: Paste the yanked text.
    7. ctrl-w p: Move cursor back into the first window.
    8. n: Jump to start of next tag.
    9. q: Stop recording and save the macro.

    You can then play the macro back 31 times with the command: 31@q.
  4. You could probably also do it with a :global command.

    https://vi.stackexchange.com/questions/12619/more-efficient-way-of-yanking-text-out-of-tags

Enlarging Libreoffice window completely with command

 You can open the LibreOffice window completely by pressing the CTRL+Shift+J keys together.