Closed j0k4rX closed 3 years ago
Thank you for filing an issue. I can't view the video, but I suspect I know what the issue is.
I believe you have these lines from tmwilliamlin168's vimrc:
set nu
augroup numbertoggle
autocmd!
autocmd BufEnter,FocusGained,InsertLeave * set rnu
autocmd BufLeave,FocusLost,InsertEnter * set nornu
augroup END
What you are observing is the buffer in normal mode instead of insert mode when you re-enter it. Fortunately I know of a fix for this.
Please see if adding this line (from my commit just now) fixes the issue:
https://github.com/mizlan/vim-and-cp/blob/e13010c0160d01aade8cd57ffcf64fdb892bd1c7/cp.vim#L33
what if i wanted the terminal_cmd always in insert/terminal mode?
What do you mean by that? When you enter (and re-enter) the terminal window it should automatically enter insert mode.
yes, I prefer it automatically enter into insert mode
But it does already do that, I just added that line.
When i am in a contest, I am coding in a file then i trigger CompileAndRun
While I copy the input from browser, terminal_cmd loses focus (insert mode vanishes)
for that reason, I have to type i
to go into insert mode
and paste that input
Expected Solution
- I wanted to re-enter the terminal_cmd in insert mode
- if the terminal_cmd loses focus while i am copying input it should regain
insert mode
if you watch the video carefully, you'll see --terminal--
is gone in the status bar when I re-enter that terminal_cmd
@mizlan I found a solution here
if has('nvim')
augroup terminal_setup | au!
autocmd TermOpen * nnoremap <buffer><LeftRelease> <LeftRelease>i
" more stuff
augroup end
endif
Ah, more details would have been nice. I'm glad you found the fix. If you'd like, I would love to have a PR adding that functionality.
You and I have long history my friend. I'm this guy @j0k4rX. And this is my working id.
I was not familiar with PRs back then. Okay, new PR is coming up.
Suppose, i am writing on A.cpp file I've triggered CompileAndRun command
As per your cp.vim termwrapper function, (1) it opens terminal_cmd inside nvim (2) the numbers, relative numbers don't show in that terminal_cmd
But when i click the A.cpp file from terminal_cmd (terminal_cmd open & running) and then again click the terminal_cmd the numbers, relative numbers appear like the video in that terminal_cmd
https://user-images.githubusercontent.com/71499522/124482809-7ec6f600-ddcb-11eb-97c6-389a6fdaf049.mp4
Expected Behavior