Search code examples
vimmacvim

Color encoding when using `:! <command>`


When I run, for example, ! yarn lint inside a MacVim. I have this result.

enter image description here

While I run the same command in Terminal's Vim. This is what I get.

enter image description here

Is there any way to make the former colourised as the latter?


Solution

  • So I followed romainl's suggestion and came up with a solution.

    First, :terminal ++close yarn format does colour the terminal result nicely, so I updated my mapping.

    map <Leader>l :terminal ++close yarn format<CR>
    

    Then to fix the auto-reload problem. This is what I did.

    set autoread
    au CursorHold,CursorHoldI * checktime
    au FocusGained,BufEnter * :checktime
    

    Thanks to resources from this thread!

    https://unix.stackexchange.com/questions/149209/refresh-changed-content-of-file-opened-in-vim