vim-win32-installer icon indicating copy to clipboard operation
vim-win32-installer copied to clipboard

Unexpected behavior with vim margin when open NerdTree in maximum terminal.

Open hungpham3112 opened this issue 3 years ago • 6 comments

Steps to reproduce

  1. Download my vimrc config in here. I already have 1 installer command so you just need to paste in Powershell > 5.0. If something happens in installation time, press <Enter> and restart.
  2. Open vim in terminal, <space>e to open NerdTreeToggle
  3. This unexpected behavior appears in cmd.exe, powershell terminal, window powershell` in maximum size, in normal size it doesn't appear. The margin of vim seems unfit with maximum terminal. I tested my config with neovim but it only happens with vim.

cmd.exe:

https://user-images.githubusercontent.com/75968004/160745013-ca4a18a3-7c43-4333-833e-ecd9d6d66a3a.mp4

window powershell:

https://user-images.githubusercontent.com/75968004/160745017-6dd9a232-a452-485e-a51f-dcbb5242a6fe.mp4

Expected behaviour

Vim can fit with maximum terminal.

Version of Vim

8.2.4643. Latest vim-nightly using scoop.

Environment

Window 11(64 bits).

hungpham3112 avatar Mar 30 '22 03:03 hungpham3112

This unexpected behavior appears in cmd.exe, powershell terminal, window powershell` in maximum size, in normal size it doesn't appear. The margin of vim seems unfit with maximum terminal. I tested my config with neovim but it only happens with vim.

What margin? I don't see it in your videos

Also, if you want to report a bug in Vim, please:

  1. provide a minimal vimrc to reproduce the bug
  2. report it against vim/vim repository

chrisbra avatar Mar 30 '22 08:03 chrisbra

This unexpected behavior appears in cmd.exe, powershell terminal, window powershell` in maximum size, in normal size it doesn't appear. The margin of vim seems unfit with maximum terminal. I tested my config with neovim but it only happens with vim.

What margin? I don't see it in your videos

Also, if you want to report a bug in Vim, please:

  1. provide a minimal vimrc to reproduce the bug
  2. report it against vim/vim repository

The green line is the "margin" I mean. Sorry, I don't know exactly what it is called.

image image

Minimal vimrc:

call plug#begin(has('nvim') ? stdpath('data') . '/plugged' : '~/vimfiles/plugged')
Plug 'https://github.com/preservim/nerdtree.git'
Plug 'https://github.com/sainnhe/edge.git', {'as': 'edge'}
Plug 'https://github.com/itchyny/lightline.vim.git'
call plug#end()

set laststatus=2
colorscheme edge
let mapleader = " "
nnoremap <leader>e :NERDTreeToggle<CR>
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
"                             Plugin: Lightline                              "
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""

let g:lightline#bufferline#unnamed = 'Unnamed'
let g:lightline#bufferline#enable_devicons = 1
let g:lightline#bufferline#buffer_filter = "LightlineBufferlineFilter"
let g:lightline = {
    \ 'colorscheme': 'edge',
    \ 'active': {
    \   'left': [ [ 'mode', 'paste' ],
    \             [ 'cocstatus', 'readonly' ],
    \             [ 'gitbranch', 'readonly', 'filename', 'modified' ] ],
    \ },
    \ 'component': {
    \   'filename': '%F',
    \ },
    \ 'component_function': {
    \   'cocstatus': 'coc#status',
    \   'filetype': 'MyFiletype',
    \   'fileformat': 'MyFileformat',
    \   'gitbranch': 'gitbranch#name',
    \ },
    \ 'tabline': {
    \   'left': [ ['buffers'] ],
    \ },
    \ 'component_expand': {
    \   'buffers': 'lightline#bufferline#buffers'
    \ },
    \ 'component_type': {
    \   'buffers': 'tabsel',
    \ },
\ }
function! MyFiletype()
    return winwidth(0) > 70 ? (strlen(&filetype) ? &filetype . ' ' . WebDevIconsGetFileTypeSymbol() : 'no ft') : ''
endfunction

function! MyFileformat()
    return winwidth(0) > 70 ? (&fileformat . ' ' . WebDevIconsGetFileFormatSymbol()) : ''
endfunction

function LightlineBufferlineFilter(buffer)
   return getbufvar(a:buffer, '&buftype') !=# 'terminal'
endfunction

if has("gui_running")
    let g:lightline.separator = { 'left': '', 'right': '' }
    let g:lightline.subseparator = { 'left': '|', 'right': '|' }
    let g:lightline.tabline_separator = g:lightline.separator
    let g:lightline.tabline_subseparator = g:lightline.subseparator
elseif has('termguicolors')
    let g:lightline.separator = { 'left': '', 'right': '' }
    let g:lightline.subseparator = { 'left': '', 'right': '' }
    let g:lightline.tabline_separator = g:lightline.separator
    let g:lightline.tabline_subseparator = g:lightline.subseparator
endif

hungpham3112 avatar Mar 30 '22 14:03 hungpham3112

isn't the margin always there, but sometimes with a default color? Don't know what is causing this, but from the video I would guess this is because your terminal cannot draw multiples of the required screen cells in either the columns or rows. That's why it adds the margin. Why it sometimes is colored green, I don't know.

chrisbra avatar Mar 30 '22 20:03 chrisbra

isn't the margin always there, but sometimes with a default color? Don't know what is causing this, but from the video I would guess this is because your terminal cannot draw multiples of the required screen cells in either the columns or rows. That's why it adds the margin. Why it sometimes is colored green, I don't know.

Yes, I also don't know why, but neovim with the same config doesn't appear this. I will try to debug, if I found something I will report back later. In window terminal, seems like it open vim in different way than drawing it in terminal and no error in here.

image

hungpham3112 avatar Mar 30 '22 23:03 hungpham3112

can you please check if https://github.com/vim/vim/commit/5017c66bd461eab46094e076ad1aa818e246ce9d fixes it?

chrisbra avatar Apr 07 '22 17:04 chrisbra

can you please check if vim/vim@5017c66 fixes it?

No, the issue persists in version 8.2.4710. I guess this is the problem with vim redraw, it flickers a lot when resizing. In nvim, resize using mouse doesn't seem affect the vertical edge.

vim:

https://user-images.githubusercontent.com/75968004/162337739-d65d5711-77a5-4390-9e21-df3c6a4d792f.mp4

nvim:

https://user-images.githubusercontent.com/75968004/162337749-69356355-ed14-4dc7-acfe-1b908061f9d6.mp4

hungpham3112 avatar Apr 07 '22 23:04 hungpham3112