7

The simple way is if get(g:, 'myplugin_enable_feature', defaultvalue) do whatever you want endif Now when I need to check a setting in more than one place, I usually prefer to have a dedicated getter in my plugin to be sure I have the same default value everywhere function! s:enable_feature() abort return get(g:, 'myplugin_enable_feature', ...


4

Usually it suffices to use get() function. Like that if get(g:, 'myplugin_enable_feature') " do something endif If the feature should be enabled by default you can change it to get(g:, 'myplugin_enable_feature', 1).


3

"tags" is probably the closest built-in, if you want to complete project contents, but you'd need a tags file. There doesn't seem to be a method for buffer contents. We can write a custom one: function! CompleteWords(ArgLead, CmdLine, ...) return getline(1, '$')->join(' ')->split('\s\+') \ ->filter({_,x->match(x, '^\h\w\+$') > -1})...


1

For :!% to work, you need a few prerequisites to be fulfilled. First, you need the file itself to be executable. If it's a Python script, that means it needs to have a proper "shebang" at the start, such as #!/usr/bin/env python or #!/usr/bin/python or similar. It looks like you added one of those, so try and make sure it's actually correct. ...


Only top voted, non community-wiki answers of a minimum length are eligible