Thursday, June 21, 2012

Re: Can vim be made to start with selected files already open?

On Jun 6, 2012, at 12:41 AM, Marc Weber wrote:

>> Thank you Marc. You forget that I'm an idiot. I understand very little
>> of the language you guys speak. I read the readme for this but I
>> understood very little of it either. This is not backhanded criticism.
>> Just stating the facts. I appreciate your generosity, and when I do
>> understand you're always very helpful.
>
> mkdir my-dir
> echo 'e /tmp/foo.txt' > my-dir/.vimrc
> cd my-dir
> vim
>
> Then Vim will ask:
> (Do you want to source my-dir/.vimrc? [y/n])
>
> But it'll ask this once only.

Thanks, Marc. Not sure I understand. It would create a temporary .vimrc? Not sure how it helps me. I just want to load a few files---always the same few files---as simply as possible immediately after starting vim. Most of the time. Not all the time. Also, I gather it's done from terminal. I rarely use terminal, and never to start vim.

>>> Option 4)
>>> Use faster ways to open files such as glob open provided in sample rc of
>>> vim-addon-manager - or do :r! find then gf on a path ..
>
> fast glob implementation (requires tlib library):
>
> fun! FastGlob(glob)
> let g = '^'.a:glob.'$'
> let replace = {'**': '.*','*': '[^/\\]*','.': '\.'}
> let g = substitute(g, '\(\*\*\|\*\|\.\)', '\='.string(replace).'[submatch(1)]','g')
> let cmd = 'find | grep -e '.shellescape(g)
> " let exclude = a:exclude_pattern == ''? '' : ' | grep -v -e '.shellescape(a:exclude_pattern)
> " let cmd .= exclude
> return system(cmd)
> endf
> noremap \go :exec 'e '. fnameescape(tlib#input#List('s','select file', split(FastGlob(input('glob pattern, curr dir:','**/*')),"\n") ))<cr>
>
>
> :r! find
> This command just runs finds and insterts its output into the currernt
> buffer. r means read. Then you can use / ? vim search and gf to open
> the files being represented as names in the current buffer by.

I think maybe I wasn't clear in describing what I want to do. As mentioned above, I just want to load an identified set of files, usually the same set of files, as simply as possible immediately after after starting vim. The situation is not one of having to identify or locate files. But of loading files whose names and locations I know.

Previously I've been doing this by navigating to the files using the Ex or Tex commands, which, when there are four or five files, is unnecessarily complicated and time-consuming.

> If you say "I'm an idiot" you speak a language I don't understand. It
> does not tell me where to start explaining what I'm talking about.

You are right. I will be more specific in the future.

Regards,
------------------------------------------------------------------------------------------
Eric Weir
Decatur, GA
eeweir@bellsouth.net

"Style is truth."

- Ray Bradbury

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

No comments: