
vimでインデントを揃えるをすると、
1.開始行で Shift + v
2.範囲を指定
3.=を入力
全部が左端によってしまいます。
.vimrcに何かまずい設定を書いているのでしょうか?
↓vimrcの内容です
vim
1set background=dark 2colorscheme solarized 3let g:solarized_termcolors=256 4 5" Note: Skip initialization for vim-tiny or vim-small. 6if 0 | endif 7 8if has('vim_starting') 9 if &compatible 10 set nocompatible " Be iMproved 11 endif 12 13 " Required: 14 set runtimepath+=~/.vim/bundle/neobundle.vim/ 15endif 16 17" Required: 18call neobundle#begin(expand('~/.vim/bundle/')) 19 20" Let NeoBundle manage NeoBundle 21" Required: 22NeoBundleFetch 'Shougo/neobundle.vim' 23 24" My Bundles here: 25" Refer to |:NeoBundle-examples|. 26" Note: You don't set neobundle setting in .gvimrc! 27 28call neobundle#end() 29 30" Required: 31" filetype plugin indent on 32 33" If there are uninstalled bundles found on startup, 34" this will conveniently prompt you to install them. 35NeoBundleCheck 36 37if has('vim_starting') 38 set nocompatible " Be iMproved 39 40 " Required: 41 set runtimepath+=~/.vim/bundle/neobundle.vim/ 42endif 43 44" Required: 45call neobundle#begin(expand('~/.vim/bundle/')) 46 47" Let NeoBundle manage NeoBundle 48" Required: 49NeoBundleFetch 'Shougo/neobundle.vim' 50 51" My Bundles here: 52NeoBundle 'Shougo/neosnippet.vim' 53NeoBundle 'Shougo/neosnippet-snippets' 54NeoBundle 'tpope/vim-fugitive' 55NeoBundle 'kien/ctrlp.vim' 56NeoBundle 'flazz/vim-colorschemes' 57 58 59" You can specify revision/branch/tag. 60NeoBundle 'Shougo/vimshell', { 'rev' : '3787e5' } 61 62call neobundle#end() 63 64" If there are uninstalled bundles found on startup, 65" this will conveniently prompt you to install them. 66NeoBundleCheck 67 68 69NeoBundle 'scrooloose/nerdtree' 70 71 72" 隠しファイルをデフォルトで表示させる 73let NERDTreeShowHidden = 1 74 75" デフォルトでツリーを表示させる 76autocmd VimEnter * execute 'NERDTree' 77 78" Gitを便利に使う 79NeoBundle 'tpope/vim-fugitive' 80 81" grep検索の実行後にQuickFix Listを表示する 82autocmd QuickFixCmdPost *grep* cwindow 83 84" ステータス行に現在のgitブランチを表示する 85"set statusline+=%{fugitive#statusline()} 86 87" Ruby向けにendを自動挿入してくれる 88NeoBundle 'tpope/vim-endwise' 89 90" コメントON/OFFを手軽に実行 91NeoBundle 'tomtom/tcomment_vim' 92 93" インデントの可視化 94NeoBundle 'nathanaelkane/vim-indent-guides' 95let g:indent_guides_enable_on_vim_startup=1 96let g:indent_guides_start_level=2 97let g:indent_guides_auto_colors=0 98autocmd VimEnter,Colorscheme * :hi IndentGuidesOdd ctermbg=235 99autocmd VimEnter,Colorscheme * :hi IndentGuidesEven ctermbg=234 100let g:indent_guides_color_change_percent = 30 101let g:indent_guides_guide_size = 2 102 103 104 105" 行番号を表示 106set nu 107 108" スワップファイルを作らない 109set noswapfile 110 111" 画面最下行にルーラーを表示する 112set ruler 113 114" ステータスラインを常に表示する 115set laststatus=2 116 117" ビープの代わりにビジュアルベル(画面フラッシュ)を使う 118set visualbell 119 120" そしてビジュアルベルも無効化する 121set t_vb= 122 123" 全モードでマウスを有効化 124set mouse=a 125 126" コマンドラインの高さを2行に 127set cmdheight=2 128 129 130"------------------------------------------------------------ 131" インデント関連のオプション {{{1 132" 133" タブ文字の代わりにスペース2個を使う場合の設定。 134" この場合、'tabstop'はデフォルトの8から変えない。 135set shiftwidth=2 136set softtabstop=2 137set expandtab 138 139" オートインデントをしない 140set noautoindent 141 142autocmd FileType * setlocal formatoptions-=ro 143 144set paste 145 146syntax enable 147syntax on 148 149set hlsearch 150 151 152 153 154"タブ、空白、改行の可視化 155set list 156set listchars=tab:>.,trail:_,eol:↲,extends:>,precedes:<,nbsp:% 157 158"全角スペースをハイライト表示 159function! ZenkakuSpace() 160 highlight ZenkakuSpace cterm=reverse ctermfg=DarkMagenta gui=reverse guifg=DarkMagenta 161endfunction 162 163if has('syntax') 164 augroup ZenkakuSpace 165 autocmd! 166 autocmd ColorScheme * call ZenkakuSpace() 167 autocmd VimEnter,WinEnter * match ZenkakuSpace / / 168 augroup END 169 call ZenkakuSpace() 170endif

