vim - How to bring up hidden windows?
阿神
阿神 2017-06-19 09:07:54
0
1
1875

vim test.html
vsplit test.css
split test.js

Three windows appear.

Move the cursor to the lower left and enter the command :hide
So there are only two windows on the left and right.

No matter how many windows there are, the test.html on the right remains unchanged. I switch like this:
1. While keeping only two windows
Use e test.css to bring up the test.css window just hidden
2. Under the three windows, use split test.css to bring up the test.css window just hidden

It doesn’t feel like the fastest way to switch.

阿神
阿神

闭关修行中......

reply all (1)
女神的闺蜜爱上我

The first way:

You can configure some VIM alias to match your usage habits

For example, you can change split to sp

nmap split sp

The second way:

The method is to configure the map key combination you are used to through mapleader

For example, mine is through shortcut keys

ff + l // 光标移到左边一个窗口 ff + h // 光标移到右边边一个窗口 ff + q // 关闭当前窗口打开的文件
call pathogen#infect() let mapleader = "ff" set nocompatible set nomodeline set viminfo='1000,f1,:1000,/1000 set history=1000 let pair_program_mode = 0 "------ Charset Init ------ scriptencoding utf-8 set encoding=utf-8 "------ Visual Options ------ syntax on set number set nowrap set vb set ruler set statusline=%<%f\ %h%m%r%=%{fugitive#statusline()}\ \ %-14.(%l,%c%V%)\ %P let g:buftabs_only_basename=1 let g:buftabs_marker_modified = "+" " Toggle whitespace visibility with ,s nmap s :set list! set listchars=tab:▸\ ,trail:·,extends:❯,precedes:❮,nbsp:× :set list " Enable by default " L = Toggle line numbers map L :set invnumber " New splits open to right and bottom set splitbelow set splitright "------ Generic Behavior ------ set tabstop=4 set shiftwidth=4 set hidden filetype indent on filetype plugin on set autoindent "allow deletion of previously entered data in insert mode set backspace=indent,eol,start " Allow saving of files as sudo when I forgot to start vim using sudo. cmap w!! %!sudo tee > /dev/null % " F2 = Paste Toggle (in insert mode, pasting indented text behavior changes) set pastetoggle= " The search for the perfect color scheme... map  x :RandomColorScheme " v = Paste map v "+gP " c = Copy map c "+y " Accidentally pressing Shift K will no longer open stupid man entry noremap K  " Edit and Reload .vimrc files nmap  ev :e $MYVIMRC nmap  es :so $MYVIMRC " When pressing cd switch to the directory of the open buffer map ,cd :cd %:p:h " Wtf is Ex Mode anyways? nnoremap Q  " Annoying window map q: :q "------ Text Navigation ------ " Prevent cursor from moving to beginning of line when switching buffers set nostartofline " Keep the cursor in place while joining lines nnoremap J mzJ`z " H = Home, L = End noremap H ^ noremap L $ vnoremap L g_ "------ Window Navigation ------ " hljk = Move between windows nnoremap h h nnoremap l l nnoremap j j nnoremap k k "= = Normalize window widths nnoremap = :wincmd = "------ Buffer Navigation ------ " Ctrl Left/h & Right/l cycle between buffers noremap   :bprev noremap   :bprev noremap   :bnext noremap   :bnext " q Closes the current buffer nnoremap  q :Bclose " Q Closes the current window nnoremap  Q c " Ctrl+q Force Closes the current buffer nnoremap   :Bclose! "------ Searching ------ set incsearch set ignorecase set smartcase set hlsearch " Clear search highlights when pressing b nnoremap  b :nohlsearch " http://www.vim.org/scripts/script.php?script_id=2572 " a will open a prmompt for a term to search for noremap a :Ack " A will close the new window created for that ack search noremap A jcl let g:ackprg="ag --vimgrep --column" " CtrlP will load from the CWD, makes it easier with all these nested repos let g:ctrlp_working_path_mode = '' " CtrlP won't show results from node_modules let g:ctrlp_custom_ignore = '\v[\/](node_modules|coverage|target|dist)|(\.(swp|ico|git|svn|png|jpg|gif|ttf))$' "type S, then type what you're looking for, a /, and what to replace it with nmap S :%s//g vmap S :s//g "------ NERDTree Options ------ let NERDTreeIgnore=['CVS','\.dSYM$', '.git', '.DS_Store', '\.swp$', '\.swo$'] "setting root dir in NT also sets VIM's cd let NERDTreeChDirMode=2 " Toggle visibility using n noremap  n :NERDTreeToggle " Focus on NERDTree using m noremap  m :NERDTreeFocus " Focus on NERDTree with the currently opened file with M noremap  M :NERDTreeFind " These prevent accidentally loading files while focused on NERDTree autocmd FileType nerdtree noremap    autocmd FileType nerdtree noremap    autocmd FileType nerdtree noremap    autocmd FileType nerdtree noremap    " Open NERDTree if we're executing vim without specifying a file to open autocmd vimenter * if !argc() | NERDTree | endif " Hides "Press ? for help" let NERDTreeMinimalUI=1 " Shows invisibles let g:NERDTreeShowHidden=1 "------ Fugitive Plugin Options ------ "https://github.com/tpope/vim-fugitive nnoremap gs :Gstatus nnoremap gr :Gremove nnoremap gl :Glog nnoremap gb :Gblame nnoremap gm :Gmove nnoremap gp :Ggrep nnoremap gR :Gread nnoremap gg :Git nnoremap gd :Gdiff "------ Text Editing Utilities ------ " T = Delete all Trailing space in file map T :%s/\s\+$// " U = Deletes Unwanted empty lines map U :g/^$/d " R = Converts tabs to spaces in document map R :retab "------ JSON Filetype Settings ------ au BufRead,BufNewFile *.json set filetype=json let g:vim_json_syntax_conceal = 0 nmap  =j :%!python -m json.tool:setfiletype json autocmd BufNewFile,BufRead *.webapp set filetype=json autocmd BufNewFile,BufRead *.jshintrc set filetype=json autocmd BufNewFile,BufRead *.eslintrc set filetype=json "------ CoffeeScript Filetype Settings ------ au BufNewFile,BufReadPost *.coffee set shiftwidth=2 softtabstop=2 expandtab autocmd BufNewFile,BufRead *.coffee set filetype=coffee au BufWritePost *.coffee silent make! autocmd QuickFixCmdPost * nested cwindow | redraw! "------ JSX Filetype Settings ------ autocmd! BufEnter *.jsx let b:syntastic_checkers=['eslint'] autocmd! BufEnter *.js let b:syntastic_checkers=['eslint'] "------ EJS Filetype Settings ------ au BufNewFile,BufRead *.ejs set filetype=html "------ SCSS Filetype Settings ------ autocmd FileType scss set iskeyword+=- "------ Markdown Settings ------ let g:vim_markdown_folding_disabled = 1 "------ Airline Settings ------ let g:airline_left_sep='' let g:airline_right_sep='' let g:airline#extensions#tabline#enabled = 1 let g:airline#extensions#tabline#left_sep = ' ' let g:airline#extensions#tabline#left_alt_sep = ' ' "------ GUI Options ------ if has("gui_running") " Hides toolbar and scrollbars and File menu set guioptions=egt " Highlights the current line background set cursorline colorscheme hybrid "autocmd VimEnter * TagbarOpen " Open VIM in fullscreen window set lines=200 columns=500 " Toggle fullscreen map  w :set lines=200 columns=500 " Build all help tags (slower launch, but I run GUI vim like once per day) call pathogen#helptags() silent! cd $HOME/Projects if has("gui_macvim") " OS X "set guifont=Monaco:h14 set guifont=Monaco:h10 set noantialias "set transparency=15 " Swipe to move between bufers :D map   :bprev map   :bnext " Cmd+Shift+N = new buffer map   :enew " Cmd+P = CtrlP " TODO: This doesn't actually work, still opens Print dialog macmenu File.Print key= nnoremap   :CtrlP " Cmd+t = new tab nnoremap   :tabnew " Cmd+w = close tab (this should happen by default) nnoremap   :tabclose " Cmd+1...9 = go to that tab map   1gt map   2gt map   3gt map   4gt map   5gt map   6gt map   7gt map   8gt map   9gt " OS X probably has ctags in a weird place let g:tagbar_ctags_bin='/usr/local/bin/ctags' " Damn you scrollwheel paste nnoremap   nnoremap <2-MiddleMouse>  nnoremap <3-MiddleMouse>  nnoremap <4-MiddleMouse>  inoremap   inoremap <2-MiddleMouse>  inoremap <3-MiddleMouse>  inoremap <4-MiddleMouse>  " Pair Program mode, so that my coworkers can read my screen ;) nnoremap p :call PairProgramMode() function! PairProgramMode() if g:pair_program_mode let g:pair_program_mode = 0 set guifont=Monaco:h10 set noantialias set lines=200 columns=500 else set guifont=Monaco:h15 set antialias set lines=200 columns=500 let g:pair_program_mode = 1 endif endfunction elseif has("gui_gtk2") " Linux set guifont=monospace\ 9 " Alt+n = new buffer map   :enew " Alt+t = new tab nnoremap   :tabnew " Alt+w = close tab nnoremap   :tabclose " Alt+1...9 = go to that tab map   1gt map   2gt map   3gt map   4gt map   5gt map   6gt map   7gt map   8gt map   9gt elseif has("gui_win32") " Windows " WHAT ARE YOU DOING WITH YOUR LIFE?! endif else set t_Co=256 colorscheme Mustang set mouse=a endif "------ Local Overrides ------ if filereadable($HOME.'/.vimrc_local') source $HOME/.vimrc_local endif
    Latest Downloads
    More>
    Web Effects
    Website Source Code
    Website Materials
    Front End Template
    About us Disclaimer Sitemap
    php.cn:Public welfare online PHP training,Help PHP learners grow quickly!