-
Notifications
You must be signed in to change notification settings - Fork 156
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
Add basic projectionist support #451
base: master
Are you sure you want to change the base?
Conversation
You could also set |
let root = simplify(fnamemodify('.', ':p:s?[\/]$??')) | ||
|
||
let projections = {} | ||
let projections['lib/*.ex'] = { 'type': 'main', 'alternate': ['test/{}_test.exs'] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I prefer type: source
to type: main
, which follows the convention used by the Projectionist documentation. What do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I use type: lib
|
||
let projections = {} | ||
let projections['lib/*.ex'] = { 'type': 'main', 'alternate': ['test/{}_test.exs'] } | ||
let projections['lib/**/*.ex'] = { 'type': 'main', 'alternate': ['test/{}_test.exs'] } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these additional lib/**/
and test/**/
entries necessary? The lib/*.ex
/ test/*.ex
entries work well for me, even with file hierarchies.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, these aren't needed, quoting docs:
From a globbing perspective,
"*"
is actually a stand in for"**/*"
. For advanced cases, you can include both globs explicitly:"test/**/test_*.rb"
. When expanding with{}
, the**
and*
portions are joined with a slash. If necessary, thedirname
andbasename
expansions can be used to split the value back apart.
My configuration for projectionist looks like this: let g:projectionist_heuristics['mix.exs'] = {
\ 'apps/*/mix.exs': { 'type': 'app' },
\ 'lib/*.ex': {
\ 'type': 'lib',
\ 'alternate': 'test/{}_test.exs',
\ 'template': ['defmodule {camelcase|capitalize|dot} do', 'end'],
\ },
\ 'test/*_test.exs': {
\ 'type': 'test',
\ 'alternate': 'lib/{}.ex',
\ 'template': ['defmodule {camelcase|capitalize|dot}Test do', ' use ExUnit.Case', '', ' @subject {camelcase|capitalize|dot}', '', ' doctest @subject', 'end'],
\ },
\ 'mix.exs': { 'type': 'mix' },
\ 'config/*.exs': { 'type': 'config' },
\ '*.ex': {
\ 'makery': {
\ 'lint': { 'compiler': 'credo' },
\ 'test': { 'compiler': 'exunit' },
\ 'build': { 'compiler': 'mix' }
\ }
\ },
\ '*.exs': {
\ 'makery': {
\ 'lint': { 'compiler': 'credo' },
\ 'test': { 'compiler': 'exunit' },
\ 'build': { 'compiler': 'mix' }
\ }
\ }
\ } |
@hauleth I like your configuration, 👍 on configuring it that way... I would just add the dispatch config to it, since it's a well known package too |
Yep, realized that, will check that one someday, but for now I'm sticking with dispatch. |
This is quite old and doesn't look like there are any signs of it getting merged but just wanted to weigh in here: I don't think it's a good idea for this to be included in this repo for the very reason outlined by the above convo and comments on the PR: I think this type of thing would be best included under a "Tips" category or the like in the wiki or README. |
Hello, few days ago i bothered to add support for https://github.com/tpope/vim-projectionist to my config files. Basically i use
A
shortcut to navigate between tests/source-code, i think it could be useful for other people.Feel free to modify, thank you for this repo.