Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add terminal mode support #3

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions autoload/resize_mode.vim
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,9 @@ function! s:exit_mode(c, match_id) abort
" Clear our highlighting
call matchdelete(a:match_id)

" Not sure why, but couldn't get calling `echo` directly here to
" update the command line working. Do it later with feedkeys.
call feedkeys(":echo\<CR>", 'nt')
" Clear the -- RESIZE -- message
echo ''
redraw
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this didn't work for you before, but the direct way works fine for me now in vim 9.1 (and this fixes an issue that the current implementation causes in terminal mode)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I were the author or maintainer, I would find this change a lot easier to review if your cover letter (PR description) or commit message explained what problem exists in terminal buffers and how these changes resolve it.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The main problem is the absence of mappings for terminal mode, i.e. the plugin simply does noting in terminal mode.

The secondary problem (once the mappings for terminal mode are created), is that the above code for clearing the -- RESIZE -- status message dumps the text :echo into the terminal buffer instead of doing what it was intending to do.

Hope this helps clarify the issue ❤️


" getchar() sometimes returns a number, sometimes a string. If it's a
" number, convert for passing into feedkeys.
Expand Down
10 changes: 10 additions & 0 deletions plugin/resize-mode.vim
Original file line number Diff line number Diff line change
Expand Up @@ -13,21 +13,31 @@ endif
let g:loaded_resize_mode = 1

nnoremap <silent> <Plug>ResizeIncreaseHeight :<C-U>call resize_mode#start('+', v:count1)<CR>
tnoremap <silent> <Plug>ResizeIncreaseHeight <C-W>:<C-U>call resize_mode#start('+', v:count1)<CR>
nnoremap <silent> <Plug>ResizeDecreaseHeight :<C-U>call resize_mode#start('-', v:count1)<CR>
tnoremap <silent> <Plug>ResizeDecreaseHeight <C-W>:<C-U>call resize_mode#start('-', v:count1)<CR>
nnoremap <silent> <Plug>ResizeIncreaseWidth :<C-U>call resize_mode#start('>', v:count1)<CR>
tnoremap <silent> <Plug>ResizeIncreaseWidth <C-W>:<C-U>call resize_mode#start('>', v:count1)<CR>
nnoremap <silent> <Plug>ResizeDecreaseWidth :<C-U>call resize_mode#start('<', v:count1)<CR>
tnoremap <silent> <Plug>ResizeDecreaseWidth <C-W>:<C-U>call resize_mode#start('<', v:count1)<CR>

if !hasmapto('<Plug>ResizeIncreaseHeight')
nmap <unique> <C-W>+ <Plug>ResizeIncreaseHeight
tmap <unique> <C-W>+ <Plug>ResizeIncreaseHeight
nmap <unique> <C-W><kPlus> <Plug>ResizeIncreaseHeight
tmap <unique> <C-W><kPlus> <Plug>ResizeIncreaseHeight
endif
if !hasmapto('<Plug>ResizeDecreaseHeight')
nmap <unique> <C-W>- <Plug>ResizeDecreaseHeight
tmap <unique> <C-W>- <Plug>ResizeDecreaseHeight
nmap <unique> <C-W><kMinus> <Plug>ResizeDecreaseHeight
tmap <unique> <C-W><kMinus> <Plug>ResizeDecreaseHeight
endif
if !hasmapto('<Plug>ResizeIncreaseWidth')
nmap <unique> <C-W>> <Plug>ResizeIncreaseWidth
tmap <unique> <C-W>> <Plug>ResizeIncreaseWidth
endif
if !hasmapto('<Plug>ResizeDecreaseWidth')
nmap <unique> <C-W>< <Plug>ResizeDecreaseWidth
tmap <unique> <C-W>< <Plug>ResizeDecreaseWidth
endif