RE: repeating up/down/delete commands
>often well beyond those of the present line. I had been used >to this deleting up to 999 characters, but only up to the end >of the present line. It appears that the "set compatible" Ummm, 'D' doesn't work?
Re: repeating up/down/delete commands
[EMAIL PROTECTED] wrote: "A.J.Mechelynck" <[EMAIL PROTECTED]> 写于 2007-05-19 15:42:15: This is true, but rather than an empty vimrc I suggest the following: runtime vimrc_example.vim " if and when we want to further customize Vim, we'll add more lines below Best regards, Tony. -- I always recommend include the contents of vimrc_example.vim instead of just source the file by :runtime. By including the contents of vimrc_example.vim we know all it has done and we can change it anyway. i.e. chang the .vimrc is a good way, changing the $VIMRUNTIME/vimrc_example.vim is NOT a good pratice. (vimrc_example fits the need of the author but it definetely do not fit everyone, so I suggest most users to change it and create their own .vimrc.) The second reason: vimrc_example.vim comes from the distribution and it may change, when it change it may silently break our existing scripts or configurations. include the contents into our .vimrc minimize the incompatible changes. So the better practise to create a new .vimrc may be: just copy the vimrc_example.vim to ~/.vimrc -- Sincerely, Pan, Shi Zhu. ext: 2606 Changing the vimrc_example.com is not a good practice, but I prefer sourcing (contrary to Bram's repeated advice) because that way, if an improvement is distributed, I don't remain stuck with the old version. If the vimrc_example does something I don't want (and sometimes it does) I reverse it in the part of my own vimrc after the sourcing: for instance, to avoid filetype-specific indenting: ... runtime vimrc_example.vim filetype indent off ... Likewise for other options. If I want to check what the vimrc_example actually does, I can always use ":view $VIMRUNTIME/vimrc_example.vim"; but that script is long, complex, and not written by me, enough for me to want it kept apart from my own changes -- and in a different file. I don't remember the vimrc_example introducing changes which broke my own scripts, but if it did, ":verbose set optionname" would quickly tell me that 'optionname' whas set there. YMMV. Which practice is "better" depends on by which criteria you judge those practices. According to my criteria, sourcing the vimrc_example is "better" than copying it. Bram doesn't agree with me on that point, and neither do you, because you apply different criteria. Best regards, Tony. -- The best book on programming for the layman is "Alice in Wonderland"; but that's because it's the best book on anything for the layman.
Re: repeating up/down/delete commands
"A.J.Mechelynck" <[EMAIL PROTECTED]> 写于 2007-05-19 15:42:15: > This is true, but rather than an empty vimrc I suggest the following: > > runtime vimrc_example.vim > " if and when we want to further customize Vim, we'll add more lines below > Best regards, > Tony. > -- I always recommend include the contents of vimrc_example.vim instead of just source the file by :runtime. By including the contents of vimrc_example.vim we know all it has done and we can change it anyway. i.e. chang the .vimrc is a good way, changing the $VIMRUNTIME/vimrc_example.vim is NOT a good pratice. (vimrc_example fits the need of the author but it definetely do not fit everyone, so I suggest most users to change it and create their own .vimrc.) The second reason: vimrc_example.vim comes from the distribution and it may change, when it change it may silently break our existing scripts or configurations. include the contents into our .vimrc minimize the incompatible changes. So the better practise to create a new .vimrc may be: just copy the vimrc_example.vim to ~/.vimrc -- Sincerely, Pan, Shi Zhu. ext: 2606
Re: repeating up/down/delete commands
Gary Johnson wrote: [...] One way to make sure that vim starts in non-compatible mode is to make sure you have a .vimrc file in your HOME directory, even if the file is empty. [...] This is true, but rather than an empty vimrc I suggest the following: " Vim startup file " Preferences which affect the menus must come first: uncomment if desired if 0 " force English messages and menus regardless of locale if has("unix") language messages C else language messages en endif endif " if 0 " invoke the "example" vimrc runtime vimrc_example.vim " if and when we want to further customize Vim, we'll add more lines below Best regards, Tony. -- Let's talk about how to fill out your 1984 tax return. Here's an often overlooked accounting technique that can save you thousands of dollars: For several days before you put it in the mail, carry your tax return around under your armpit. No IRS agent is going to want to spend hours poring over a sweat-stained document. So even if you owe money, you can put in for an enormous refund and the agent will probably give it to you, just to avoid an audit. What does he care? It's not his money. -- Dave Barry, "Sweating Out Taxes"
Re: repeating up/down/delete commands
On 2007-05-18, David Pike <[EMAIL PROTECTED]> wrote: > Uh oh... I spoke slightly too soon. Although the up/down/delete > functions that I first asked about now behave normally, the > > vim -N -u NONE -i NONE > > option now results in "999 d" deleting 999 characters, > often well beyond those of the present line. I had been used > to this deleting up to 999 characters, but only up to the end > of the present line. It appears that the "set compatible" > option had been helping me to get the desired 'this line only' > functionality, but the "-N" option above now overrides that. As others have written, there are more efficient ways to get the motion you want than to use a 999 prefix. Nevertheless, I know how it is when your fingers are used to certain ways of doing things and besides, it ought to work right. You said in your first post that you were using vim, so I assumed you had been using it in non-compatible mode. Since the 999 prefix used to work for you, and since it works for me in non-compatible mode, I think that is a safe assumption. I just tried another experiment and think I found the answer. I invoked vim as "vim -u NONE" which puts it into compatible mode. When I tried those commands, e.g., 999 and 999dd, I got a beep and no cursor motion! So your new installation of vim appears to be putting you in compatible mode whereas your previous installation put you in non-compatible mode. Now the question is, why. Take a look at :help compatible-default :help compatible and see if you can figure out from that what might have changed with this new installation. One way to make sure that vim starts in non-compatible mode is to make sure you have a .vimrc file in your HOME directory, even if the file is empty. You may also want to have a talk with the person who performed your vim upgrade and see if he can explain how and why the new configuration differs from the old one. He may appreciate knowing that something appears to have gone wrong and having the opportunity to fix it at the system level so that each user doesn't have to fix it for himself. This would also save you from troubleshooting this and possibly continuing to find things that no longer work as they used to. As for the 999d deleting characters beyond the current line, that behavior is affected by the 'whichwrap' option. If you get the 'compatible' thing fixed and 999d still deletes beyond the current line, put this in your ~/.vimrc file: set whichwrap-=s See :help whichwrap Regards, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Mobile Broadband Division | Spokane, Washington, USA
Re: repeating up/down/delete commands
To delete from cursor to end of line, use d$ Is it so hard to remember? Also: D Regards. -- http://arhuaco.org http://emQbit.com
Re: repeating up/down/delete commands
David Pike wrote: Uh oh... I spoke slightly too soon. Although the up/down/delete functions that I first asked about now behave normally, the vim -N -u NONE -i NONE option now results in "999 d" deleting 999 characters, often well beyond those of the present line. I had been used to this deleting up to 999 characters, but only up to the end of the present line. It appears that the "set compatible" option had been helping me to get the desired 'this line only' functionality, but the "-N" option above now overrides that. - David. To delete from cursor to end of line, use d$ Is it so hard to remember? Best regards, Tony. -- hundred-and-one symptoms of being an internet addict: 244. You use more than 20 passwords.
Re: repeating up/down/delete commands
David Pike wrote: This will hopefully be an easy question or two... An upgraded version of vim was installed on our systems recently, and some tricks that I'm used to are no longer functional, such as: "[a large integer, say N] " to quickly get to the top of the file that I am editting, "[N] " to quickly get to the last line of the file (similarly, and could be used). Also, while part way through a file, "[N] dd" or "[N] d " was a handy way of deleting all remaining lines in the file. The new version of vim does not seem to let me do this anymore. Specifically, if the N value that I enter (typically ) is larger than the number of lines involved, then vim now just beeps to signal that it won't do what I would like to do. Is there some easy way of getting vim to accept these commands once again? Thanks, - David. To get to the top of the file: gg To get to the last line: G Best regards, Tony. -- Non-sequiturs make me eat lampshades.
Re: repeating up/down/delete commands
In response to David Pike <[EMAIL PROTECTED]>: In case you don't know about these, here are commands that will do the same thing. "[a large integer, say N] " to quickly get to the top of the file that I am editting, gg "[N] " to quickly get to the last line of the file G Also, while part way through a file, "[N] dd" or "[N] d " was a handy way of deleting all remaining lines in the file dG Franco --
Re: repeating up/down/delete commands
Uh oh... I spoke slightly too soon. Although the up/down/delete functions that I first asked about now behave normally, the vim -N -u NONE -i NONE option now results in "999 d" deleting 999 characters, often well beyond those of the present line. I had been used to this deleting up to 999 characters, but only up to the end of the present line. It appears that the "set compatible" option had been helping me to get the desired 'this line only' functionality, but the "-N" option above now overrides that. - David. To: vim@vim.org Subject: Re: repeating up/down/delete commands Date: Fri, 18 May 2007 23:22:59 -0230 (NDT) From: [EMAIL PROTECTED] (David Pike) Hi Gary, and thanks for your response. I just tried your suggestion of vim -N -u NONE -i NONE and it behaved "normally" (i.e., in the way that I want). Again, thanks, - David. Date: Fri, 18 May 2007 18:39:54 -0700 From: Gary Johnson <[EMAIL PROTECTED]> To: vim@vim.org Subject: Re: repeating up/down/delete commands On 2007-05-18, David Pike <[EMAIL PROTECTED]> wrote: > This will hopefully be an easy question or two... > > An upgraded version of vim was installed on our systems recently, > and some tricks that I'm used to are no longer functional, such as: > "[a large integer, say N] " to quickly get to the top of the > file that I am editting, "[N] " to quickly get to the last > line of the file (similarly, and could be used). > Also, while part way through a file, "[N] dd" or "[N] d " > was a handy way of deleting all remaining lines in the file. > > The new version of vim does not seem to let me do this anymore. > Specifically, if the N value that I enter (typically ) is > larger than the number of lines involved, then vim now just beeps > to signal that it won't do what I would like to do. > > Is there some easy way of getting vim to accept these commands > once again? I just tried this with a new installation of vim 7.1 on Linux and all of the examples you gave worked for me. This was true whether I invoked vim as just "vim" or as "vim -N -u NONE -i NONE". I suspect some configuration file in your upgrade has botched this for you. Try invoking vim as vim -N -u NONE -i NONE as see if it still misbehaves. It might help us to know the operating system you are using and the complete output from "vim --version", too. Regards, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Mobile Broadband Division | Spokane, Washington, USA
Re: repeating up/down/delete commands
Hi Gary, and thanks for your response. I just tried your suggestion of vim -N -u NONE -i NONE and it behaved "normally" (i.e., in the way that I want). My operating system appears to be Gentoo Linux. The (somewhat verbose) output from "vim --version" is: === begin output === VIM - Vi IMproved 7.0 (2006 May 7, compiled Apr 29 2007 13:06:51) Included patches: 1-174 Modified by Gentoo-7.0.174 Compiled by [EMAIL PROTECTED] Huge version without GUI. Features included (+) or not (-): +arabic +autocmd -balloon_eval -browse ++builtin_terms +byte_offset +cindent -clientserver -clipboard +cmdline_compl +cmdline_hist +cmdline_info +comments +cryptv -cscope +cursorshape +dialog_con +diff +digraphs -dnd -ebcdic +emacs_tags +eval +ex_extra +extra_search +farsi +file_in_path +find_in_path +folding -footer +fork() +gettext -hangul_input +iconv +insert_expand +jumplist +keymap +langmap +libcall +linebreak +lispindent +listcmds +localmap +menu +mksession +modify_fname +mouse -mouseshape +mouse_dec +mouse_gpm -mouse_jsbterm +mouse_netterm +mouse_xterm +multi_byte +multi_lang -mzscheme -netbeans_intg -osfiletype +path_extra +perl +postscript +printer +profile +python +quickfix +reltime +rightleft -ruby +scrollbind +signs +smartindent -sniff +statusline -sun_workshop +syntax +tag_binary +tag_old_static -tag_any_white -tcl +terminfo +termresponse +textobjects +title -toolbar +user_commands +vertsplit +virtualedit +visual +visualextra +viminfo +vreplace +wildignore +wildmenu +windows +writebackup -X11 -xfontset -xim -xsmp -xterm_clipboard -xterm_save system vimrc file: "/etc/vim/vimrc" user vimrc file: "$HOME/.vimrc" user exrc file: "$HOME/.exrc" fall-back for $VIM: "/usr/share/vim" Compilation: i586-pc-linux-gnu-gcc -c -I. -Iproto -DHAVE_CONFIG_H -O2 -mcpu=i586-D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -I/usr/lib/perl5/5.8.8/i586-linux/CORE -I/usr/include/python2.4 -pthread Linking: i586-pc-linux-gnu-gcc -rdynamic -L/usr/local/lib -o vim -lcurses -lgpm -rdynamic -L/usr/local/lib /usr/lib/perl5/5.8.8/i586-linux/auto/DynaLoader/DynaLoader.a -L/usr/lib/perl5/5.8.8/i586-linux/CORE -lperl -lutil -lc -L/usr/lib/python2.4/config -lpython2.4 -lpthread -lutil -lm -Xlinker -export-dynamic === end output === Again, thanks, - David. Date: Fri, 18 May 2007 18:39:54 -0700 From: Gary Johnson <[EMAIL PROTECTED]> To: vim@vim.org Subject: Re: repeating up/down/delete commands On 2007-05-18, David Pike <[EMAIL PROTECTED]> wrote: > This will hopefully be an easy question or two... > > An upgraded version of vim was installed on our systems recently, > and some tricks that I'm used to are no longer functional, such as: > "[a large integer, say N] " to quickly get to the top of the > file that I am editting, "[N] " to quickly get to the last > line of the file (similarly, and could be used). > Also, while part way through a file, "[N] dd" or "[N] d " > was a handy way of deleting all remaining lines in the file. > > The new version of vim does not seem to let me do this anymore. > Specifically, if the N value that I enter (typically ) is > larger than the number of lines involved, then vim now just beeps > to signal that it won't do what I would like to do. > > Is there some easy way of getting vim to accept these commands > once again? I just tried this with a new installation of vim 7.1 on Linux and all of the examples you gave worked for me. This was true whether I invoked vim as just "vim" or as "vim -N -u NONE -i NONE". I suspect some configuration file in your upgrade has botched this for you. Try invoking vim as vim -N -u NONE -i NONE as see if it still misbehaves. It might help us to know the operating system you are using and the complete output from "vim --version", too. Regards, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Mobile Broadband Division | Spokane, Washington, USA
Re: repeating up/down/delete commands
On 2007-05-18, David Pike <[EMAIL PROTECTED]> wrote: > This will hopefully be an easy question or two... > > An upgraded version of vim was installed on our systems recently, > and some tricks that I'm used to are no longer functional, such as: > "[a large integer, say N] " to quickly get to the top of the > file that I am editting, "[N] " to quickly get to the last > line of the file (similarly, and could be used). > Also, while part way through a file, "[N] dd" or "[N] d " > was a handy way of deleting all remaining lines in the file. > > The new version of vim does not seem to let me do this anymore. > Specifically, if the N value that I enter (typically ) is > larger than the number of lines involved, then vim now just beeps > to signal that it won't do what I would like to do. > > Is there some easy way of getting vim to accept these commands > once again? I just tried this with a new installation of vim 7.1 on Linux and all of the examples you gave worked for me. This was true whether I invoked vim as just "vim" or as "vim -N -u NONE -i NONE". I suspect some configuration file in your upgrade has botched this for you. Try invoking vim as vim -N -u NONE -i NONE as see if it still misbehaves. It might help us to know the operating system you are using and the complete output from "vim --version", too. Regards, Gary -- Gary Johnson | Agilent Technologies [EMAIL PROTECTED] | Mobile Broadband Division | Spokane, Washington, USA