vimrcは公開できますか?設定を見せていただけると回答しやすくなります。
貼り付けました。コピペをいろいろ継ぎ接ぎしたので、おかしくなってるかもです。すいません。。

上記vimrcを開いている際に選択範囲をインデントしても全て左端によりますか?
特にifからend ifの間とか。
返信遅れましてすいません。
上記vimrcで選択範囲を指定してインデントしても左端によってしまいます。。

どんなファイルを開いてもファイルタイプが設定されていない状態でしょうか?

コマンドラインで":filetype"を実行すると下記の表示が出ますか?
"filetype detection:OFF plugin:(on) indent:(on)"
> filetype detection:ON plugin:OFF indent:OFF
そうです、それが出ました。

コマンドラインで"filetype plugin indent on"を実行したあとに、"filetype"を実行すると下記に表示が変わりますか?"filetype detection:ON plugin:ON indent:ON"
はい、変わりました

その状態でインデントしたいファイルを開いて選択範囲をインデントしても左端によりますか?
すでにファイルを開いているのなら一度コマンドラインで":bdelete"を実行してバッファから取り除いてから再びファイルを開いてインデントしてみてください。
"filetype detection:ON plugin:ON indent:ON"の状態で、
:bdelete"を実行してバッファから取り除いてから再びファイルを開いて、
選択範囲をインデントしても全部左端に寄りました。。

いま、"filetype"を実行するとどんな表示が出ますか?
`filetype detection:ON plugin:ON indent:ON`
がでますね。

コマンドラインで":set"を実行するとどんな表示が出ますか?下記のようなものが出ますか?
--- Options ---
autoindent buftype=nofile confirm filetype=html hidden nomodified shiftwidth=4 noswapfile ttyfast
background=dark cinoptions=j1,J1 cursorline helpheight=1000 ignorecase number smartcase syntax=html ttymouse=xterm2
nobuflisted clipboard=unnamed expandtab helplang=en laststatus=2 scroll=24 statusline=%f%y tabstop=4 wildmenu
backspace=indent,eol,start
comments=s:<!--,m: ,e:-->
commentstring=<!--%s-->
fileencodings=ucs-bom,utf-8,default,latin1
indentexpr=HtmlIndent()
indentkeys=o,O,<Return>,<>>,{,},!^F
matchpairs=(:),{:},[:],<:>
omnifunc=htmlcomplete#CompleteTags
runtimepath=~/.vim,~/.vim/bundle/vim-surround/,~/.vim/bundle/clever-f.vim/,~/.vim/bundle/vim-smartchr/,~/.vim/bundle/ag.vim/,~/.vim/bundle/vim-clang/,~/.vim/bundle/vim-hybrid/,~/.
vim/bundle/neosnippet/,~/.vim/bundle/neosnippet-snippets/,~/.vim/bundle/neomru.vim/,~/.vim/bundle/unite.vim/,~/.vim/bundle/neocomplete.vim/,~/.vim/bundle/neoyank.vim/,~/.vim/bundle/
vimproc/,~/.vim/bundle/.neobundle,/usr/local/share/vim/vimfiles,/usr/local/share/vim/vim74,/usr/local/share/vim/vimfiles/after,~/.vim/after,~/.vim/bundle/neobundle.vim/
wildmode=list:full
:setをすると、↓になりました。
https://dl.dropboxusercontent.com/u/645073/s.png

コマンドラインで"set filetype=html"を実行したあとにインデントをしても全て左端によりますか?
"set filetype=html"を実行するといけましたー!!!
vimrcでset filetype=htmlを予めして書いておけばよいのでしょうか?

vimrcに書くとvimを開いた時にコマンドラインで
"set filetype=html"を実行したことになるので最初の空バッファがfiletype=htmlになり、
新たにhtmlを開いた時には適用されないです。
新たに開いたhtmlに適用する場合はautocmdを利用するのが一番簡単だと思います。
例えば"autocmd BufRead *.html setfiletype html"みたいなものです。
ですがautocmdを利用する際には必ずgroupを設定してください。
不具合が起きやすいです。

回答3件
あなたの回答
tips
プレビュー