Tuesday, October 10, 2017

Re: How to set comment character as double dash in front of formatted text?

On Tue, Oct 10, 2017 at 2:03 PM, Igor Forca <igor2x@gmail.com> wrote:
> @Thobias, thanks for tips, but not working in my case. Set ft returns "sql", I
> am editing relational database SQL file. Manually setting it to lua (for test), and execute format command does not solve my problem.
>
> @Tony, thanks for providing help. I have managed to solve a problem with setting:
> :setlocal comments=:--
> and executing format paragraph command.
>
> But because I don't want to mess other file types (I sometimes need # as
> comment when editing some bash files), I set autocommand to fire up only
> for .sql file types. Final command I have written in my .vimrc is now:
> :autocmd BufEnter *.sql :setlocal comments=:--
>
> Problem solved. Thanks a lot to both of you.

To avoid messing other filetypes, you could also create a filetype-plugin, named

(Unix) ~/.vim/after/ftplugin/sql.vim
(Windows) $HOME/vimfiles/after/ftplugin/sql.vim

and containing the line

setlocal comments:--

But maybe there is an already known sql dialect using this kind of
comment leader, see
:help ft-sql.txt
:help sql-dialects


Best regards,
Tony.

--
--
You received this message from the "vim_use" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_use" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_use+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment