This plugin provides an easy way of switching between project directories indexed from a specified workspace folder or folders. It's based on an idea I originally stole from kieran-bamforth's dotfiles.
Plug 'junegunn/fzf.vim' "requirement from benwainwright/fzf-project
Plug 'tpope/vim-fugitive' "requirement from benwainwright/fzf-project
Plug 'benwainwright/fzf-project'Plugin 'junegunn/fzf.vim' "requirement from benwainwright/fzf-project
Plugin 'tpope/vim-fugitive' "requirement from benwainwright/fzf-project
Plugin 'benwainwright/fzf-project'Running FzfSwitchProject in command mode will produce a list of folders from
within your workspace folders. When you select a project, the working directory
is changed and you are presented with a fzf list of files to switch to.
Installing FzfSwitchProject will automatically cd to the root directory of
any given project when you open a file. It does this by recursively locating the
nearest .git folder in the directory hierarchy. For this reason, is
recommended to use git with this plugin
To assist with the above, if you switch to a folder that does not contain a
.git repository, you have the option of automatically creating one. This
behavior can be configured below.
let g:fzfSwitchProjectWorkspaces = [ '~/workspace1', '~/workspace2' ]automatically list projects in the above folders
let g:fzfSwitchProjectProjects = [ '~/folder1', '~/folder2' ]add individual folders to the project list (I use it for my dotfiles folder)
let g:fzfSwitchProjectGitInitBehavior = 'ask' " defaultwhat to do if you switch to a project folder that doesn't contain a .git
directory:
ask(default) prompt the user to confirm if a new git repository should be initialisedautoalways initialise a new git repository if one isn't foundnonedo nothing
Command that is executed to get a list of all the files in a given project
let g:fzfSwitchProjectFindFilesCommand = 'git ls-files --others --exclude-standard --cached' " defaultDon't automatically open a file picker once project is selected
let g:fzfSwitchProjectAlwaysChooseFile = 0FzfSwitchProject- open project switcherFzfChooseProjectFile- switch file within project
