我正在尝试缩进以在C#文件中工作的空格,但我无法使其正常工作。
这是我的〜/ .vim / ftplugin / cs.vim的相关部分:
" Indent with 4 spaces
set expandtab
set shiftwidth=4
set softtabstop=4
我尝试将其放在〜/ .vim / indent / cs.vim,〜/ .vim / after / ftplugin / cs.vim,
我尝试使用setlocal而不是两者,并且filetype plugin indent
已启用。
我尝试过使用autocmd FileType cs setlocal shiftwidth=4 softtabstop=4 expandtab
。
我还尝试在.vimrc中移动选项卡配置。
当我更改.vimrc中的配置时,它也适用于其他文件,但是即使我从〜/ .vim / ftplugin / cs.vim中删除选项卡配置,它在C#文件中仍然不起作用。
这是我的.vimrc
" Plugins
call plug#begin('~/.vim/plugged')
Plug 'scrooloose/nerdtree'
Plug 'Xuyuanp/nerdtree-git-plugin'
Plug 'tomtom/tcomment_vim'
Plug 'wincent/Command-T', { 'do': 'cd ruby/command-t/ext/command-t && ruby extconf.rb && make' }
Plug 'Valloric/YouCompleteMe', { 'do': 'python install.py --cs-completer --clang-completer --java-completer' }
Plug 'milkypostman/vim-togglelist'
Plug 'vimwiki/vimwiki'
Plug 'jreybert/vimagit'
call plug#end()
" Don't highlight on search
set nohlsearch
" Search while typing
set incsearch
" Disable mouse navigation
set mouse=""
" Set nocompatible vi mode
set nocompatible
" Set unix fileformat
set fileformat=unix
" Automatically change dir to current file
set autochdir
" Hide buffers when abandoned
set hidden
" Backspace through everythin
set backspace=indent,eol,start
" Filetype plugin on and indent by filetype
filetype plugin on
filetype plugin indent on
" Syntax highlighting
syntax on
" Set autoindent
set autoindent
" Indent with mixed tabs and spaces
set shiftwidth=8
set softtabstop=8
" Colorscheme
colorscheme monokai
highlight Normal ctermbg=None
highlight LineNr ctermbg=None
highlight NonText ctermbg=None
highlight CursorLineNR ctermfg=None ctermbg=None
" Folding
set foldmethod=syntax
" Remember folds
autocmd BufWinLeave *.* mkview
autocmd BufWinEnter *.* silent loadview
" Encoding
set encoding=utf-8
" Show relative line numbers and the current line number
set number relativenumber
" Always show status line
set laststatus=2
" Always show at least two fiveline above and below the cursor
set scrolloff=2
" Always show at least five columns right and left of the cursor
set sidescrolloff=5
" Show a ruler at 80 characters and at 120+ characters
let &colorcolumn="80,".join(range(120,999),",")
highlight ColorColumn ctermbg=235
" Vim autocomplete
set wildmode=list:longest
" Set display to show as much as possible of a long last line
set display=lastline
" Disable automatic comment insertion
autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o
" Remove trailing whitespace on write
autocmd BufWritePre * %s/\s\+$//e
" Split to the right and below
set splitright splitbelow
" Set shell
set shell=/usr/bin/env\ bash
" Automatically read file if the file was changed in the background
set autoread
" Max lines in history
set history=1000
" Max number of tab pages
set tabpagemax=50
" Set default tex flavor to latex
let g:tex_flavor = "latex"
" Set <leader> and <localleader>
let mapleader="\\"
let maplocalleader="\\"
" Save as sudo command
command SW :w !sudo tee %
" Bind :Q to :q
command Q :q
" Open bash
map <C-t> :sh<CR>
" Copy to clipboard shortcut
nnoremap <C-c> "+y
" Map fuzzy file finder to CTRL+P
map <C-p> \t
" Spell check
nnoremap <localleader>o :set spell! spelllang=en_us,hr_hr<CR>
" Shortcuts for split navigation
nnoremap <C-J> <C-W><C-J>
nnoremap <C-K> <C-W><C-K>
nnoremap <C-L> <C-W><C-L>
nnoremap <C-H> <C-W><C-H>
" Nerdtree toggle shortcut
map <C-n> :NERDTreeToggle<CR>
" Vimagit shortcut
map <C-g> :Magit<CR>
" Provide a default YCM file to YouCompleteMe
let g:ycm_global_ycm_extra_conf = "~/.vim/.ycm_extra_conf.py"
" Options for YouCompleteMe syntax checking
let g:ycm_show_diagnostics_ui = 1
let g:ycm_enable_diagnostic_signs = 0
let g:ycm_enable_diagnostic_highlighting = 1
let g:ycm_always_populate_location_list = 1
let g:ycm_open_loclist_on_ycm_diags = 1
" Vimwiki options
let g:vimwiki_autowriteall = 0
我不确定问题出在哪里,还是要尝试什么。
有人有建议吗?
答案 0 :(得分:1)
我回答了我自己的问题。
我使用:verbose set shiftwidth
来查看变量的最后设置位置,事实证明,这是我的观点。
从~/.vim/views/
删除每个视图后,更改设置即可。