Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dynamically setting up vim-project #13

Open
rengolin opened this issue Jun 13, 2016 · 0 comments
Open

Dynamically setting up vim-project #13

rengolin opened this issue Jun 13, 2016 · 0 comments

Comments

@rengolin
Copy link

This is a bit of an odd one, but I'm at odds with vim-script (which I'm not very good at).

So, we use Git worktrees, and we automated in a way that we can create multiple directories as worktrees of the main repo, and we can edit, build and test each one of them on separate terminals, depending on which environment variables we've set.

A simplified view of my current setup:

" Vim Project
set rtp+=~/.vim/ext/vim-project/
let llvm = $LLVM_SRC
call project#rc("")
  Project llvm, 'LLVM'
call project#rc()`

For some reason, using "$LLVM_SRC" in there doesn't work, I needed a vim variable. Anyway...

That works when I start my Vim from the command line, where I have all the variables set, but not from my window manager's key binding (i3wm). So, I wanted to list all the directories in my worktree base and list them as projects, and not need any setup ($LLVM_ROOT is set in .bashrc).

Here's my feeble attempt:

" Vim Project
set rtp+=~/.vim/ext/vim-project/
let g:project_use_nerdtree = 1
let project_config = "call project#rc(\"\")\n"
for workdir in split(globpath($LLVM_ROOT, '*'), '\n')
  let dir = fnamemodify(workdir, ':t')
  if dir != "repos"
    let project_config .= "  Project '".dir."', 'LLVM ".dir."'\n"
  endif
endfor
let project_config .= "call project#rc()"
echo project_config
execute project_config

Which produces:

call project#rc("")
  Project 'default', 'LLVM default'
  Project 'other', 'LLVM other'
call project#rc()

but vim-project says:

E116: Invalid arguments for function project#config#project

I'm guessing that the execute is serialising everything and project#config#project thinks that the base dir is everything after the call?

Is there another way of doing this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant