Monday, April 13, 2015

Re: How to omit "x subsitutions on y lines" in status bar when s[ubstitute] command is used?

Am 2015-04-13 14:30, schrieb Igor Forca:
> Hi,
> I use Vim 7.4 on Windows 7. I have a plan text file that I need to do
> many find/replace on text. I have written bellow vimscript and save it
> in myvimfile.vim file.
>
>
> " map comma as a leaderkey
> :let mapleader = ","
>
> " write function
> function! ReplaceIt()
> %s/^\(.\+\)$/('\1');/ge
> %s/^/\=line(".")/ge
> " many more substitute commands
> endfunction
>
> " execute function with: ,x keyboard shortcut (, being as a leader
> key).
> :nnoremap <leader>x :call ReplaceIt()<CR>
>
>
> Then in my plain text file I source the vim script file with:
> :source myvimfile.vim
> and then when needed I execute: ,x keyboard shortcut to fire
> substitute commands on my plan text file. Script is working fine it
> does what I want without a problem. The only think I hate is that for
> every substitute command "x substitutions on y lines" messages appear
> in status bar (see attached print-screen). I have many substitute
> commands in function and so it is really annoying to have bunch of
> this information in status bar. Is there a way this substitute info
> are not displayed in status bar?

Use :silent modifier. You probably also want to use the 'g' flag of the
:s
command only when 'gdefault' is not set.

Best,
Christian

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments: