Skip to main content
added 60 characters in body
Source Link
dedowsdi
  • 6.4k
  • 1
  • 19
  • 34

Hightlight first and last 2 lines after column 80:

:autocmd VimEnter,WinEnter * :match Error /\v%>80v%<3l.*|%>80v.*%$|%>80v.*(\n.*%$)@=/

You need to open a new window or reopen vim for this to work.

Explanation:

  • %>80v%<3l.* match everything after column 80 in first 2 lines
  • %>80v.*%$ match everything after column 80 in last line
  • %>80v.*(\n.*%$)@=/ match everything after column 80 in last second line
  • :help :match
  • :help /%v
  • :help /%l

update

This solution doesn't work on screen line.

Hightlight first and last 2 lines after column 80:

:autocmd VimEnter,WinEnter * :match Error /\v%>80v%<3l.*|%>80v.*%$|%>80v.*(\n.*%$)@=/

You need to open a new window or reopen vim for this to work.

Explanation:

  • %>80v%<3l.* match everything after column 80 in first 2 lines
  • %>80v.*%$ match everything after column 80 in last line
  • %>80v.*(\n.*%$)@=/ match everything after column 80 in last second line
  • :help :match
  • :help /%v
  • :help /%l

Hightlight first and last 2 lines after column 80:

:autocmd VimEnter,WinEnter * :match Error /\v%>80v%<3l.*|%>80v.*%$|%>80v.*(\n.*%$)@=/

You need to open a new window or reopen vim for this to work.

Explanation:

  • %>80v%<3l.* match everything after column 80 in first 2 lines
  • %>80v.*%$ match everything after column 80 in last line
  • %>80v.*(\n.*%$)@=/ match everything after column 80 in last second line
  • :help :match
  • :help /%v
  • :help /%l

update

This solution doesn't work on screen line.

added 63 characters in body
Source Link
dedowsdi
  • 6.4k
  • 1
  • 19
  • 34

Hightlight first and last 2 lines after column 80:

:autocmd VimEnter,WinEnter * :match Error /\v%>80v%<3l.*|%>80v.*%$|%>80v.*(\n.*%$)@=/

You need to open a new window or reopen vim for this to work.

Explanation:

  • %>80v%<3l.* match everything after column 80 in first 2 lines
  • %>80v.*%$ match everything after column 80 in last line
  • %>80v.*(\n.*%$)@=/ match everything after column 80 in last second line
  • :help :match
  • :help /%v
  • :help /%l

Hightlight first and last 2 lines after column 80:

:autocmd VimEnter,WinEnter * :match Error /\v%>80v%<3l.*|%>80v.*%$|%>80v.*(\n.*%$)@=/

Explanation:

  • %>80v%<3l.* match everything after column 80 in first 2 lines
  • %>80v.*%$ match everything after column 80 in last line
  • %>80v.*(\n.*%$)@=/ match everything after column 80 in last second line
  • :help :match
  • :help /%v
  • :help /%l

Hightlight first and last 2 lines after column 80:

:autocmd VimEnter,WinEnter * :match Error /\v%>80v%<3l.*|%>80v.*%$|%>80v.*(\n.*%$)@=/

You need to open a new window or reopen vim for this to work.

Explanation:

  • %>80v%<3l.* match everything after column 80 in first 2 lines
  • %>80v.*%$ match everything after column 80 in last line
  • %>80v.*(\n.*%$)@=/ match everything after column 80 in last second line
  • :help :match
  • :help /%v
  • :help /%l
Source Link
dedowsdi
  • 6.4k
  • 1
  • 19
  • 34

Hightlight first and last 2 lines after column 80:

:autocmd VimEnter,WinEnter * :match Error /\v%>80v%<3l.*|%>80v.*%$|%>80v.*(\n.*%$)@=/

Explanation:

  • %>80v%<3l.* match everything after column 80 in first 2 lines
  • %>80v.*%$ match everything after column 80 in last line
  • %>80v.*(\n.*%$)@=/ match everything after column 80 in last second line
  • :help :match
  • :help /%v
  • :help /%l