vim-dirvish icon indicating copy to clipboard operation
vim-dirvish copied to clipboard

Path not concealed in Vim 9.1

Open andis-sprinkis opened this issue 5 months ago • 3 comments

I wanted to check the issue #257 on Vim so I installed the version from Arch Linux repo.

The default behavior between Neovim 0.11 and Vim 9.1 appears to be visibly different - the paths are concealed in Neovim but not in Vim.

nvim -N -u NORC +'set rtp+=~/.local/share/nvim/lazy/vim-dirvish' +'runtime plugin/dirvish.vim'
vim -N -u NORC +'set rtp+=~/.local/share/nvim/lazy/vim-dirvish' +'runtime plugin/dirvish.vim'
:Dirvish

On both Nvim and Vim

:echo &conceallevel

prints 2.

Not sure if the differences in Neovim and Vim default options would impact it - Vim_diff - Neovim docs

Image
NVIM v0.11.4
Build type: RelWithDebInfo
LuaJIT 2.1.1753364724
Compilation: /usr/bin/cc -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions     -Wp,-D_FORTIFY_SOURCE=3 -Wformat -Werror=format-security     -fstack-clash-protection -fcf-protection     -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/neovim/src=/usr/src/debug/neovim -flto=auto -O2 -g -flto=auto -fno-fat-lto-objects -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshadow -Wconversion -Wvla -Wdouble-promotion -Wmissing-noreturn -Wmissing-format-attribute -Wmissing-prototypes -fsigned-char -fstack-protector-strong -Wno-conversion -fno-common -Wno-unused-result -Wimplicit-fallthrough -fdiagnostics-color=always  -DUNIT_TESTING -D_GNU_SOURCE -DINCLUDE_GENERATED_DECLARATIONS -DUTF8PROC_STATIC -I/usr/include/luajit-2.1 -I/usr/include -I/build/neovim/src/neovim/build/src/nvim/auto -I/build/neovim/src/neovim/build/include -I/build/neovim/src/neovim/build/cmake.config -I/build/neovim/src/neovim/src 

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/share/nvim"

Run :checkhealth for more info
VIM - Vi IMproved 9.1 (2024 Jan 02, compiled Sep 05 2025 17:55:41)
Included patches: 1-1734
Compiled by Arch Linux
Huge version without GUI.  Features included (+) or not (-):
+acl               +find_in_path      +multi_byte        +tcl/dyn
+arabic            +float             +multi_lang        +termguicolors
+autocmd           +folding           -mzscheme          +terminal
+autochdir         -footer            +netbeans_intg     +terminfo
-autoservername    +fork()            +num64             +termresponse
-balloon_eval      +gettext           +packages          +textobjects
+balloon_eval_term -hangul_input      +path_extra        +textprop
-browse            +iconv             +perl/dyn          +timers
++builtin_terms    +insert_expand     +persistent_undo   +title
+byte_offset       +ipv6              +popupwin          -toolbar
+channel           +job               +postscript        +user_commands
+cindent           +jumplist          +printer           +vartabs
+clientserver      +keymap            +profile           +vertsplit
-clipboard         +lambda            -python            +vim9script
+cmdline_compl     +langmap           +python3/dyn       +viminfo
+cmdline_hist      +libcall           +quickfix          +virtualedit
+cmdline_info      +linebreak         +reltime           +visual
+comments          +lispindent        +rightleft         +visualextra
+conceal           +listcmds          +ruby/dyn          +vreplace
+cryptv            +localmap          +scrollbind        -wayland
+cscope            +lua/dyn           +signs             -wayland_clipboard
+cursorbind        +menu              +smartindent       +wildignore
+cursorshape       +mksession         +socketserver      +wildmenu
+dialog_con        +modify_fname      -sodium            +windows
+diff              +mouse             -sound             +writebackup
+digraphs          -mouseshape        +spell             -X11
-dnd               +mouse_dec         +startuptime       +xattr
-ebcdic            +mouse_gpm         +statusline        -xfontset
+emacs_tags        -mouse_jsbterm     -sun_workshop      -xim
+eval              +mouse_netterm     +syntax            -xpm
+ex_extra          +mouse_sgr         +tabpanel          -xsmp
+extra_search      -mouse_sysmouse    +tag_binary        -xterm_clipboard
-farsi             +mouse_urxvt       -tag_old_static    -xterm_save
+file_in_path      +mouse_xterm       -tag_any_white     
   system vimrc file: "/etc/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.vim/vimrc"
 3rd user vimrc file: "$XDG_CONFIG_HOME/vim/vimrc"
      user exrc file: "$HOME/.exrc"
       defaults file: "$VIMRUNTIME/defaults.vim"
  fall-back for $VIM: "/usr/share/vim"
