Skip to content

Commit 0a7347f

Browse files
committed
Merge branch 'master' into testing
* master: fix var get Add config vars to open new and alternate files Return test/src path discriminators Remove alt paths from stop_paths
2 parents 468a535 + 5faa193 commit 0a7347f

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

rplugin/python3/acid/commands/alternate_file.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ def prepare_payload(self):
4040
path = current_file(self.nvim)
4141
root_path = current_path(self.nvim)
4242
rel_path = os.path.relpath(path, start=root_path).split('/')
43+
open_with = self.nvim.vars.get(
44+
'acid_open_alternate_file_with',
45+
nvim.vars.get('acid_open_new_file_with', 'edit')
46+
)
4347

4448
if rel_path[0] in src:
4549
log_debug("Current file is a 'src', changing to 'test'")
@@ -57,7 +61,7 @@ def prepare_payload(self):
5761
)
5862

5963
if os.path.exists(alt_path):
60-
self.nvim.command('edit {}'.format(alt_path))
64+
self.nvim.command('silent {} {}'.format(open_with, alt_path))
6165
else:
6266
ns = path_to_ns(alt_path, test | src)
6367
self.nvim.command('AcidNewFile {}'.format(ns))

rplugin/python3/acid/commands/new.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,13 @@ def prompt_default(nvim):
2323
def prepare_payload(self, ns):
2424
fname = "{}.clj".format(ns_to_path(ns))
2525
base = 'test' if ns.endswith('-test') else 'src'
26+
open_with = self.nvim.vars.get('acid_open_new_file_with', 'edit')
2627
path = os.path.join(current_path(self.nvim), base, fname)
2728

2829
with open(path, 'w') as fpath:
2930
fpath.write('(ns {})'.format(ns))
3031

31-
self.nvim.command('silent edit {}'.format(path))
32+
self.nvim.command('silent {} {}'.format(open_with, path))
3233

3334
# Does not interact with nrepl
3435
return None

rplugin/python3/acid/nvim/__init__.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -126,8 +126,7 @@ def src_paths(nvim):
126126
return {'src', *nvim.vars.get('acid_alt_paths', [])}
127127

128128
def get_stop_paths(nvim):
129-
return set() | test_paths(nvim) | src_paths(nvim)
130-
129+
return {'test', 'src'}
131130

132131
def find_file_in_path(nvim, msg):
133132
fname = msg['file']

0 commit comments

Comments
 (0)