4

I often save :w and commit to SVN svn commit -m "Ticket 351" as two operations. Is there a way to combine them into a single operation so that I might just :Enter when the need arises? I don't want to map a key as I will sometimes have to change the commit message.

Thanks.

1
  • 1
    Remember, @: to repeat the last command is probably quicker Commented Apr 9, 2012 at 21:18

3 Answers 3

6

Use | as a command separator (see :help :bar):

:w|!svn commit -m foo 
Sign up to request clarification or add additional context in comments.

2 Comments

Thank you, it is exactly the separator that I needed. So naive that I didn't know the term. Thanks!
@caligula: Yes, I couldn't mark the answer as accepted for a few minutes. I've done it now!
2

You could also write a function. E.g. something like;

function! Commit(msg) write let response = system('svn commit -m "' . a:msg . '"') echo response endfunction 

Then later:

:call Commit('ticket 1234') 

1 Comment

Thank you, I will consider that.
1

@JoshLee gives the literal answer. However, why is a keybinding unacceptable to you?

nnoremap <Leader>s :w<bar>!svn commit -m<space> 

will still let you write your commit message before you push Enter...

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.