https://github.com/todesking/current_project.vim
https://github.com/todesking/current_project.vim
Last synced: 4 months ago
JSON representation
- Host: GitHub
- URL: https://github.com/todesking/current_project.vim
- Owner: todesking
- License: mit
- Created: 2014-06-21T08:15:23.000Z (about 12 years ago)
- Default Branch: master
- Last Pushed: 2015-01-25T13:17:10.000Z (over 11 years ago)
- Last Synced: 2025-01-12T21:46:29.541Z (over 1 year ago)
- Language: VimL
- Size: 285 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# current_project.vim: Project information from file path
## Usage
```vim
let info = current_project#info() " returns current buffer's information
" =>
{
\ 'name': 'current_project.vim',
\ 'path': '~/.vim/bundle/current_project.vim',
\ 'main_name': 'current_project.vim',
\ 'main_path': '~/.vim/bundle/current_project.vim',
\ 'sub_name': '',
\ 'sub_path': '~/.vim/bundle/current_project.vim',
\ }
let file_info = current_project#file_info()
" Same as current_project#info(), in addition `file_path` is available.
let summarized = current_project#summarize_path(expand('%'))
" =>
'[current_project.vim] README.md'
```
## Project detection logic
To find project root: `~/projects/`, or search `.git`, `.svn`, `.hg`(see `s:project_root_of()`)
To find subproject: User-defined subproject pattern(see `s:subproject_root()`, `s:subproject_patterns`)
## Setting directory
`~/.current_project.vim/`
## Example
```vim
" e-in-current-project
command! -complete=customlist,current_project#complete -nargs=1 Pe :exec ':e ' . current_project#info().path . '/' . ""
command! -complete=customlist,current_project#complete_main -nargs=1 PE :exec ':e ' . current_project#info().main_path . '/' . ""
```
```vim
" statusline example
set statusline=%{current_project#summarize_path(expand('%'))}
```