junegunn / fzf.vim

fzf :heart: vim
MIT License
9.68k stars 585 forks source link

Ignore mapping in fzf #683

Open ghost opened 6 years ago

ghost commented 6 years ago

I'm mapped ESC to get Normal mode inside Neovim's terminal emulator but while i'm trying to out of fzf with ESC it get's Normal mode too. How to ignore all terminal mappings in fzf window?

I'm suggesting to ignore mappings by default too.

My Mappings

"" Mappings
  nmap ğ [
  nmap ü ]
  noremap y "+y
  noremap p "+]p
  noremap P "+]P
  map g/ <Plug>(incsearch-stay)
  map /  <Plug>(incsearch-forward)
  map ?  <Plug>(incsearch-backward)

" Normal Mappings
  nnoremap gV `[v`]
  nnoremap S i<CR><ESC>
  nnoremap ; :Files<CR>
  nnoremap ` :Lines<CR>
  nnoremap <C-K> <C-W><C-K>
  nnoremap <C-L> <C-W><C-L>
  nnoremap <C-H> <C-W><C-H>
  nnoremap <C-J> <C-W><C-J>
  nnoremap <A-j> :m .+1<CR>==
  nnoremap <A-k> :m .-2<CR>==
  nnoremap ga <Plug>(EasyAlign)
  nnoremap <leader>c :Codi!!<CR>
  nnoremap <leader>d :Dirvish<CR>
  nnoremap <leader>s :Scratch<CR>
  nnoremap <leader>f :TagbarToggle
  nnoremap <leader>r :RainbowToggle<CR>
  nnoremap <leader>bq :bp <BAR> bd #<CR>
  nnoremap <leader>e :call ToggleIE()<CR>
  nnoremap <silent> <leader> :<c-u>LeaderGuide '<Space>'<CR>
  nnoremap <silent> <leader>+ :exe "resize " . (winheight(0) * 3/2)<CR>
  nnoremap <silent> <leader>- :exe "resize " . (winheight(0) * 2/3)<CR>
  nnoremap <leader>t :terminal<CR>
" Visual Mappings
  xmap ga <Plug>(EasyAlign)

  vnoremap <Tab> >gv$
  vnoremap <S-Tab> <gv$
  vnoremap <silent> <leader> :<c-u>LeaderGuideVisual '<Space>'<CR><Paste>

" Insert Mappings
  imap <C-v> <C-r><C-o>+
    imap <expr> <down> mucomplete#extend_fwd("\<down>")

" Terminal Mappings
  tnoremap <Esc> <c-\><c-n>
ghost commented 6 years ago

I've solved the problem with code piece

    autocmd  FileType fzf tnoremap <Esc> <C-c>
      \| autocmd BufLeave <buffer> tnoremap <Esc> <C-\><C-n>

But it can be buggy sometimes. Maybe add it to code?