Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
hungpham3112 opened this issue Mar 30, 2022 · 6 comments
Labels

Comments

@hungpham3112
Copy link

hungpham3112 commented Mar 30, 2022

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:

bandicam.2022-03-30.10-18-35-041.mp4

window powershell:

bandicam.2022-03-30.10-20-04-523.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).

@chrisbra
Copy link
Member

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

@hungpham3112
Copy link
Author

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

@chrisbra
Copy link
Member

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.

@hungpham3112
Copy link
Author

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

@chrisbra
Copy link
Member

chrisbra commented Apr 7, 2022

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

@hungpham3112
Copy link
Author

hungpham3112 commented Apr 7, 2022

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:

bandicam.2022-04-08.06-55-18-709.mp4

nvim:

bandicam.2022-04-08.06-55-43-829.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants