I sometimes use vim for brainstorming and writing first drafts and would like to be able to temporarily disable the ability to delete or edit what I write down. Is there anyway to do this natively in vim?
1 Answer
You are looking for :set nomodifiable
which disables any changes which you will try to do in some buffer. Look here, :h modifiable
.
-
And
:set modifiable!
toggles between the two values; useful for key mappings:nnoremap <Leader>n :set modifiable!<CR>:set modifiable?<CR>
(that second :set is to show the setting after pressing the key). Aug 1, 2020 at 9:54