[OT(?)] Ubuntu 18 now defaults to 4-space tabs
We upgraded a server to 18.04 and now when I start typing a python file (seems to be triggered by the .py extension) the tabs default to 4 spaces. We have decades of code that use tab characters, and it has not been our intention to change that. I found a /usr/share/vim/vim80/indent/python.vim and tried moving it out of the way, but the behavior was still there. I know I can put a modeline in every file but I was hoping to do it for every user and for every file. Thanks! -- -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/0e0e9366-9654-3b3d-0637-6ecb7690f281%40tobiah.org.
Execute command and insert its standard output at the beginning of non-empty line?
Hi all, I have this bash alias: alias my-date='date +"%A %d %B %Y"' and this line in vimrc: set shellcmdflag=-ic I want to insert (prepend) a timestamp at the beginning of a non-empty line, without line breaks, but if I type: :r !my-date this will print the timestamp on the next line, that is the line below the cursor. Is there a way to achieve what I want? Thanks -- Ottavio Caruso -- -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAEJNuHw_Z9Vop%3DRL5%2BdVsNryX%3Dqm7mP0FoaZqKnvNVw%2BBCBUZw%40mail.gmail.com.
Re: Execute command and insert its standard output at the beginning of non-empty line?
On Tue, Sep 10, 2019 at 7:32 AM 'Ottavio Caruso' via vim_use mailto:vim_use@googlegroups.com>> wrote: Hi all, I have this bash alias: alias my-date='date +"%A %d %B %Y"' and this line in vimrc: set shellcmdflag=-ic I want to insert (prepend) a timestamp at the beginning of a non-empty line, without line breaks, but if I type: :r !my-date this will print the timestamp on the next line, that is the line below the cursor. Is there a way to achieve what I want? Thanks -- Ottavio Caruso -- I recently set up a map like this: map H :exec 'norm i' . system("echo -n 'Chronicle Herald, '") . system("date +'%A, %B %d, %Y'") Perhaps you could experiment with that idea? -- John Cordes -- -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAGZBEdQa6j8PiCKOotDURQB4cFB2jLQuFviY4kNN0G3dxYe%2BcA%40mail.gmail.com.
Re: Execute command and insert its standard output at the beginning of non-empty line?
On Di, 10 Sep 2019, 'Ottavio Caruso' via vim_use wrote: > Hi all, > > I have this bash alias: > alias my-date='date +"%A %d %B %Y"' > > and this line in vimrc: > set shellcmdflag=-ic > > I want to insert (prepend) a timestamp at the beginning of a non-empty > line, without line breaks, but if I type: > > :r !my-date :r reads the output of your command and puts it below the current line. > this will print the timestamp on the next line, that is the line below > the cursor. > > Is there a way to achieve what I want? use strftime() together with Ctrl-R in insert mode. See the example in the faq: https://vimhelp.org/vim_faq.txt.html#faq-21.4 Best, Christian -- Lerne Klagen ohne zu Leiden. -- -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190910113343.GD30959%40256bit.org.
Re: [OT(?)] Ubuntu 18 now defaults to 4-space tabs
* Tobiah [190910 03:01]: > We upgraded a server to 18.04 and now when I start typing > a python file (seems to be triggered by the .py extension) > the tabs default to 4 spaces. We have decades of code that > use tab characters, and it has not been our intention to > change that. > > I found a /usr/share/vim/vim80/indent/python.vim and tried > moving it out of the way, but the behavior was still there. > > I know I can put a modeline in every file but I was hoping > to do it for every user and for every file. I don't know if this is your problem, but a somewhat (but not too) recent change to Vim added a file /usr/share/vim/vim##/defaults.vim that gets sourced automatically by vim if no user vimrc file is found. This file sets some very subjective non-default values, and I find some of its choices highly obnoxious. If this is your problem, there are two possible fixes. The first (assuming the Debian packaging; I'm not sure if Ubuntu uses the Debian package unchanged or not) is to edit /etc/vim/vimrc and uncomment the line: " let g:skip_defaults_vim = 1 The second is to ensure that the user has a vimrc file: mkdir ~/.vim touch ~/.vim/vimrc My opinion is that the defaults.vim file should only set options that almost all vim users will want, and should stay completely away from options that are "personal taste" (i.e. leave them with the vim internal default settings). The most noticeable option that bothers me is the scrolloff setting. Some people like it, and some, like me, are bothered by having it non-zero. The vim default has been 0 (the vi compatible behavior) since the beginning of time^Wvim. A non-zero value was added to defaults.vim, I suppose when vim started conditionally sourcing that file. To repeat myself, defaults.vim should not set any options where there is a wide variety of personal preference. Quite honestly, I don't understand why this feechur was added at all; it means that vim has one set of defaults if the user has a vimrc file and a completely different set of "defaults" (really?) if the user doesn't have his own vimrc file. This complicates vim startup, and adds one more thing a new vim user needs to learn immediately when starting to personalize vim by creating a ~/.vim/vimrc file: Install vim and start using it; decide to create a vimrc just to change one or two options (or maybe not to change any option but to add a key mapping); now vim behaves quite differently, and the new user has to figure out why and how to get all the "original" behavior back. ...Marvin -- -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190910125625.6qeqe5wfswcdanuc%40basil.wdw.
Re: [OT(?)] Ubuntu 18 now defaults to 4-space tabs
* Marvin Renich [190910 14:56]: > My opinion is that the defaults.vim file should only set options that > almost all vim users will want, and should stay completely away from > options that are "personal taste" (i.e. leave them with the vim internal > default settings). The most noticeable option that bothers me is the > scrolloff setting. Some people like it, and some, like me, are bothered > by having it non-zero. The vim default has been 0 (the vi compatible > behavior) since the beginning of time^Wvim. A non-zero value was added > to defaults.vim, I suppose when vim started conditionally sourcing that > file. To repeat myself, defaults.vim should not set any options where > there is a wide variety of personal preference. Thanks for taking the words out of my mouth. After a fresh install of a raspbian, I was *highly* confused by these "defaults" and tempted to use emacs. No, joke! But still... -- -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/20190910130503.GA17601%40mo-online.de.
Re: Execute command and insert its standard output at the beginning of non-empty line?
On Tue, 10 Sep 2019 at 12:33, Christian Brabandt wrote: > > > On Di, 10 Sep 2019, 'Ottavio Caruso' via vim_use wrote: > > > Hi all, > > > > I have this bash alias: > > alias my-date='date +"%A %d %B %Y"' > > > > and this line in vimrc: > > set shellcmdflag=-ic > > > > I want to insert (prepend) a timestamp at the beginning of a non-empty > > line, without line breaks, but if I type: > > > > :r !my-date > > :r reads the output of your command and puts it below the current line. > > > this will print the timestamp on the next line, that is the line below > > the cursor. > > > > Is there a way to achieve what I want? > > use strftime() together with Ctrl-R in insert mode. See the example in > the faq: https://vimhelp.org/vim_faq.txt.html#faq-21.4 > Many thanks Christian, this is exactly what I was looking for. I put this in my .vimrc: iabbrev mydate =strftime("%A %d %B %Y") and it works like a charm. -- Ottavio Caruso -- -- 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+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/vim_use/CAEJNuHym1bcr%2BwtAVfH4yh_7CLANp8ZpchBuKa%2ByAtVmmP1iCA%40mail.gmail.com.