Skip to content

Conversation

@dmitrivereshchagin
Copy link

One may use this mappings due to performance reasons. In addition sometimes there is a code that is much easier to read with syntax highlighting turned off.

@auwsmit
Copy link
Contributor

auwsmit commented Jul 6, 2025

here's a little vimrc snippet for anyone who comes across this and wants a simple fix:

" toggle syntax highlighting
" useful when Vim is crippled by its inefficient highlighting
fun! s:ToggleSyntaxHighlighting() abort
  let folds = &foldlevel
  execute 'syntax '.(exists("g:syntax_on") ? 'off' : 'enable')
  let &foldlevel=folds
endfun
command! ToggleSyntax call <SID>ToggleSyntaxHighlighting()
nnoremap yoS :call <SID>ToggleSyntaxHighlighting()<CR>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants