Re: can I set a variable to store the file path in the vimrc and open the specific file in the command line like :e $myfile
2016-03-09 23:54 GMT+03:00 BPJ: > Den 2016-03-09 kl. 15:33, skrev Nikolay Aleksandrovich Pavlov: >> >> Unlike your variant which does not allow a huge number of characters >> including spaces and `[]` which are not uncommon, > > > Square brackets in filenames is common? Every second *.ass/*.srt/… (subtitles) file. Spaces are common in directory names you know where. And in subtitles, yes. > Where did "ASCII alphanumerics, hyphen, underscore and period" go? > I do often get files which originate on some non-utf-8 system (guess which!) > containing what to their greator was things like "å ä ö", which reminds me > to stick to filenames which are unlikely to get mangled when traveling. Non-ASCII bytes in file names do not need escaping, even if your is UTF-8 and file has a single 0x80 byte in its name (which is not valid UTF-8). Problematic are: 1. Globbing characters: *, ? (AFAIR forbidden on Windows), [], {}. 2. Common expansion characters: $ (not forbidden in file names, and not uncommon as well, though I saw only some automatically created binary files like caches with them), `. 3. Vim own expansion characters: %, #. I use them in my file names, and you may sometimes get `%` after downloading file from the web if name is deduced automatically. 4. Separators: space, tab. Have not seen tab, but space is very common when origin of the file worked on Windows and file cannot be described with one word. *nix users prefer to use underscore or hyphen-minus. 5. ASCII control characters: newline (AFAIK other do not have problems). Have seen in a file name that was not created by me for testing purposes when I accidentally pasted something with newline into KDE3 file manager (konqueror?). I am not using file managers on my PC any more though. 6. Escaping characters: backslash. Other characters do not need escaping. Most (everything when talking about *nix) of the above is handled by fnameescape(). See also https://github.com/vim/vim/issues/541. > > (And yes I do have files containing text in non-latin scripts -- quite a lot > of them in fact -- but I stick to safe filenames.) Even if you stick to safe filenames, this does not mean that fnameescape() will do any harm. And it is more robust. --- BTW, I used to have directory ~/*.* which contains many significant files created in order not to turn ~ into a junk. It is now ~/a.a though, but symlink `*.* -> a.a` is still there. Also see no harm in naming books like `author-series-nr-title` where `author` is either `transliterated_russian_name` or `%[english_name%]` (`%[` and `%]` are present there literally), same for other fields. > > > -- > -- > 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. > For more options, visit https://groups.google.com/d/optout. -- -- 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. For more options, visit https://groups.google.com/d/optout.
Re: can I set a variable to store the file path in the vimrc and open the specific file in the command line like :e $myfile
Den 2016-03-09 kl. 15:33, skrev Nikolay Aleksandrovich Pavlov: Unlike your variant which does not allow a huge number of characters including spaces and `[]` which are not uncommon, Square brackets in filenames is common? Where did "ASCII alphanumerics, hyphen, underscore and period" go? I do often get files which originate on some non-utf-8 system (guess which!) containing what to their greator was things like "å ä ö", which reminds me to stick to filenames which are unlikely to get mangled when traveling. (And yes I do have files containing text in non-latin scripts -- quite a lot of them in fact -- but I stick to safe filenames.) -- -- 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. For more options, visit https://groups.google.com/d/optout.
Re: can I set a variable to store the file path in the vimrc and open the specific file in the command line like :e $myfile
2016-03-09 17:02 GMT+03:00 Tim Chase: > add the following to your vimrc: > >let myfile='/path/to/your/file' > > then you can invoke vim with > >vim -c 'exe "e ".myfile' > > which is a bit awkward, so you might want to make an alias if you > intend to do it frequently. You forgot `fnameescape()`: `vim -c 'execute "edit" fnameescape(myfile)'`. In most cases this can also be written as vim -c 'edit `=myfile`' Unlike your variant which does not allow a huge number of characters including spaces and `[]` which are not uncommon, `=myfile` does not allow only newline characters inside `myfile`. Has a problem that if `myfile` matches some pattern in `` option vim will not open anything, so this variant is for manual uses only, for scripts (aliases, user commands, etc: for any place which is written once) there is fnameescape(). > > -tim > > > -- > -- > 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. > For more options, visit https://groups.google.com/d/optout. -- -- 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. For more options, visit https://groups.google.com/d/optout.
Re: can I set a variable to store the file path in the vimrc and open the specific file in the command line like :e $myfile
add the following to your vimrc: let myfile='/path/to/your/file' then you can invoke vim with vim -c 'exe "e ".myfile' which is a bit awkward, so you might want to make an alias if you intend to do it frequently. -tim -- -- 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. For more options, visit https://groups.google.com/d/optout.