JuliaEditorSupport / julia-vim

Vim support for Julia.
http://julialang.org/
Other
753 stars 94 forks source link

tab complete mutating functions with the exclamation mark #194

Open yakir12 opened 4 years ago

yakir12 commented 4 years ago

(feature) It would be cool if when I tab-complete the name of a mutating function, the exclamation mark with be included: So in this code:

fun!(x, y) = ...

when I write fu<tab> I get fun! instead of just fun.

carlobaldassi commented 4 years ago

We could add ! (and maybe even @) to the iskeyword option, but that makes no distinction between characters used at the beginning or at the end of a word. Therefore something iike !something would be recognized as a keyword, and something would not be completed unless it also appeared by itself.

I'm not sure what's the best option here.

In any case if you want to give it a try you can give this command in a julia file:

:setlocal iskeyword+=!,@-@
yakir12 commented 4 years ago

Trying it out. So yea, it would irritate only when I use a Boolean not on a variable that was predefined in another unopened file (rare-ish), or on some function that wasn't spelled out yet (not so rare). Hmm... Is there a way for me to define this in the vim.rc/init.vim file? I want to see how irritating this could be.

carlobaldassi commented 4 years ago

I guess you could add this to vimrc/init.vim:

autocmd FileType julia setlocal iskeyword+=!

(now that I think about it adding @ is probably not a good idea since it's not really part of the name...)

Note that this does not only affect completion, but also word movements (e.g. using commands like dw, ciw and such), and the functionality of word search with */# (this one is potentially a major drawback in my mind).

yakir12 commented 4 years ago

Thanks. I'll try it for a while and report back.