Posts tagged “vi”

TIL you can change the background color of conflict marker sections.

March 29, 2022

TIL you can change the background color of conflict marker sections.

Credit: https://vi.stackexchange.com/a/19760

function! ConflictsHighlight() abort
    syn region conflictStart start=/^<<<<<<< .*$/ end=/^\ze\(=======$\||||||||\)/
    syn region conflictMiddle start=/^||||||| .*$/ end=/^\ze=======$/
    syn region conflictEnd start=/^\(=======$\||||||| |\)/ end=/^>>>>>>> .*$/

    highlight conflictStart ctermbg=red ctermfg=black
    highlight conflictMiddle ctermbg=blue ctermfg=black
    highlight conflictEnd ctermbg=green cterm=bold ctermfg=black
endfunction

augroup MyColors
    autocmd!
    autocmd BufEnter * call ConflictsHighlight()
augroup END



TIL you can sort lines of text in Vi.

October 29, 2021

TIL you can sort lines of text in Vi.

  1. Select lines with Visual mode linewise
  2. :sort<CR>