voldikss / vim-floaterm

:computer: Terminal manager for (neo)vim
MIT License
2.5k stars 79 forks source link

This plugin leaves an empty buffer/window on startify window #82

Closed MaiLunJiye closed 4 years ago

MaiLunJiye commented 4 years ago

如果直接输入 nvim,不打开任何文件 。 这时候如果开启一个终端,然后退出。 则 浮动窗口不会自动关闭,而是会一直在前面遮挡。

浮动窗口遮挡后面的窗口可以正常操作,但是浮动窗口会一直遮挡在前面。

目前唯一解决的办法就是退出重启 neovim

图片

系统环境

Linux archlinux 5.6.3-arch1-1 #1 SMP PREEMPT Wed, 08 Apr 2020 07:47:16 +0000 x86_64 GNU/Linux

vim-floaterm 配置:

let g:floaterm_keymap_new    = '<F7>'
let g:floaterm_keymap_toggle = '<F8>'
let g:floaterm_keymap_prev   = '<F9>'
let g:floaterm_keymap_next   = '<F10>'

let g:floaterm_width=0.8
let g:floaterm_height=0.8
let g:floaterm_position = 'center'

" lazygit 整合
nnoremap <leader>lg :<C-u>FloatermNew lazygit<CR>

使用的其他插件:

Plug 'mhinz/vim-startify'                                      " 启动界面
Plug 'jiangmiao/auto-pairs'                                    " 快速括号引号优化输入
Plug 'honza/vim-snippets'                                      " 别人的UltiSnips模板
Plug 'nathanaelkane/vim-indent-guides'                         " 缩进着色
Plug 'scrooloose/nerdcommenter'                                " 注释
Plug 'tpope/vim-surround'                                      " 快速更改括号,引号
Plug 'tpope/vim-repeat'                                        " 快速更改括号,引号,重复操作扩展
Plug 'w0rp/ale'                                                " 异步代码检测,支持多语言
Plug 'easymotion/vim-easymotion'                               " vim 快速移动
Plug 'pseewald/vim-anyfold'                                    " 折叠优化
Plug 'andymass/matchup.vim'                                    " 成对元素强化() if/endif
Plug 'SirVer/ultisnips'                                        " 预定义代码片段
Plug 'itchyny/lightline.vim'                                    " 彩色状态栏
Plug 'lilydjwg/fcitx.vim'                                    " 输入法切换
Plug 'rafi/awesome-vim-colorschemes'                                    " 配色
Plug 'ryanoasis/vim-devicons'                                   " 图标包
Plug 'junegunn/fzf.vim'                                        " 快速查找工具

nvim 环境:

NVIM v0.4.3
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -O2 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=always -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/build/neovim/src/build/config -I/build/neovim/src/neovim-0.4.3/src -I/usr/include -I/build/neovim/src/build/src/nvim/auto -I/build/neovim/src/build/include
编译者 builduser

Features: +acl +iconv +tui
See ":help feature-compile"

     系统 vimrc 文件: "$VIM/sysinit.vim"
         $VIM 预设值: "/usr/share/nvim"

Run :checkhealth for more info
health#floaterm#check
========================================================================
  - OK: Terminal feature is OK
  - OK: Floating window feature is OK
  - OK: nvr is OK

health#coc#check
========================================================================
  - OK: Environment check passed

  - OK: Javascript bundle found
  - OK: Service started

health#nvim#check
========================================================================
## Configuration
  - OK: no issues found

## Performance
  - OK: Build type: Release

## Remote Plugins
  - OK: Up to date

## terminal
  - INFO: key_backspace (kbs) terminfo entry: key_backspace=^H
  - INFO: key_dc (kdch1) terminfo entry: key_dc=\E[3~
  - INFO: $COLORTERM='truecolor'

health#provider#check
========================================================================
## Clipboard (optional)
  - OK: Clipboard tool found: xclip

## Python 2 provider (optional)
  - WARNING: No Python executable found that can `import neovim`. Using the first available executable for diagnostics.
  - ERROR: Python provider error:
    - ADVICE:
      - provider/pythonx: Could not load Python 2:
          python2 not found in search path or not executable.
          python2.7 not found in search path or not executable.
          python2.6 not found in search path or not executable.
          /usr/bin/python is Python 3.8 and cannot provide Python 2.
  - INFO: Executable: Not found

## Python 3 provider (optional)
  - INFO: `g:python3_host_prog` is not set.  Searching for python3 in the environment.
  - INFO: Executable: /usr/bin/python3
  - INFO: Python version: 3.8.2
  - INFO: pynvim version: 0.4.1
  - OK: Latest pynvim is installed.

## Ruby provider (optional)
  - INFO: Ruby: ruby 2.7.1p83 (2020-03-31 revision a0c7c23c9c) [x86_64-linux]
  - WARNING: `neovim-ruby-host` not found.
    - ADVICE:
      - Run `gem install neovim` to ensure the neovim RubyGem is installed.
      - Run `gem environment` to ensure the gem bin directory is in $PATH.
      - If you are using rvm/rbenv/chruby, try "rehashing".
      - See :help |g:ruby_host_prog| for non-standard gem installations.

## Node.js provider (optional)
  - INFO: Node.js: v13.12.0
  - WARNING: Missing "neovim" npm (or yarn) package.
    - ADVICE:
      - Run in shell: npm install -g neovim
      - Run in shell (if you use yarn): yarn global add neovim
voldikss commented 4 years ago

浮动窗口遮挡后面的窗口可以正常操作,但是浮动窗口会一直遮挡在前面。 目前唯一解决的办法就是退出重启 neovim

在其他窗口执行 <C-w>o 可以关闭这个遮挡着的窗口

voldikss commented 4 years ago

Hi, @MaiLunJiye

Could you please help debug this issue?

MaiLunJiye commented 4 years ago

图片

@function floaterm#new[1]
[]

@function floaterm#new[10]..floaterm#cmdline#parse_new[1]
[]

@function floaterm#new[10]..floaterm#cmdline#parse_new[21]
['', {'wintype': 'floating', 'width': 108, 'height': 30, 'pos': 'center'}]

@function floaterm#new[28]..floaterm#terminal#open[1]
[-1, '/usr/bin/zsh', {}, {'wintype': 'floating', 'width': 108, 'height': 30, 'pos': 'center'}]

@function floaterm#new[28]..floaterm#terminal#open[28]..floaterm#window#nvim_open_win[1]
[2, 108, 30, 'center']

@function floaterm#new[28]..floaterm#terminal#open[28]..floaterm#window#nvim_open_win[15]..<SNR>88_add_border[1]
1002

@function floaterm#new[28]..floaterm#terminal#open[28]..floaterm#window#nvim_open_win[15]..<SNR>88_add_border[17]..floaterm#buffer#create[6]
3

@function floaterm#new[28]..floaterm#terminal#open[28]..floaterm#window#nvim_open_win[15]..<SNR>88_add_border[33]
1003

@function floaterm#new[28]..floaterm#terminal#open[61]..<SNR>87_on_floaterm_open[1]
2

@function floaterm#new[30]..floaterm#buflist#add[4]
[-(-1)--(2)-] current index: 2

@function <SNR>87_on_floaterm_close[1]
2

@function <SNR>87_on_floaterm_close[6]..floaterm#window#hide_border[1]
2
voldikss commented 4 years ago

Thanks @MaiLunJiye .

Seems some thing wrong with this function

https://github.com/voldikss/vim-floaterm/blob/3b2a13afe9ebab01a72049e4968a8ff38a0a971e/autoload/floaterm/terminal.vim#L35-L43

I've updated code of branch debug-feature, could you try and post the log again?

P.S. I'd appreciate it if you could also provide a gif

MaiLunJiye commented 4 years ago

ft


@function floaterm#new[1]
[]

@function floaterm#new[10]..floaterm#cmdline#parse_new[1]
[]

@function floaterm#new[10]..floaterm#cmdline#parse_new[21]
['', {'wintype': 'floating', 'width': 64, 'height': 16, 'pos': 'center'}]

@function floaterm#new[28]..floaterm#terminal#open[1]
[-1, '/usr/bin/zsh', {}, {'wintype': 'floating', 'width': 64, 'height': 16, 'pos': 'center'}]

@function floaterm#new[28]..floaterm#terminal#open[28]..floaterm#window#nvim_open_win[1]
[2, 64, 16, 'center']

@function floaterm#new[28]..floaterm#terminal#open[28]..floaterm#window#nvim_open_win[15]..<SNR>88_add_border[1]
1002

@function floaterm#new[28]..floaterm#terminal#open[28]..floaterm#window#nvim_open_win[15]..<SNR>88_add_border[17]..floaterm#buffer#create[6]
3

@function floaterm#new[28]..floaterm#terminal#open[28]..floaterm#window#nvim_open_win[15]..<SNR>88_add_border[33]
1003

@function floaterm#new[28]..floaterm#terminal#open[61]..<SNR>87_on_floaterm_open[1]
2

@function floaterm#new[30]..floaterm#buflist#add[4]
[-(-1)--(2)-] current index: 2

@function <SNR>87_on_floaterm_close[5]
2

@function <SNR>87_on_floaterm_close[7]..floaterm#window#hide_border[3]
2
voldikss commented 4 years ago

@MaiLunJiye Could you show your full vimrc(i.e., provide as a gist link)

MaiLunJiye commented 4 years ago

@MaiLunJiye Could you show your full vimrc(i.e., provide as a gist link)

https://gist.github.com/MaiLunJiye/98a690ef781ba3c8acf52c91ee20c18e

voldikss commented 4 years ago

Ah, figured it out finally. It's caused by cross-plugin conflict, which I should have noticed at first.

So the solution, according to the Q&A, is to put this code in your vimrc

autocmd User Startified setlocal buflisted

Hi @MaiLunJiye would you mind testing it again? If the issue gets fixed, I'll closed this issue.

MaiLunJiye commented 4 years ago

Thanks, it works. I'm sorry, i should check the Q&A first.

voldikss commented 4 years ago

Nerver mind, the Q&A should be more detailed, I'll update soon.