Closed sunnyrjuneja closed 6 years ago
Huh, this seems to indent for me, though I use ~
to do visual line, then hit =
once I've selected it all.
Weird. I still have this suse. My vim version reads this:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Feb 9 2014 15:14:14)
MacOS X (unix) version
Included patches: 1-52
Compiled by Homebrew
Huge version with MacVim GUI. Features included (+) or not (-):
+acl +cmdline_info +emacs_tags -gettext -lua +mouse_urxvt +profile +statusline +transparency -X11
+arabic +comments +eval -hangul_input +menu +mouse_xterm +python -sun_workshop +user_commands -xfontset
+autocmd +conceal +ex_extra +iconv +mksession +multi_byte -python3 +syntax +vertsplit +xim
+balloon_eval +cryptv +extra_search +insert_expand +modify_fname +multi_lang +quickfix +tag_binary +virtualedit -xsmp
+browse +cscope +farsi +jumplist +mouse -mzscheme +reltime +tag_old_static +visual -xterm_clipboard
++builtin_terms +cursorbind +file_in_path +keymap +mouseshape +netbeans_intg +rightleft -tag_any_white +visualextra -xterm_save
+byte_offset +cursorshape +find_in_path +langmap +mouse_dec +odbeditor +ruby +tcl +viminfo -xpm
+cindent +dialog_con_gui +float +libcall -mouse_gpm +path_extra +scrollbind +terminfo +vreplace
+clientserver +diff +folding +linebreak -mouse_jsbterm +perl +signs +termresponse +wildignore
+clipboard +digraphs -footer +lispindent +mouse_netterm +persistent_undo +smartindent +textobjects +wildmenu
+cmdline_compl +dnd +fork() +listcmds +mouse_sgr +postscript -sniff +title +windows
+cmdline_hist -ebcdic +fullscreen +localmap -mouse_sysmouse +printer +startuptime +toolbar +writebackup
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/Applications/MacVim.app/Contents/Resources/vim"
Compilation: clang -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_MACVIM -Wall -Wno-unknown-pragmas -pipe -DMACOS_X_UNIX -no-cpp-precomp -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
-I/System/Library/Frameworks/Tcl.framework/Headers -D_REENTRANT=1 -D_THREAD_SAFE=1 -D_DARWIN_C_SOURCE=1
Linking: clang -L. -L/usr/local/lib -L. -L/usr/local/lib -L/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -F/System/Library/Frameworks/Python.fra
mework -L/usr/local/lib -o Vim -framework Cocoa -framework Carbon -lm -lncurses -liconv -framework Cocoa -fstack-protector -L/usr/local/lib -L/System/Library/Perl/5.16/
darwin-thread-multi-2level/CORE -lperl -framework Python -F/System/Library/Frameworks -framework Tcl -framework CoreFoundation -framework Ruby
This is my .vimrc
" wasd's .vimrc
syntax enable
set nocompatible " choose no compatibility with legacy vi
filetype off " Enable filetype detection
set t_Co=256
set encoding=utf-8
set showcmd " display incomplete commands
set number " add line numbers
set autoread
set hid
" Whitespace
set tabstop=2 shiftwidth=2 " a tab is two spaces (or set this to 4)
set expandtab " use spaces, not tabs (optional)
set backspace=indent,eol,start " backspace through everything in insert mode
" Indentation
set smartindent " copies indentation from previous lines
set autoindent " adds an extra level of indentation
set linebreak wrap tw=0 " line breaks and word wrapping visually
" Searching
set incsearch " incremental searching
set ignorecase " searches are case insensitive...
set smartcase " ... unless they contain at least one capital letter
" easier navigation between split windows
nnoremap <c-j> <c-w>j
nnoremap <c-k> <c-w>k
nnoremap <c-h> <c-w>h
nnoremap <c-l> <c-w>l
set clipboard=unnamed
" save files when you forget to prepend sudo
cmap w!! %!sudo tee > /dev/null %
set rtp+=~/.vim/bundle/vundle/
call vundle#rc()
" let Vundle manage Vundle
" required!
Bundle 'gmarik/vundle'
Bundle 'kchmck/vim-coffee-script'
Bundle 'slim-template/vim-slim'
Bundle 'altercation/vim-colors-solarized'
Bundle 'tpope/vim-rails'
Bundle 'scrooloose/nerdtree'
Bundle 'Valloric/YouCompleteMe'
Bundle 'rust-lang/rust.vim'
set background=dark
colorscheme solarized
" Enable filetype plugin
filetype plugin indent on
autocmd vimenter * if !argc() | NERDTree | endif
let mapleader = ","
nmap <leader>ne :NERDTreeToggle<cr>
I'm using OS X 10.10.4.
I was able to reproduce this on my Ubuntu machine with a very similar .vimrc. vim --version
reads:
VIM - Vi IMproved 7.4 (2013 Aug 10, compiled Dec 5 2013 19:25:29)
Included patches: 1-110
Compiled by wasd@pearl
Huge version with GTK2 GUI. Features included (+) or not (-):
+acl +farsi +mouse_netterm +syntax
+arabic +file_in_path +mouse_sgr +tag_binary
+autocmd +find_in_path -mouse_sysmouse +tag_old_static
+balloon_eval +float +mouse_urxvt -tag_any_white
+browse +folding +mouse_xterm -tcl
++builtin_terms -footer +multi_byte +terminfo
+byte_offset +fork() +multi_lang +termresponse
+cindent +gettext -mzscheme +textobjects
+clientserver -hangul_input +netbeans_intg +title
+clipboard +iconv +path_extra +toolbar
+cmdline_compl +insert_expand -perl +user_commands
+cmdline_hist +jumplist +persistent_undo +vertsplit
+cmdline_info +keymap +postscript +virtualedit
+comments +langmap +printer +visual
+conceal +libcall +profile +visualextra
+cryptv +linebreak +python +viminfo
+cscope +lispindent -python3 +vreplace
+cursorbind +listcmds +quickfix +wildignore
+cursorshape +localmap +reltime +wildmenu
+dialog_con_gui -lua +rightleft +windows
+diff +menu -ruby +writebackup
+digraphs +mksession +scrollbind +X11
+dnd +modify_fname +signs -xfontset
-ebcdic +mouse +smartindent +xim
+emacs_tags +mouseshape -sniff +xsmp_interact
+eval +mouse_dec +startuptime +xterm_clipboard
+ex_extra -mouse_gpm +statusline -xterm_save
+extra_search -mouse_jsbterm -sun_workshop +xpm
system vimrc file: "$VIM/vimrc"
user vimrc file: "$HOME/.vimrc"
2nd user vimrc file: "~/.vim/vimrc"
user exrc file: "$HOME/.exrc"
system gvimrc file: "$VIM/gvimrc"
user gvimrc file: "$HOME/.gvimrc"
2nd user gvimrc file: "~/.vim/gvimrc"
system menu file: "$VIMRUNTIME/menu.vim"
fall-back for $VIM: "/usr/share/vim"
f-b for $VIMRUNTIME: "/usr/share/vim/vim74"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -DFEAT_GUI_GTK -pthread -I/usr/include/gtk-2.0 -I/usr/lib/x86_64-linux-gnu/gtk-2.0/include -I/usr/include/atk-1.0 -I/usr/include/cairo -I/usr/include/gdk-pixbuf-2.0 -I/usr/include/pango-1.0 -I/usr/include/gio-unix-2.0/ -I/usr/include/glib-2.0 -I/usr/lib/x86_64-linux-gnu/glib-2.0/include -I/usr/include/pixman-1 -I/usr/include/freetype2 -I/usr/include/libpng12 -I/usr/include/harfbuzz -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc -L/usr/local/lib -Wl,--as-needed -o vim -lgtk-x11-2.0 -lgdk-x11-2.0 -latk-1.0 -lgio-2.0 -lpangoft2-1.0 -lpangocairo-1.0 -lgdk_pixbuf-2.0 -lcairo -lpango-1.0 -lfreetype -lfontconfig -lgobject-2.0 -lglib-2.0 -lSM -lICE -lXpm -lXt -lX11 -lXdmcp -lSM -lICE -lm -ltinfo -lnsl -lselinux -ldl -L/usr/lib/python2.7-config -lpython2.7
I suspect that if you upgraded to the latest patches of Vim 7.4 (rather than just 1–52) it would work properly for you. As I recall it, there was something to do with the J
cinoptions value (:help cino-J
) which was broken and which got fixed somewhere between Vim 7.4.100 and 7.4.600. (I vaguely recall encountering something along these lines quite some time back.)
This only reproduces if there's a bogus word before the let:
fn main() {
a
let philosophers = vec![
Philosopher::new("Judith Butler"),
Philosopher::new("Gilles Deleuze"),
Philosopher::new("Karl Marx"),
Philosopher::new("Emma Goldman"),
Philosopher::new("Michel Foucault"),
];
}
So it is of less importance. Otherwise, the reindentation works fine.
Please ping if it's still relevant. Thanks!
If you select the following code block in visual mode and hit
==
(automatic indentation)It closing vec bracket is not correctly indented.