Am 2014-10-23 02:49, schrieb Romel Khan:
> When I save a file using vim, it displays the filename, number of
> lines and number of characters being saved. Eg: "temp" 4L, 228C
> written
> How can I setup vim so it doesn't display this?
You can use the :silent modifier to suppresses it.
Knowing this, you could define your own command:
:com! -bang -range=% -complete=file -nargs=? W :sil
<line1>,<line2>write<bang> <args>
And using the cmdalias¹ plugin you could alias :W to :w
Best,
Christian
¹) There appear to be at least 2 different cmdalias plugins:
http://www.vim.org/scripts/script.php?script_id=4250
http://www.vim.org/scripts/script.php?script_id=746
--
--
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.
Wednesday, October 22, 2014
Re: FileType event not triggered for make/automake files?
On Thursday, October 23, 2014 7:58:18 AM UTC+13, Shahbaz Youssefi wrote:
> I have an issue where it seems like make and automake file types don't trigger the FileType event.
It seems likely you're getting vim's own file type stuff. What does
:verbose set sw? et? sts?
tell you?
(Note that setting expandtab for old-style make files is bad, they depend on actual tab characters by design.)
If I edit the make file I use for building vim, and run that, I get
shiftwidth=8
Last set from modeline
noexpandtab
Last set from /usr/local/share/vim/vim74/ftplugin/make.vim
softtabstop=0
Last set from /usr/local/share/vim/vim74/ftplugin/make.vim
Read :h file-type
--
--
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.
> I have an issue where it seems like make and automake file types don't trigger the FileType event.
It seems likely you're getting vim's own file type stuff. What does
:verbose set sw? et? sts?
tell you?
(Note that setting expandtab for old-style make files is bad, they depend on actual tab characters by design.)
If I edit the make file I use for building vim, and run that, I get
shiftwidth=8
Last set from modeline
noexpandtab
Last set from /usr/local/share/vim/vim74/ftplugin/make.vim
softtabstop=0
Last set from /usr/local/share/vim/vim74/ftplugin/make.vim
Read :h file-type
--
--
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.
How to set vim to not display filename info when saving
When I save a file using vim, it displays the filename, number of lines and number of characters being saved. Eg: "temp" 4L, 228C written
How can I setup vim so it doesn't display this?
--
--
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.
How can I setup vim so it doesn't display this?
--
--
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.
FileType event not triggered for make/automake files?
I have an issue where it seems like make and automake file types don't trigger the FileType event.
I have the following line in my ~/.vimrc file:
au FileType config,vim,tex,make,sh,automake set expandtab | set shiftwidth=2 | set softtabstop=2
which correctly sets shiftwidth and softtabstop for all file types config, vim, tex and sh, but doesn't affect files of type make and automake. I don't have any other au commands addressing make and automake separately.
Can someone verify whether this works with your vim? If not, is it a known bug?
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 2 2014 19:39:47)
Included patches: 1-52
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by buildd@
Huge version with GTK2-GNOME GUI. Features included (+) or not (-):
.vimrc file can be found online at https://gist.github.com/ShabbyX/3691170
--
--
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.
I have the following line in my ~/.vimrc file:
au FileType config,vim,tex,make,sh,automake set expandtab | set shiftwidth=2 | set softtabstop=2
which correctly sets shiftwidth and softtabstop for all file types config, vim, tex and sh, but doesn't affect files of type make and automake. I don't have any other au commands addressing make and automake separately.
Can someone verify whether this works with your vim? If not, is it a known bug?
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Jan 2 2014 19:39:47)
Included patches: 1-52
Modified by pkg-vim-maintainers@lists.alioth.debian.org
Compiled by buildd@
Huge version with GTK2-GNOME GUI. Features included (+) or not (-):
.vimrc file can be found online at https://gist.github.com/ShabbyX/3691170
--
--
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.
Re: replace submatches in matchlist
On Mi, 22 Okt 2014, BimbaLaszlo wrote:
> I don't understand what do you like to tell me... o_O The matchlist()
> gives me all of the submatches, but i like to modify the values of
> those, then "compile" the original line again.
>
> * Get the submatches from line ('some AfooBar' -> 'A', 'B'),
> * modify those ('A' -> 'C', 'B' -> '),
> * 'compile' the original line. ('some CfooDar'
Because it is not possible to to so ;)
I must admit, I do not entirely understand what you want, I just think
the closest you'll get is using submatch() to access your various
subpatterns and since you talked about modifying complete lines, that's
what the :s command is for.
(Note, for complex things, you can call a function in the replacement
part, and I think in that function you still have access to all those
submatches(), so that would be my first try).
Best,
Christian
--
Wie man sein Kind nicht nennen sollte:
Hans Dampf
--
--
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.
> I don't understand what do you like to tell me... o_O The matchlist()
> gives me all of the submatches, but i like to modify the values of
> those, then "compile" the original line again.
>
> * Get the submatches from line ('some AfooBar' -> 'A', 'B'),
> * modify those ('A' -> 'C', 'B' -> '),
> * 'compile' the original line. ('some CfooDar'
Because it is not possible to to so ;)
I must admit, I do not entirely understand what you want, I just think
the closest you'll get is using submatch() to access your various
subpatterns and since you talked about modifying complete lines, that's
what the :s command is for.
(Note, for complex things, you can call a function in the replacement
part, and I think in that function you still have access to all those
submatches(), so that would be my first try).
Best,
Christian
--
Wie man sein Kind nicht nennen sollte:
Hans Dampf
--
--
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.
Re: replace submatches in matchlist
2014. október 22., szerda 17:44:10 UTC+2 időpontban Christian Brabandt a következőt írta:
> On Mi, 22 Okt 2014, BimbaLaszlo wrote:
>
>
>
> > Is there a good way to replace submatches in matchlist() and modify the
>
> > original line with it? I like to write a script which modifies all of the
>
> > submatches in a pattern in one step.
>
> >
>
> > For example the original line is 'some AfooBar' and i like to change it to
>
> > 'some CfooDar':
>
> >
>
> > let pattern = '\(A\)foo\(B\)'
>
> > let line = 'some AfooBar'
>
> > let found = matchlist( line, pattern )
>
> >
>
> > The 'found' contains "['AfooB', 'A', 'B', '', '', '', '', '', '', '']". Now i
>
> > like to modify the 'line' to 'some CfooDar' so the best should be:
>
> >
>
> > let found[1] = 'C'
>
> > let found[3] = 'D'
>
> > let line = MATCHLIST_TO_STRING( found )
>
> >
>
> > As i know it's not possible with the builtin functions, so i need to write
>
> > one. The beginning of the line is not modified till the match, thus i can copy
>
> > that part to the 'new_line':
>
> >
>
> > let new_line = strpart( line, 0, match( line, pattern ) )
>
> >
>
> > But at this point i don't know how to continue. I can append the modified 'A'
>
> > immediately, because the pattern starts with it (in this example, but the user
>
> > can use any kind of pattern). But how can i find out the (offset) index of the
>
> > 'foo' and the 'B'? In this example it's trivial, because there is no other
>
> > 'foo' and 'B' in the line, but let see another example:
>
> >
>
> > let line = 'A A A A A'
>
> > let pattern = 'A \(A\) A \(A\)'
>
> >
>
> > If i like to modify this to 'A B A C A' then it's hard to detect the position
>
> > of the submatches in the 'line'.
>
> >
>
> > One solution is to use submatches for the 'inner words' (like 'foo' in the
>
> > previous example'), but it decreasing the number of useful submatches. For
>
> > example:
>
> >
>
> > let pattern = '\(A\)\(foo\)\(B\)'
>
> > let line = 'some AfooBar'
>
> > let found = matchlist( line, pattern )
>
> > " Remove the full match, we need only the submatches.
>
> > call remove( found, 0 )
>
> > let found[0] = 'C'
>
> > let found[2] = 'D'
>
> > let new_line = strpart( line, 0, match( line, pattern ) ) . join( found, '')
>
> >
>
> > In this case we used one additional submatch, but the 'A \(A\) A \(A\) A' may
>
> > become '\(A \)\(A\)\( A \)\(A\)\( A\)' and it's too lot.
>
> >
>
> > So is there a good way to replace all of the submatches with a new value in
>
> > one step?
>
>
>
> Isn't that what you would use submatch() in the replacement part of a :s
>
> command (mentioned in :h sub-replace-expression).
>
>
>
> Best,
>
> Christian
I don't understand what do you like to tell me... o_O The matchlist() gives me all of the submatches, but i like to modify the values of those, then "compile" the original line again.
* Get the submatches from line ('some AfooBar' -> 'A', 'B'),
* modify those ('A' -> 'C', 'B' -> '),
* 'compile' the original line. ('some CfooDar'
--
--
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.
> On Mi, 22 Okt 2014, BimbaLaszlo wrote:
>
>
>
> > Is there a good way to replace submatches in matchlist() and modify the
>
> > original line with it? I like to write a script which modifies all of the
>
> > submatches in a pattern in one step.
>
> >
>
> > For example the original line is 'some AfooBar' and i like to change it to
>
> > 'some CfooDar':
>
> >
>
> > let pattern = '\(A\)foo\(B\)'
>
> > let line = 'some AfooBar'
>
> > let found = matchlist( line, pattern )
>
> >
>
> > The 'found' contains "['AfooB', 'A', 'B', '', '', '', '', '', '', '']". Now i
>
> > like to modify the 'line' to 'some CfooDar' so the best should be:
>
> >
>
> > let found[1] = 'C'
>
> > let found[3] = 'D'
>
> > let line = MATCHLIST_TO_STRING( found )
>
> >
>
> > As i know it's not possible with the builtin functions, so i need to write
>
> > one. The beginning of the line is not modified till the match, thus i can copy
>
> > that part to the 'new_line':
>
> >
>
> > let new_line = strpart( line, 0, match( line, pattern ) )
>
> >
>
> > But at this point i don't know how to continue. I can append the modified 'A'
>
> > immediately, because the pattern starts with it (in this example, but the user
>
> > can use any kind of pattern). But how can i find out the (offset) index of the
>
> > 'foo' and the 'B'? In this example it's trivial, because there is no other
>
> > 'foo' and 'B' in the line, but let see another example:
>
> >
>
> > let line = 'A A A A A'
>
> > let pattern = 'A \(A\) A \(A\)'
>
> >
>
> > If i like to modify this to 'A B A C A' then it's hard to detect the position
>
> > of the submatches in the 'line'.
>
> >
>
> > One solution is to use submatches for the 'inner words' (like 'foo' in the
>
> > previous example'), but it decreasing the number of useful submatches. For
>
> > example:
>
> >
>
> > let pattern = '\(A\)\(foo\)\(B\)'
>
> > let line = 'some AfooBar'
>
> > let found = matchlist( line, pattern )
>
> > " Remove the full match, we need only the submatches.
>
> > call remove( found, 0 )
>
> > let found[0] = 'C'
>
> > let found[2] = 'D'
>
> > let new_line = strpart( line, 0, match( line, pattern ) ) . join( found, '')
>
> >
>
> > In this case we used one additional submatch, but the 'A \(A\) A \(A\) A' may
>
> > become '\(A \)\(A\)\( A \)\(A\)\( A\)' and it's too lot.
>
> >
>
> > So is there a good way to replace all of the submatches with a new value in
>
> > one step?
>
>
>
> Isn't that what you would use submatch() in the replacement part of a :s
>
> command (mentioned in :h sub-replace-expression).
>
>
>
> Best,
>
> Christian
I don't understand what do you like to tell me... o_O The matchlist() gives me all of the submatches, but i like to modify the values of those, then "compile" the original line again.
* Get the submatches from line ('some AfooBar' -> 'A', 'B'),
* modify those ('A' -> 'C', 'B' -> '),
* 'compile' the original line. ('some CfooDar'
--
--
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.
Re: test if string in list
Le mercredi 22 octobre 2014 15:47:16 UTC+2, Ben Fritz a écrit :
> On Wednesday, October 22, 2014 7:51:11 AM UTC-5, DwigtArmyOfChampions wrote:
> > Oh. I tried :h index but that only took me to the front page of vim help. I forgot the parentheses.
>
> In cases where I'm looking for a function but don't know the name of the function, I'll usually look at :help function-list which has a list of functions grouped by purpose (list functions, dict functions, string functions, etc.)
I usual jump directly to the specific lists with :h list-functions and so on.
--
--
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.
> On Wednesday, October 22, 2014 7:51:11 AM UTC-5, DwigtArmyOfChampions wrote:
> > Oh. I tried :h index but that only took me to the front page of vim help. I forgot the parentheses.
>
> In cases where I'm looking for a function but don't know the name of the function, I'll usually look at :help function-list which has a list of functions grouped by purpose (list functions, dict functions, string functions, etc.)
I usual jump directly to the specific lists with :h list-functions and so on.
--
--
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.
Subscribe to:
Posts (Atom)