我知道关闭缓冲区是:bd
,但有时我打开很多文件(NERDTree 或ctrl+p
)并使用此命令,然后退出我的 vim。但有时我使用:q
,它只是关闭我的缓冲区。我不知道为什么?我有点困惑。
我猜问题是.vimrc
,对吗?
我的.vimrc
" Note: Skip initialization for vim-tiny or vim-small.
if 0 | endif
if has('vim_starting')
if &compatible
set nocompatible " Be iMproved
endif
" Required:
set runtimepath+=~/.vim/bundle/neobundle.vim/
endif
" Required:
call neobundle#begin(expand('~/.vim/bundle/'))
" Let NeoBundle manage NeoBundle
" Required:
NeoBundleFetch 'Shougo/neobundle.vim'
" My Bundles here:
" Refer to |:NeoBundle-examples|.
" Note: You don't set neobundle setting in .gvimrc!
" plugin
NeoBundle 'scrooloose/nerdtree'
NeoBundle 'jistr/vim-nerdtree-tabs'
NeoBundle 'kien/ctrlp.vim'
NeoBundle 'bling/vim-airline'
NeoBundle 'Lokaltog/vim-powerline'
NeoBundle 'altercation/vim-colors-solarized'
NeoBundle 'Yggdroot/indentLine' " Line
NeoBundle 'tpope/vim-surround'
NeoBundle 'taglist.vim'
NeoBundle 'shawncplus/phpcomplete.vim'
NeoBundle 'Valloric/YouCompleteMe'
NeoBundle 'airblade/vim-gitgutter'
NeoBundle 'tpope/vim-surround'
NeoBundle 'tpope/vim-rails'
NeoBundle 'easymotion/vim-easymotion'
NeoBundle 'mattn/emmet-vim'
NeoBundle 'terryma/vim-multiple-cursors'
NeoBundle 'haya14busa/incsearch.vim'
NeoBundle 'jiangmiao/auto-pairs'
NeoBundle 'breuckelen/vim-resize'
NeoBundle 'justincampbell/vim-eighties'
NeoBundle 'dkprice/vim-easygrep'
" fix powerline arrow
let g:airline_powerline_fonts = 1
let g:Powerline_symbols = 'fancy'
" airline setting
let g:airline#extensions#tabline#enabled = 1
set laststatus=2
" set left separator
let g:airline#extensions#tabline#left_sep = ' '
" set left separator which are not editting
let g:airline#extensions#tabline#left_alt_sep = '|'
" show buffer number
let g:airline#extensions#tabline#buffer_nr_show = 1
" theme
se t_Co=16
let g:solarized_termcolors=256
syntax enable
set background=dark
colorscheme solarized
" line
let g:indentLine_color_term = 239
" none X terminal
let g:indentLine_color_tty_light = 7 " (default: 4)
let g:indentLine_color_dark = 1 " (default: 2)
set number
set relativenumber
:hi LineNr cterm=bold ctermfg=White ctermbg=LightGreen
set ai
set cursorline
set cursorcolumn
set enc=utf8
set expandtab
set tabstop=4
set shiftwidth=4
" NERDTree map
map <leader>kb :NERDTreeToggle<CR>
let NERDTreeWinPos="left"
" Taglist
map <f9> :Tlist<CR>
let Tlist_Use_Right_Window = 1
let Tlist_Exit_OnlyWindow = 1
set cursorline
highlight CursorLine cterm=underline ctermfg=NONE ctermbg=NONE
" backspace
set backspace=2
if exists('$TMUX')
let &t_SI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=1\x7\<Esc>\\"
let &t_EI = "\<Esc>Ptmux;\<Esc>\<Esc>]50;CursorShape=0\x7\<Esc>\\"
else
let &t_SI = "\<Esc>]50;CursorShape=1\x7"
let &t_EI = "\<Esc>]50;CursorShape=0\x7"
endif
set autoindent
" vim-multiple-cursors
let g:multi_cursor_next_key='<C-d>'
let g:multi_cursor_prev_key='<C-p>'
let g:multi_cursor_skip_key='<C-x>'
let g:multi_cursor_quit_key='<Esc>'
" ------ star -----
let mapleader = "\\"
:nnoremap <leader>ev :vsplit $MYVIMRC<cr>
:nnoremap <leader>sv :source $MYVIMRC<cr>
" Ctrl + l visual line
:nnoremap <c-l> V<CR>
:inoremap <c-l> <c-c>V<CR>
:inoremap <c-d> <c-c>ddi
:nnoremap <leader>" viw<esc>a"<esc>hbi"<esc>lel
:nnoremap <leader>' viw<esc>a'<esc>hbi'<esc>lel
:inoremap jk <c-c>
:nnoremap <leader>d bve
:inoremap <leader>d <c-c>bve
:nnoremap <leader>w :w<CR>:echo "saved"<CR>
:inoremap <leader>w <c-c>:wi<CR>
:nnoremap <leader>wq :wq<CR>:echo "saved"<CR>
:inoremap <leader>wq <c-c>:wq<CR>
" Tab
:nnoremap <leader>n :bnext<CR>
:nnoremap <leader>p :bprevious<CR>
:nnoremap <leader>bd :bdelete<CR>
" page down
:nnoremap <leader>f <c-f>
" page up
:nnoremap <leader>b <c-b>
autocmd BufWritePre * :%s/\s\+$//e
set hlsearch
:nnoremap <leader>] <c-]>
:nnoremap <leader>t <c-t>
" emmet
let g:user_emmet_mode='a'
set mouse=nicr
" copy to clipboard
map <leader>c "*y<CR>
" ------ end -------
call neobundle#end()
" Required:
filetype plugin indent on
" If there are uninstalled bundles found on startup,
" this will conveniently prompt you to install them.
NeoBundleCheck
答案1
该:q
命令不会关闭缓冲区,而是关闭当前窗口。如果您有多个窗口(包括选项卡),它不会退出 Vim。如果您确实想退出 Vim,请使用:qa
。请参阅:
:help :quit
:help :qall