buffer vim ex command

This commit is contained in:
Dmitry Vasilev
2023-09-29 18:49:06 +03:00
parent 561380faac
commit 4c3d8dd93d

View File

@@ -445,6 +445,23 @@ export class Editor {
cm.ace.execCommand("edit", input)
})
this.ace_editor.commands.addCommand({
name: 'buffer',
exec: (editor, input) => {
const search_query = input.args == null ? '' : input.args[0]
// TODO move to cmd.js
const module = search_query == ''
? ''
: Object.keys(get_state().files).find(name => name.includes(search_query))
if(module != null) {
exec('change_current_module', module)
}
}
})
VimApi.defineEx("buffer", "b", function(cm, input) {
cm.ace.execCommand("buffer", input)
})
// TODO remove my custom binding
VimApi.map('jj', '<Esc>', 'insert')
}