use vim as package management tool

Par mc, 23 octobre 2009 18 h 34 min

- i wrote some commands that gives me a list of rpm archives i can install on my system.
- i piped the result to vim –
- now i want to search on the list, install some of those packages and keep track on what i installed.

first: split the screen:

:sp /tmp/installed_rpm

now you get:
- the installed at top
- the candidates at bottom

then write a macro:

:nnoremap ,i dd<c-w>kp:!yum install <c-r><c-a><cr>

now, you just have to put the cursor on a candidate and type ,i to install and keep track. yes it works: i’m using it right now :)

the macro means:

:nnoremap ,i  # when you type ,i in normal mode 
dd            # delete the line
<c-w>k        # jump to the top window
p             # paste the line
:!yum install # begin to write a shell command: yum install
<c-r><c-a>    # append the current line to the command
              # :h c_ctrl-r_ctrl-a for futher information
<cr>          # validate the shell command by typing <cr> [ENTER]

those kind of things is why i don’t ever consider using another editor.

Related posts:

  1. copier/coller dans vim
  2. rollback double encoding
  3. vim: my 2 cents yaml debugger
  4. je fourre mon vi partout où je peux
  5. perl onliners, vim and iso2709

Laisser un commentaire

Panorama Theme by Themocracy