Hello,
I try to configure neovim for having a decent support of nim in it. I've installed alaviss plugin and as suggested in the plugin's documentation: asyncomplete. I've also installed syntastic.
asyncomplete completes nothing.
alaviss/nim colorizes and indents ok, searching of definitions (with _gd shortcut) works too. And all my proc are folded by default at startup (i think its alaviss default behaviour ?)
syntastic doesn't work at all (i tried also ale with no luck).
So, for installing all those little plugins, i did:
all plug#begin()
" https://github.com/alaviss/nim.nvim
Plug 'alaviss/nim.nvim'
" https://github.com/prabirshrestha/asyncomplete.vim
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'scrooloose/syntastic'
" Plug 'dense-analysis/ale'
call plug#end()
And then launched :PlugInstall. Install ok !
Then i tried configuring asyncomplete
au User asyncomplete_setup call asyncomplete#register_source({
\ 'name': 'nim',
\ 'whitelist': ['nim'],
\ 'completor': {opt, ctx -> nim#suggest#sug#GetAllCandidates({start, candidates -> asyncomplete#complete(opt['name'], ctx, start, candidates)})}
\ })
let g:asyncomplete_auto_popup = 0
imap <c-space> <Plug>(asyncomplete_force_refresh)
function! s:check_back_space() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~ '\s'
endfunction
noremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ <SID>check_back_space() ? "\<TAB>" :
\ asyncomplete#force_refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
well, doesn't do anything. My tab key stops working, but that's the only visible effect. C-p still complete with current buffers values.
For syntastic , i've left as is, default configuration (i've just checked it was enabled, and it is). It does nothing when saving (default behaviour, shoud show bugs and errors).
If you have tricks, or maybe a neovim (or vim ?) config file to share …
Thank you for reading !
Thank you, i have followed the tutorial, and i have now a working Ale !
The only thing left not working is asyncomplete, i leave it for later, that's not annoying (C-p is still working, so…)
alaviss/nim colorizes and indents ok, searching of definitions (with gd shortcut) works too. And all my proc are folded by default at startup (i think its alaviss default behaviour ?)
Personnaly, I added setlocal foldlevel 99 to $HOME/.config/nvim/plugged/nim.nvim/ftplugin/nim.vim right after setlocal foldmethod=indent. My fold start open and I can still close them with zc, zC, za etc..
So, as i was writing before, if there is a nims (nim script) with the same name of a source file (for building it), Ale stops working.
I can edit and lint sources with other names. So what can i do, except editing only files with different names ? Using Makefiles maybe ?
At startup of nvim, i have this message: nimsuggest instance for project /home/jseb/…/project stopped with exitcode: 1
I get it whatever the nim source name is (but Ale still works with sources filenames different that nims name). Ok that getting complex, here is a sample.
project.nims , project.nim -> while editing project.nim, the linter is disabled and i have the warning above from nimsuggest.
project.nims , bob.nim -> while editing bob.nim, linting is ok, but i still have the warning from nimsuggest.
project.nim , bob.nim -> can edit both, linting ok, no warning from nimsuggest.
I don't have this message in a directory
This is how I set it up a while ago, maybe it gives you some ideas: https://www.rockyourcode.com/setup-nim-with-neovim/
I currently use vim-lsc instead of LanguageClient-neovim, but the setup is similar.
The only thing left not working is asyncomplete, i leave it for later, that's not annoying (C-p is still working, so…)
That's weird, maybe you can try ncm2 instead? The configuration for use with nim.nvim can be found here