Re: [proposal] Project Information for vim
> ### Modifiers > > ``` > %:j- same as v:projectroot, project root directory of current buffer > %:i- file path relative to current project root > ``` > > These modifiers can be used in command line or passing to `expand(xxx)`. More about modifiers: - cd to the project root: :cd %:j - open netrw in the project root: :Explore %:j - open nerdtree in the project root: :NERDTree %:j -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [proposal] Project Information for vim
Hi Very good initiative! > ## Project Information > > Vim can introduce a way to provide following information: > [...] > - buffer-local options > [...] > ### Locating project root > > The project root of current file is the nearest parent directory with > a folder named `.vimprj` (can be changed by set rootmarker=xxx) in > it. > > A buffer-specific variable `v:project` is used to store the project > root directory of current buffer, it is initialized when you open a > file as: > > ```VimL > let v:projectroot = fnamemodify(find(, '.;'), ':h') > ``` I've experimented on the subject: https://github.com/luchermitte/lh-vim-lib/blob/master/doc/Project.md What will be interesting is different than "buffer-local", it's "project-local". An option (/variable) changed in one buffer belonging to a project needs to be propagated to (or better shared with!) all buffers belonging to the same project. This way, instead of a v:projectroot, it would be a p:projectroot, a p:where_the_build_directory_is, a p:where_ctags_plugin_will_build_tags_files, a p:naming_policy, and so on. Regarding the remark about editor-config: there is no neat way to specify values for vim variables or options if need be. With the main editorconfig plugin for vim, we cannot be sure a variable will be set before another one which could be tedious to introduce dependencies. -- Luc Hermitte -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [proposal] Project Information for vim
在 2019年2月22日星期五 UTC+8下午8:32:40,lith写道: > While a basically agree, wrt > > - root directory > > Why not allow many root markers? Since a VCS directory is usually created in > the project's root directory, these VCS directories would be a natural > choice. The autoproject plugin[1] does it this way, and IMHO (but I'm biased > :-)) it works quite well. I think it would be a mistake to require the > existence of some magic marker. The `.vimprj` folder is not only for root locating, but also used for storing project local setting files. Plugins will look into it for project-specific configuration. Storing these files inside a VCS directory will pollute them. That's why vscode use a standalong `.vscode` folder. But if you insist, you can also `set rootmarker=.git` and save configurations in your `.git` folder. > > - file list > > I'm not sure this should be provided by vim. Sooner or later you'd want to > cache this information. Then you'd have to check if the info is still up to > date. I'm not sure if this is within the scope of the standard vim > distribution. In this respect, one could ask whether vim should actually > provide the functionality or just define a standard api that is provided for > by a user-chosen plugin -- i.e. let one plugin provide filelists for > projects. One plugin uses more clever chaching, the other relies on this or > that external tool. > This can be done by a vim script shipped with vim, including: - return the file list. - apis to manipulate the filelist (add/remove with glob). - if `filelist` absents, but the project is inside a git repository, use `git ls-tree` to generate file list. -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.
Re: [proposal] Project Information for vim
While a basically agree, wrt - root directory Why not allow many root markers? Since a VCS directory is usually created in the project's root directory, these VCS directories would be a natural choice. The autoproject plugin[1] does it this way, and IMHO (but I'm biased :-)) it works quite well. I think it would be a mistake to require the existence of some magic marker. - file list I'm not sure this should be provided by vim. Sooner or later you'd want to cache this information. Then you'd have to check if the info is still up to date. I'm not sure if this is within the scope of the standard vim distribution. In this respect, one could ask whether vim should actually provide the functionality or just define a standard api that is provided for by a user-chosen plugin -- i.e. let one plugin provide filelists for projects. One plugin uses more clever chaching, the other relies on this or that external tool. E.g. set project_roots_provider=foobar#GetProjectRoots set project_filelist_provider=foobar#GetFileList echo project_filelist(project_root("project name")) " which would actually call foobar#GetFilelist() - buffer-local options If I got it right, the vim team tends towards EditorConfig for this? [1] https://github.com/tomtom/autoproject_vim -- -- You received this message from the "vim_dev" 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_dev" group. To unsubscribe from this group and stop receiving emails from it, send an email to vim_dev+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.