Closed mbryne closed 9 years ago
Have you tried using feedkeys instead of startinsert? Try adding this line instead:
call feedkeys("i")
Feedkeys simulates key presses, you can check :h feedkeys() for more info.
Not sure why startinsert
doesn't work as expected, maybe it could be a bug of vim, but I can confirm that @dylanaraps's suggestion solves the issue.
The feedkeys call worked! I was using norm G$i but it wasn't playing ball either.
Thanks for that fix and thanks for the excellent plugin.
Upon running a ':PlugUpdate' and ':PlugInstall' I get this same error. I only have ':startinsert' defined for mutt temp files like so: ~/.vimrc:
autocmd BufRead ~/tmp/mutt-* execute ":startinsert"
Even commenting it out I get the same error when trying to write to ANY file type. This wasn't happening before so I suspect an update to Goyo.vim because of when I look to see what is setting the 'unmodifiable' flag, it is 'goyo.vim':
Vim Command:
:verbose set modifiable?
Output:
nomodifiable
Last set from ~/.vim/plugged/goyo.vim/autoload/goyo.vim line 82
The goyo.vim section containing line 82 reads:
" To hide scrollbars of pad windows in GVim
let diff = winheight(0) - line('$') - (has('gui_running') ? 2 : 0)
if diff > 0
# setlocal modifiable
call append(0, map(range(1, diff), '""'))
normal! gg
setlocal nomodifiable <<== line 82
endif
execute winnr('#') . 'wincmd w'
endfunction
My only recourse at the moment and to make vim usable again; is to comment out my Goyo plugin entirely from my vimrc file. This makes the problem go away but Goyo unusable.
Any ideas what's gone wrong here?
vi ~/.vim/plugged/goyo.vim/autoload/goyo.vim +82
Changed line 82 from:
setlocal nomodifiable
To:
setlocal modifiable
Everything seems back to normal and working now for my Markdown files.
Greetings,
Thanks for your hard work, I am wondering if you can help me with a basic issue I am having.
I am aiming to automatically jump into writing when VIM launches, when I call startinsert (see below) my cursor appears in the top left corner and when trying to move or insert I get the error 'E21: Cannot make changes, 'modifiable' is off'.
I am presuming (based on my limited knowledge) that startinsert is effecting the first buffer, how would I go about jumping straight into edit mode after Goyo launches?
`autocmd Filetype text call LaunchJournal() autocmd! User GoyoEnter nested callgoyo_enter()
function LaunchJournal() Goyo endfunction
function! s:goyo_enter() norm! G$ startinsert " < ends up in first buffer I am presuming endfunction`