Compilation: gcc -c -I. -Iproto -DHAVE_CONFIG_H -march=x86-64 -mtune=generic -O2 -pipe -fno-plt -fexceptions -Wformat -Werror=format-security -fstack-clash-protection -fcf-protection -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -g -ffile-prefix-map=/build/vim/src=/usr/src/debug/vim -flto=auto -D_REENTRANT -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 
Linking: gcc -Wl,-E -Wl,-rpath,/usr/lib/perl5/5.42/core_perl/CORE -Wl,-O1 -Wl,--sort-common -Wl,--as-needed -Wl,-z,relro -Wl,-z,now -Wl,-z,pack-relative-relocs -flto=auto -L/usr/local/lib -o vim -lm -ltinfo -lacl -lattr -lgpm -L/usr/lib -ltclstub8.6 -ldl -lz -lpthread -lm 

andis-sprinkis avatar Sep 07 '25 16:09 andis-sprinkis

Since https://github.com/justinmk/vim-dirvish/pull/255 , a different approach is used in Neovim. But I wouldn't expect that to regress the behavior for Vim.

Does reverting that (or going back to a dirvish commit from, say, 5 years ago...) fix the issue? If not, this might be a regression in Vim itself, then would need to bisect to a Vim commit.

justinmk avatar Sep 07 '25 17:09 justinmk

git checkout 1 commit before #255 commit results in the same behavior in Vim, and the same with going back to commits from 2023, 2020, 2016.

andis-sprinkis avatar Sep 07 '25 17:09 andis-sprinkis

oh I forgot that textprops are used in Vim if available: https://github.com/justinmk/vim-dirvish/blob/5d1d1ef45c6161af14c7d3d3097057e8fb5ac257/autoload/dirvish.vim#L434-L439

so either we're doing something wrong, or upstream Vim changed something and we need to adapt.

I confirmed that the old conceal-based approach works:

diff --git a/autoload/dirvish.vim b/autoload/dirvish.vim
index 10d0149e826b..b9c0ce6d43ea 100644
--- a/autoload/dirvish.vim
+++ b/autoload/dirvish.vim
@@ -426,19 +426,19 @@ func! s:apply_icons() abort
   if 0 == len(s:cb_map)
     return
   endif
-  let l:feat = has('nvim-0.8') ? 'extmark' : ((v:version >= 901 && has('textprop'))? 'textprop': 'conceal')
-  if l:feat ==# 'extmark'
-    if !exists('s:ns_id')
-      let s:ns_id = nvim_create_namespace('dirvish.icons')
-    endif
-  elseif l:feat ==# 'textprop'
-    if !exists('s:prop_type')
-      let s:prop_type = 'dirvish.icons'
-      call prop_type_add(s:prop_type, {})
-    endif
-  else
+  "let l:feat = has('nvim-0.8') ? 'extmark' : ((v:version >= 901 && has('textprop'))? 'textprop': 'conceal')
+  "if l:feat ==# 'extmark'
+  "  if !exists('s:ns_id')
+  "    let s:ns_id = nvim_create_namespace('dirvish.icons')
+  "  endif
+  "elseif l:feat ==# 'textprop'
+  "  if !exists('s:prop_type')
+  "    let s:prop_type = 'dirvish.icons'
+  "    call prop_type_add(s:prop_type, {})
+  "  endif
+  "else
     highlight clear Conceal
-  endif
+  "endif
 
   let i = 0
   for f in getline(1, '$')
@@ -451,16 +451,16 @@ func! s:apply_icons() abort
       endif
     endfor
     if icon != ''
-      if l:feat ==# 'extmark'
-        call nvim_buf_set_extmark(0, s:ns_id, i-1, 0, #{virt_text: [[icon, 'DirvishColumnHead']], virt_text_pos: 'inline'})
-      elseif l:feat ==# 'textprop'
-        call prop_add(i, 1, #{type: s:prop_type, text: icon})
-      else
+      "if l:feat ==# 'extmark'
+      "  call nvim_buf_set_extmark(0, s:ns_id, i-1, 0, #{virt_text: [[icon, 'DirvishColumnHead']], virt_text_pos: 'inline'})
+      "elseif l:feat ==# 'textprop'
+      "  call prop_add(i, 1, #{type: s:prop_type, text: icon})
+      "else
         let isdir = (f[-1:] == s:sep)
         let f = substitute(s:f(f), escape(s:sep,'\').'$', '', 'g')  " Full path, trim slash.
         let tail_esc = escape(fnamemodify(f,':t').(isdir?(s:sep):''), '[,*.^$~\')
         exe 'syntax match DirvishColumnHead =\%'.i.'l^.\{-}\ze'.tail_esc.'$= conceal cchar='.icon
-      endif
+      "endif
     endif
   endfor
 endf

justinmk avatar Sep 07 '25 18:09 justinmk