Skip to content

Extending the list of "working path mode" markers. #141

@tplunket

Description

@tplunket

When g:ag_working_path_mode is 'r', the working directory is changed to a location which is divined to be the "project root." At present, that means that that a function is called to search up the hierarchy from the current working directory until one of a list of items is found. That hunt is implemented something like this:

" l:searchdir is the current directory we're examining and it ends with a '/'
for l:marker in ['.rootdir', '.git', '.hg', '.svn', 'bzr', '_darcs', 'build.xml']
  let l:item = l:searchdir . l:marker
  if filereadable(l:item) || isdirectory(l:item)
    return l:searchdir
  endif
endfor

My needs have evolved over time but generally these days I get away with adding 'tags' to the list would suffice. Is this common enough that it should just be added to the default?

My local changes are two-fold. One thing I did was make the list a global configuration item (named g:ag_working_path_root_markers). The other thing that I did was make the function that locates the project root a configuration variable as well; unfortunately it seems that function references need to have a leading capital letter while non-function variables need to begin with a lower case, so I couldn't fold them together. I use this replacement function for a job I had where the project root could be queried directly by a function so it made sense just to put that into place.

Should I put either or both of these up for review, or should I just add 'tags' to the list and be done with it?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions