-
Notifications
You must be signed in to change notification settings - Fork 47
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrate JoosepAlviste/nvim-ts-context-commentstring #165
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey @tyru! Something like this seems great. I added a few notes that might help. Once this PR gets merged, I'll make sure to mention the integration in nvim-ts-context-commentstring
README :)
autoload/caw.vim
Outdated
if conft !=# &l:filetype | ||
if integration ==# 'ts_context_commentstring' | ||
let old_commentstring = &l:commentstring | ||
lua require('ts_context_commentstring.internal').update_commentstring() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure if it helps, but I added another function: calculate_commentstring
, which returns the commentstring
as a string or nil
. The only difference is that it doesn't update the commentstring
setting for the buffer. If you'd like, then you can use it with luaeval
like so:
let commentstring = luaeval('require("ts_context_commentstring.internal").calculate_commentstring()')
" `commentstring` is either a string or `v:nil`
" Context filetype support. | ||
" https://github.com/Shougo/context_filetype.vim | ||
if s:installed_context_filetype | ||
if integration ==# 'context_filetype' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not 100% sure how Shougo/context_filetype.vim works, but I think that a user might use both context_filetype.vim
and nvim-ts-context-commentstring
(in different files). Some languages like vimscript don't have a treesitter parser, so using context_filetype.vim
for those makes sense. Right now, it looks like only one of those integrations would work.
- Add g:caw_integrated_plugin - Add caw#update_comments_from_commentstring()
8197ff9
to
703db47
Compare
JoosepAlviste/nvim-ts-context-commentstring#12
g:caw_integrated_plugin
caw#update_comments_from_commentstring()