chrisbra / Colorizer

color hex codes and color names
549 stars 31 forks source link

after colorized, it remain's it's code #100

Closed nolleh closed 11 months ago

nolleh commented 1 year ago

as described in your docs, I run

:r! ls --color -l

and resulting image

and I do type

:colorHighlight

and it result in image

colorized but remains it's code...

my environment

any idea enlighten you ? thanx in advance!

chrisbra commented 1 year ago

hm, does your vim not have conceal option? can you please show correct output of :version?

nolleh commented 1 year ago

yeap, the result is here.

:version
VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Feb 12 2022 04:28:00)
macOS version - arm64
Included patches: 1-4113
Compiled by root@apple.com
Normal version without GUI.  Features included (+) or not (-):
+acl               +cmdline_hist      +ex_extra          +jumplist          -mouse_dec         -perl              -sodium            +textobjects       +wildmenu
-arabic            +cmdline_info      +extra_search      -keymap            -mouse_gpm         +persistent_undo   -sound             +textprop          +windows
+autocmd           +comments          -farsi             +lambda            -mouse_jsbterm     +popupwin          +spell             +timers            +writebackup
+autochdir         -conceal           +file_in_path      -langmap           -mouse_netterm     +postscript        +startuptime       +title             -X11
-autoservername    +cryptv            +find_in_path      +libcall           +mouse_sgr         +printer           +statusline        -toolbar           -xfontset
-balloon_eval      +cscope            +float             +linebreak         -mouse_sysmouse    -profile           -sun_workshop      +user_commands     -xim
-balloon_eval_term +cursorbind        +folding           +lispindent        -mouse_urxvt       -python            +syntax            -vartabs           -xpm
-browse            +cursorshape       -footer            +listcmds          +mouse_xterm       -python3           +tag_binary        +vertsplit         -xsmp
+builtin_terms     +dialog_con        +fork()            +localmap          +multi_byte        +quickfix          -tag_old_static    +vim9script        -xterm_clipboard
+byte_offset       +diff              -gettext           -lua               +multi_lang        +reltime           -tag_any_white     +viminfo           -xterm_save
+channel           +digraphs          -hangul_input      +menu              -mzscheme          -rightleft         -tcl               +virtualedit
+cindent           -dnd               +iconv             +mksession         +netbeans_intg     +ruby/dyn          -termguicolors     +visual
-clientserver      -ebcdic            +insert_expand     +modify_fname      +num64             +scrollbind        +terminal          +visualextra
+clipboard         -emacs_tags        +ipv6              +mouse             +packages          +signs             +terminfo          +vreplace
+cmdline_compl     +eval              +job               -mouseshape        +path_extra        +smartindent       +termresponse      +wildignore
   system vimrc file: "$VIM/vimrc"
     user vimrc file: "$HOME/.vimrc"
 2nd user vimrc file: "~/.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   -DMACOS_X_UNIX  -g -O2 -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1
Linking: gcc   -L/usr/local/lib -o vim        -lm -lncurses  -liconv -framework Cocoa

does conceal option need to be included?

chrisbra commented 1 year ago

yes, you need conceal, in order to hide certain parts of the file.

nolleh commented 1 year ago

oh, tnx. now I enabled the conceal option, so It works as expected for normal window.

but I don't know exactly it related with this feature, (so if it is not related, just let me know :)) in preview window, once concealed and when I redraw (with another text), it repeatedly remains it's code.

it will be great If there is some suggestion!

first run in preview image

second run in preview

image

vim feature

VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Dec 12 2022 18:56:32)
macOS version - arm64
Included patches: 1-1050
Compiled by Homebrew
Huge version without GUI.  Features included (+) or not (-):
+acl               +comments          +find_in_path      +lispindent        +multi_byte        +rightleft         +terminal          +wildignore
+arabic            +conceal           +float             +listcmds          +multi_lang        +ruby              +terminfo          +wildmenu
+autocmd           +cryptv            +folding           +localmap          -mzscheme          +scrollbind        +termresponse      +windows
+autochdir         +cscope            -footer            +lua               +netbeans_intg     +signs             +textobjects       +writebackup
-autoservername    +cursorbind        +fork()            +menu              +num64             +smartindent       +textprop          -X11
-balloon_eval      +cursorshape       +gettext           +mksession         +packages          -sodium            +timers            -xfontset
+balloon_eval_term +dialog_con        -hangul_input      +modify_fname      +path_extra        +sound             +title             -xim
-browse            +diff              +iconv             +mouse             +perl              +spell             -toolbar           -xpm
++builtin_terms    +digraphs          +insert_expand     -mouseshape        +persistent_undo   +startuptime       +user_commands     -xsmp
+byte_offset       -dnd               +ipv6              +mouse_dec         +popupwin          +statusline        +vartabs           -xterm_clipboard
+channel           -ebcdic            +job               -mouse_gpm         +postscript        -sun_workshop      +vertsplit         -xterm_save
+cindent           +emacs_tags        +jumplist          -mouse_jsbterm     +printer           +syntax            +vim9script
-clientserver      +eval              +keymap            +mouse_netterm     +profile           +tag_binary        +viminfo
+clipboard         +ex_extra          +lambda            +mouse_sgr         -python            -tag_old_static    +virtualedit
+cmdline_compl     +extra_search      +langmap           -mouse_sysmouse    +python3           -tag_any_white     +visual
+cmdline_hist      -farsi             +libcall           +mouse_urxvt       +quickfix          -tcl               +visualextra
+cmdline_info      +file_in_path      +linebreak         +mouse_xterm       +reltime           +termguicolors     +vreplace

thanx!

chrisbra commented 1 year ago

how did you run it?

nolleh commented 1 year ago

I use some open source to run it.

https://github.com/nolleh/pipe-mysql.vim (I've forked to colorize from this one)

I am not sure about it, but as long as I anlayze it,

it process as follows.

  1. open preview window (silent! exe "noautocmd botright pedit |")
  2. with window option
    • linumber:0, wordwrap: 0, whitespace :0, colorcolumn: 0
  3. move and make preview editable (noautocmd wincmd P, setlocal modifiable)
  4. run passed command (silent! exe "noautocmd .! " . l:shell_command).
    • in my case, shell command will be mysql --password < test.mysql | grcat ~/.grcat
lollipopman commented 1 year ago

I see a similar issue with vim 9.0

$ cat ~/tmp/colorize-issue.txt
  -    helm.sh/chart: jaeger-0.67.3
$ cat -A ~/tmp/colorize-issue.txt
  ^[[31m-    helm.sh/chart: jaeger-0.67.3^[[0m$
$ vim --version | grep -E '(^VIM|conceal)'
VIM - Vi IMproved 9.0 (2022 Jun 28, compiled Mar 04 2023 19:41:33)
+conceal           +lispindent        +reltime           +visualextra

image colorize-issue.txt

dougpagani commented 1 year ago

@lollipopman I get the same with git status's output:

^[[1;31mmodified:   PiPrinter.md^[[m

Yields: (w/ :ColorHighlight)

# (red) 
^[[1;31mmodified:   PiPrinter.md

I do have conceal enabled, which is apparent in this example in that it conceals the ending code but not the beginning. It's colorizing, but the codes screw-up intelligibility.

chrisbra commented 11 months ago

I have not seen ^[[31m before, so I made a small change to hide that one as well. Please let me know if this works