Skip to content

Do not treat line comments with cindent. #68

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

Merged
merged 2 commits into from Mar 8, 2013
Merged

Do not treat line comments with cindent. #68

merged 2 commits into from Mar 8, 2013

Conversation

ghost
Copy link

@ghost ghost commented Mar 5, 2013

Node code sample to reproduce bad line comment indent:

app.get('/test', function (req, res) {
        // badly indented line comment, should be aligned with req.session
    req.session.destroy(function () {
        res.redirect('/');
    });
});

@goatslacker
Copy link
Collaborator

I can't repro your failing test case. What is your indent settings for ViM and how are you indent this code that this happens?

@ghost
Copy link
Author

ghost commented Mar 6, 2013

Tried with different indent settings and cannot get something correct. I just pasted the sample in an empty js file and did a 'gg=G' to indent the code. Here is the indent part of my .vimrc:

" Filetype specific.
syntax on                   " Syntax highlight.
filetype indent plugin on   " Auto indent based on file type.

" Indenting.
set autoindent              " Auto indent to previous line.
"set smartindent             " Do it smart for blocks.
set cinoptions=:0           " Align case labels with switch in C.

" Tabulations.
set tabstop=4               " Width of TAB character in spaces.
set softtabstop=4           " Spaces inserted when pressing <TAB>.
set shiftwidth=4            " Number of spaces to use for an (auto)indent.
set expandtab               " Use spaces instead of tabulations.

And the full .vimrc: https://github.com/hickop/dotfiles/blob/master/.vimrc

@@ -41,6 +41,9 @@ let s:syng_string = 'regex\c'
" Regex of syntax group names that are strings or documentation.
let s:syng_multiline = 'comment\c'

" Regex of syntax group names that are line comment.
let s:syng_linecom = 'linecomment'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This only works for me if you change it to 'linecomment\c'

@goatslacker
Copy link
Collaborator

I can repro, it's related to the fix in #31

This fix however isn't working for me (see inline comments)

goatslacker added a commit that referenced this pull request Mar 8, 2013
Fixes comment indentation
@goatslacker goatslacker merged commit c8730a1 into pangloss:master Mar 8, 2013
@goatslacker
Copy link
Collaborator

Thanks for the pull request.

bounceme added a commit that referenced this pull request May 8, 2016
bounceme added a commit that referenced this pull request May 9, 2016
* c style opening curly braces

#68

* Update javascript.vim
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant