Friday, February 3, 2017

Re: path autoexpansion (autcompletion) when saving files or changing directories

On Friday, February 3, 2017 at 4:45:06 PM UTC-8, Frank Shute wrote:
> Hi Victoria,
>
> What you want to have a look at is:
>
> :h cmdline-completion
>
> I use:
>
> set wildmode=list
>
> in $MYVIMRC and that seems to do the same job as my shell. i.e I hit tab to
> complete.
>
> HTH.
>
>
> Regards,
>
>
>
> On 4 February 2017 at 00:25, Victoria Stuart wrote:
> > Hello: please forgive me if this is a FAQ; I searched (a lot: Google ...) but Icould not find a solution. I am using neovim 0.1.7 (recent switch from Vim 8.0).
> >
> > Say I want to save a file (:sav) in a different path on my system (Arch Linux); e.g., I am in ~/projects/... , and I want to save it to ~/temp/... or even another mountpoint, such as /mnt/another_drive/...
> >
> > I find myself having to know/manually type the complete path; I don't have auto-completion, as in a bash terminal.
> >
> > Likewise, if in Vim (nvim) I want to :cd, again I have to manuallt type the path (no autocompletion).
> >
> > FYI, I have the NerdTREE and SuperTab plugins installed, if that helps. Thanks, appreciated!
> >
> > --
> > --
> > 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.
>
>
>
> --
>
> Frank

Hi; thank you very much for your reply -- appreciated!

OK: I'm missing something obvious, or there is a problem with my ~/.vimrc (that I am also using with nvim. Note however that I had the identical issue in Vim, and this path expansion never worked, for me.

I have these lines in .vimrc,

set wildmode=longest,list,full
set wildmenu

and I read the "cmdline-completion" help. When I try that tab completion; e.g.

:sav <tab>

or <shift-tab>, etc. as suggested in that helpfile, the only autocomplete suggestions offered are a text files that exist at the root level of that current working path; e.g.

untitled " a plain-text file on /mnt/Vancouver

or

new " a plain-text file on ~/ [/home/victoria/]
new2 " ditto ...
new3
new4
new5

If I try, e.g., to autocomplete anything else, i.e.

:sav ~/pro <tab> " intending to autocomplete to ~/projects/

I get nothing, at all. Ditto (e.g.) for

:sav /mnt/Vanc <tab> " intending to autocomplete to /mnt/Vancouver/

In fact, at system root [ / ] level

:sav / <tab> only gives a few, odd suggestions:

kdeinit5__0
klauncherXM2012...
klauncherXM5301...
swapfile

I should also have mentioned that I have the FZF (fuzzy completion) plugin installed, as well -- though I had this issue even before I installed that beast (in part, to address this issue). Anyway, the mappings for those fzf completions involve Ctrl-X or <leader> bindings (not plain <tab>, <Shift-tab>, etc.).

--
--
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: path autoexpansion (autcompletion) when saving files or changing directories

Hi Victoria,

What you want to have a look at is:

:h cmdline-completion

I use:

set wildmode=list

in $MYVIMRC and that seems to do the same job as my shell. i.e I hit tab to
complete.

HTH.


Regards,



On 4 February 2017 at 00:25, Victoria Stuart
<victoria.a.stuart@gmail.com> wrote:
> Hello: please forgive me if this is a FAQ; I searched (a lot: Google ...) but Icould not find a solution. I am using neovim 0.1.7 (recent switch from Vim 8.0).
>
> Say I want to save a file (:sav) in a different path on my system (Arch Linux); e.g., I am in ~/projects/... , and I want to save it to ~/temp/... or even another mountpoint, such as /mnt/another_drive/...
>
> I find myself having to know/manually type the complete path; I don't have auto-completion, as in a bash terminal.
>
> Likewise, if in Vim (nvim) I want to :cd, again I have to manuallt type the path (no autocompletion).
>
> FYI, I have the NerdTREE and SuperTab plugins installed, if that helps. Thanks, appreciated!
>
> --
> --
> 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.



--

Frank

--
--
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.

path autoexpansion (autcompletion) when saving files or changing directories

Hello: please forgive me if this is a FAQ; I searched (a lot: Google ...) but Icould not find a solution. I am using neovim 0.1.7 (recent switch from Vim 8.0).

Say I want to save a file (:sav) in a different path on my system (Arch Linux); e.g., I am in ~/projects/... , and I want to save it to ~/temp/... or even another mountpoint, such as /mnt/another_drive/...

I find myself having to know/manually type the complete path; I don't have auto-completion, as in a bash terminal.

Likewise, if in Vim (nvim) I want to :cd, again I have to manuallt type the path (no autocompletion).

FYI, I have the NerdTREE and SuperTab plugins installed, if that helps. Thanks, appreciated!

--
--
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, February 1, 2017

vim scp and a local swap file

Greetings,

The other day I was editing a remote file via scp when my client machine
crashed. Had the file been local there would have been a swap file to recover
unsaved changes. Is it possible to have local swap file for a remote file?

--
--
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: Enabling a vimrc setting from the current buffer

On Wednesday, February 1, 2017 at 10:32:54 AM UTC-5, Ben Fritz wrote:
> A better method would probably be to use a buffer-local autocmd (:help autocmd-buffer-local):
>
> au BufWritePost <buffer> !./%
>
> and then get rid of it:
>
> au! BufWritePost <buffer>
>
> Map these to a keypress or a user-defined command and you're ready to go.

This works. Thank you.

command Autorun au BufWritePost <buffer> !./%
command Noautorun au! BufWritePost <buffer>


--
--
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: Enabling a vimrc setting from the current buffer

On Wednesday, February 1, 2017 at 9:20:18 AM UTC-6, Neil Watson wrote:
> Greetings,
>
> High level goal: Optionally have vim run the current buffer right after writing
> it to disk.
>
> A setting like this does make the post write run work, but on all buffers.
>
> au BufWritePost * !./%
>
> How can I make this work on just the current buffer and how can a quickly
> toggle it on or off with less typing? I did try making a function, but calling
> it did nothing:
>
> if exists("b:Autorun")
> au BufWritePost * !./%
> endif

For your attempted method you would just need to move the check to *within* the autocmd:

au BufWritePost * if exists("b:Autorun") | !./% | endif

A better method would probably be to use a buffer-local autocmd (:help autocmd-buffer-local):

au BufWritePost <buffer> !./%

and then get rid of it:

au! BufWritePost <buffer>

Map these to a keypress or a user-defined command and you're ready to go.

--
--
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.

Enabling a vimrc setting from the current buffer

Greetings,

High level goal: Optionally have vim run the current buffer right after writing
it to disk.

A setting like this does make the post write run work, but on all buffers.

au BufWritePost * !./%

How can I make this work on just the current buffer and how can a quickly
toggle it on or off with less typing? I did try making a function, but calling
it did nothing:

if exists("b:Autorun")
au BufWritePost * !./%
endif

--
--
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.