use vim as package management tool
- 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: