Skip to content
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

rails.vim indentation settings ignored in macvim #108

Closed
gorkunov opened this issue Jul 20, 2011 · 15 comments
Closed

rails.vim indentation settings ignored in macvim #108

gorkunov opened this issue Jul 20, 2011 · 15 comments

Comments

@gorkunov
Copy link

I customize indention settings for vim on ubuntu with:

autocmd User Rails if &ft == 'javascript' | set tabstop=4 softtabstop=4 shiftwidth=4 expandtab | endif

macvim ignores this line and uses default settings (indent=2).
Also i tried:

autocmd User Rails/**/*.js  set tabstop=4 softtabstop=4 shiftwidth=4 expandtab

but has no effect too.

@graywh
Copy link
Contributor

graywh commented Jul 20, 2011

What does this tell you? :verbose set sw?

@gorkunov
Copy link
Author

shiftwidth=2
   Last set from ~/.vim/bundle/vim-rails/autoload/rails.vim

But in my vimrc:
https://github.com/gorkunov/vimconfig/blob/master/vimrc#L298

@gorkunov
Copy link
Author

macvim installed from homebrew (vim version displayed 7.3.237)

@graywh
Copy link
Contributor

graywh commented Jul 21, 2011

And you've verified that the autocmd is still present after starting Vim? :autocmd User

@gorkunov
Copy link
Author

Yes, it's presented.

@tpope
Copy link
Owner

tpope commented Aug 7, 2011

You're on a recent version of rails.vim, right? Does the javascript file have a modeline? I don't know what else could cause this to fail. Both of your autocmds work for me. The relevant portion of the code definitely runs after indenting is adjusted.

You can try set verbose=9 and see if your autocmd is being executed (it's a lot to sift through). You can also try adjusting the position of that autocmd in your vimrc (though it's hard to imagine that helping in this particular case). Or you can wait on me to disable the javascript indent adjusting (I plan to do it after the next release).

@gorkunov
Copy link
Author

gorkunov commented Aug 7, 2011

I use last version of rails.vim from github. All js files haven't modeline settings. Also I found that settings customization overrided by rails.vim settings only in macvim (vim works fine). This is macvim log when started opening js file:

Executing User Auto commands for "Rails"
autocommand if &ft == 'javascript' | set tabstop=4 softtabstop=4 shiftwidth=4 expandtab | endif

Executing User Auto commands for "Rails"
autocommand if &ft == 'javascript' | set tabstop=4 softtabstop=4 shiftwidth=4 expandtab | endif

No matching autocommands
chdir(Rails/public/app)
fchdir() to previous dir
No matching autocommands
Executing BufRead Auto commands for "*.js"
autocommand setf javascript

Executing FileType Auto commands for "*"
autocommand call s:LoadFTPlugin()

Searching for "ftplugin/javascript.vim ftplugin/javascript_*.vim ftplugin/javascript/*.vim" in "/Users/gorkunov/.vim,/Users/gorkunov/.vim/bundle/applescript,/Users/gorkunov/.vim/bundle/bufkill,/Users/gorkunov/.vim/bundle/bufonly,/Users/gorkunov/.vim/bundle/camelcasemotion,/Users/gorkunov/.vim/bundle/command-t,/Users/gorkunov/.vim/bundle/fugitive,/Users/gorkunov/.vim/bundle/git,/Users/gorkunov/.vim/bundle/haml,/Users/gorkunov/.vim/bundle/nerdcommenter,/Users/gorkunov/.vim/bundle/nerdtree,/Users/gorkunov/.vim/bundle/rvm,/Users/gorkunov/.vim/bundle/scss-syntax,/Users/gorkunov/.vim/bundle/supertab,/Users/gorkunov/.vim/bundle/surround,/Users/gorkunov/.vim/bundle/tabular,/Users/gorkunov/.vim/bundle/vim-easymotion,/Users/gorkunov/.vim/bundle/vim-indent-guides,/Users/gorkunov/.vim/bundle/vim-rails,/Users/gorkunov/.vim/bundle/vim-ruby,/Applications/MacVim.app/Contents/Resources/vim/vimfiles,/Applications/MacVim.app/Contents/Resources/vim/runtime,/Applications/MacVim.app/Contents/Resources/vim/vimfiles/after,/Users/gor
...
chdir(/Applications/MacVim.app/Contents/Resources/vim/runtime/ftplugin)
fchdir() to previous dir
line 17: sourcing "/Applications/MacVim.app/Contents/Resources/vim/runtime/ftplugin/javascript.vim"
finished sourcing /Applications/MacVim.app/Contents/Resources/vim/runtime/ftplugin/javascript.vim
continuing in function <SNR>14_LoadFTPlugin
Searching for "/Applications/MacVim.app/Contents/Resources/vim/runtime/ftplugin/javascript_*.vim"
...
chdir(/Users/gorkunov/.vim/after/ftplugin)
fchdir() to previous dir
line 17: sourcing "/Users/gorkunov/.vim/after/ftplugin/javascript.vim"
finished sourcing /Users/gorkunov/.vim/after/ftplugin/javascript.vim
continuing in function <SNR>14_LoadFTPlugin
Searching for "/Users/gorkunov/.vim/after/ftplugin/javascript_*.vim"
...
Executing FileType Auto commands for "*"
autocommand call s:LoadIndent()

Searching for "indent/javascript.vim" in "/Users/gorkunov/.vim,/Users/gorkunov/.vim/bundle/applescript,/Users/gorkunov/.vim/bundle/bufkill,/Users/gorkunov/.vim/bundle/bufonly,/Users/gorkunov/.vim/bundle/camelcasemotion,/Users/gorkunov/.vim/bundle/command-t,/Users/gorkunov/.vim/bundle/fugitive,/Users/gorkunov/.vim/bundle/git,/Users/gorkunov/.vim/bundle/haml,/Users/gorkunov/.vim/bundle/nerdcommenter,/Users/gorkunov/.vim/bundle/nerdtree,/Users/gorkunov/.vim/bundle/rvm,/Users/gorkunov/.vim/bundle/scss-syntax,/Users/gorkunov/.vim/bundle/supertab,/Users/gorkunov/.vim/bundle/surround,/Users/gorkunov/.vim/bundle/tabular,/Users/gorkunov/.vim/bundle/vim-easymotion,/Users/gorkunov/.vim/bundle/vim-indent-guides,/Users/gorkunov/.vim/bundle/vim-rails,/Users/gorkunov/.vim/bundle/vim-ruby,/Applications/MacVim.app/Contents/Resources/vim/vimfiles,/Applications/MacVim.app/Contents/Resources/vim/runtime,/Applications/MacVim.app/Contents/Resources/vim/vimfiles/after,/Users/gorkunov/.vim/bundle/tabular/after,/Users/gorkunov/.vim/a
...
chdir(/Users/gorkunov/.vim/indent)
fchdir() to previous dir
line 14: sourcing "/Users/gorkunov/.vim/indent/javascript.vim"
Error detected while processing /Users/gorkunov/.vim/indent/javascript.vim:
line   16:
E486: Pattern not found: \r$
finished sourcing /Users/gorkunov/.vim/indent/javascript.vim
continuing in function <SNR>15_LoadIndent
Searching for "/Users/gorkunov/.vim/bundle/applescript/indent/javascript.vim"
...
chdir(/Applications/MacVim.app/Contents/Resources/vim/runtime/indent)
fchdir() to previous dir
line 14: sourcing "/Applications/MacVim.app/Contents/Resources/vim/runtime/indent/javascript.vim"
finished sourcing /Applications/MacVim.app/Contents/Resources/vim/runtime/indent/javascript.vim
continuing in function <SNR>15_LoadIndent
Searching for "/Applications/MacVim.app/Contents/Resources/vim/vimfiles/after/indent/javascript.vim"
...
Executing FileType Auto commands for "*"
autocommand :call s:SetUpForNewFiletype(&filetype, 1)

Executing FileType Auto commands for "*"
autocommand exe "set syntax=" . expand("<amatch>")

Executing Syntax Auto commands for "*"
autocommand call s:SynSet()

Searching for "syntax/javascript.vim syntax/javascript/*.vim" in "/Users/gorkunov/.vim,/Users/gorkunov/.vim/bundle/applescript,/Users/gorkunov/.vim/bundle/bufkill,/Users/gorkunov/.vim/bundle/bufonly,/Users/gorkunov/.vim/bundle/camelcasemotion,/Users/gorkunov/.vim/bundle/command-t,/Users/gorkunov/.vim/bundle/fugitive,/Users/gorkunov/.vim/bundle/git,/Users/gorkunov/.vim/bundle/haml,/Users/gorkunov/.vim/bundle/nerdcommenter,/Users/gorkunov/.vim/bundle/nerdtree,/Users/gorkunov/.vim/bundle/rvm,/Users/gorkunov/.vim/bundle/scss-syntax,/Users/gorkunov/.vim/bundle/supertab,/Users/gorkunov/.vim/bundle/surround,/Users/gorkunov/.vim/bundle/tabular,/Users/gorkunov/.vim/bundle/vim-easymotion,/Users/gorkunov/.vim/bundle/vim-indent-guides,/Users/gorkunov/.vim/bundle/vim-rails,/Users/gorkunov/.vim/bundle/vim-ruby,/Applications/MacVim.app/Contents/Resources/vim/vimfiles,/Applications/MacVim.app/Contents/Resources/vim/runtime,/Applications/MacVim.app/Contents/Resources/vim/vimfiles/after,/Users/gorkunov/.vim/bundle/tabular/afte
Searching for "/Users/gorkunov/.vim/syntax/javascript.vim"
chdir(/Users/gorkunov/.vim/syntax)
fchdir() to previous dir
line 22: sourcing "/Users/gorkunov/.vim/syntax/javascript.vim"
finished sourcing /Users/gorkunov/.vim/syntax/javascript.vim
continuing in function <SNR>6_SynSet
Searching for "/Users/gorkunov/.vim/syntax/javascript/*.vim"
...
chdir(/Applications/MacVim.app/Contents/Resources/vim/runtime/syntax)
fchdir() to previous dir
line 22: sourcing "/Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/javascript.vim"
finished sourcing /Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/javascript.vim
continuing in function <SNR>6_SynSet
Searching for "/Applications/MacVim.app/Contents/Resources/vim/runtime/syntax/javascript/*.vim"
...
Executing Syntax Auto commands for "javascript"
autocommand if exists("b:rails_root") | call s:BufSyntax() | endif

Executing FileType Auto commands for "*"
autocommand if exists("b:rails_root") | call s:BufSettings() | endif

chdir(public/app)
fchdir() to previous dir
chdir(public/app)
fchdir() to previous dir
Executing BufRead Auto commands for "*"
autocommand if !did_filetype() && expand("<amatch>") !~ g:ft_ignore_pat | r

@tpope
Copy link
Owner

tpope commented Aug 7, 2011

Error detected while processing /Users/gorkunov/.vim/indent/javascript.vim:

raises some alarm bells. Can you fix that and see if the problem persists?

@gorkunov
Copy link
Author

gorkunov commented Aug 7, 2011

I removed this file for experiment but nothing's changed.

@tpope
Copy link
Owner

tpope commented Aug 7, 2011

Can you try broadening the autocmd to

autocmd User Rails set tabstop=4 softtabstop=4 shiftwidth=4 expandtab

And then checking if it works in either JavaScript or Ruby?

@gorkunov
Copy link
Author

gorkunov commented Aug 7, 2011

nothing's changed. Not for ruby, not for js.

@tpope
Copy link
Owner

tpope commented Aug 7, 2011

Well, given the lack of other clues, I'm going to give my standard advice of removing all other plugins, stripping down your vimrc, and seeing if the problem persists. If it doesn't, you're a binary search away from finding the cause.

@gorkunov
Copy link
Author

gorkunov commented Aug 7, 2011

also I updated mac vim to snapshot n.61 (vim 7.3.260) when migrated to os x lion.

@tpope
Copy link
Owner

tpope commented Aug 7, 2011

I just tried in snapshot 61 on Lion and it works fine.

tpope added a commit that referenced this issue Aug 27, 2011
@tpope
Copy link
Owner

tpope commented Aug 27, 2011

Hopefully rendered moot now.

@tpope tpope closed this as completed Aug 27, 2011
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

No branches or pull requests

3 participants