Skip to content

Commit

Permalink
Merge github.com:dstein64/vim-win
Browse files Browse the repository at this point in the history
  • Loading branch information
dstein64 committed Dec 8, 2020
2 parents 881df95 + f41f1dc commit ff955df
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 49 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,8 @@ below).

## Installation

Use one of the following package managers:
A package manager can be used to install `vim-win`.
<details><summary>Examples</summary><br>

* [Vim8 packages][vim8pack]:
- `git clone /~https://github.com/dstein64/vim-win ~/.vim/pack/plugins/start/vim-win`
Expand All @@ -35,6 +36,8 @@ Use one of the following package managers:
- Add `NeoBundle 'dstein64/vim-win'` to `~/.vimrc`
- Re-open vim or execute `:source ~/.vimrc`

</details>

## Usage

Enter `vim-win` with `<leader>w` or `:Win`.
Expand Down
73 changes: 27 additions & 46 deletions autoload/win.vim
Original file line number Diff line number Diff line change
Expand Up @@ -262,53 +262,34 @@ function! s:ScanWinnr(echo_list)
endfunction

function! s:ShowHelp()
let l:echo_list = [
\ ['Title', 'vim-win help'],
\ ['None', "\n"],
\ ['None', '* Arrows or '],
\ ['SpecialKey', 'hjkl'],
\ ['None', ' keys are used for movement.'],
\ ['None', "\n"],
\ ['None', '* There are various ways to change the active window.'],
\ ['None', "\n"],
\ ['None', ' - Use movement keys to move to neighboring windows.'],
\ ['None', "\n"],
\ ['None', ' - Enter a window number (where applicable, press '],
\ ['SpecialKey', '<enter>'],
\ ['None', ' to submit).'],
\ ['None', "\n"],
\ ['None', ' - Use '],
\ ['SpecialKey', 'w'],
\ ['None', ' or '],
\ ['SpecialKey', 'W'],
\ ['None', ' to sequentially move to the next or previous window.'],
\ ['None', "\n"],
\ ['None', '* Hold '],
\ ['SpecialKey', '<shift>'],
\ ['None', ' and use movement keys to resize the active window.'],
\ ['None', "\n"],
\ ['None', ' - Left movements decrease width and right movements increase width.'],
\ ['None', "\n"],
\ ['None', ' - Down movements decrease height and up movements increase height.'],
\ ['None', "\n"],
\ ['None', '* Press '],
\ ['SpecialKey', 's'],
\ ['None', ' or '],
\ ['SpecialKey', 'S'],
\ ['None', ' followed by a movement key or window number, to swap buffers.'],
\ ['None', "\n"],
\ ['None', ' - The active window changes with '],
\ ['SpecialKey', 's'],
\ ['None', ' and is retained with '],
\ ['SpecialKey', 'S'],
\ ['None', '.'],
\ ['None', "\n"],
\ ['None', '* Press '],
\ ['SpecialKey', '<esc>'],
\ ['None', ' to leave vim-win (or go back, where applicable).'],
\ ['None', "\n"],
\ ['Question', '[Press any key to continue]'],
let l:help_lines = [
\ '* Arrows or `hjkl` keys are used for movement.',
\ '* There are various ways to change the active window.',
\ ' - Use movement keys to move to neighboring windows.',
\ ' - Enter a window number (where applicable, press `<enter>` to submit).',
\ ' - Use `w` or `W` to sequentially move to the next or previous window.',
\ '* Hold `<shift>` and use movement keys to resize the active window.',
\ ' - Left movements decrease width and right movements increase width.',
\ ' - Down movements decrease height and up movements increase height.',
\ '* Press `s` or `S` followed by a movement key or window number, to swap'
\ . ' buffers.',
\ ' - The active window changes with `s` and is retained with `S`.',
\ '* Press `<esc>` to leave vim-win (or go back, where applicable).',
\ ]
let l:echo_list = []
call add(l:echo_list, ['Title', "vim-win help\n"])
let l:help_text = join(l:help_lines, "\n")
" The state is 0 for text outside backticks, and 1 inside backticks.
let l:state = 0
let l:highlight_lookup = ['None', 'SpecialKey']
for l:char in split(l:help_text, '\zs')
if l:char ==# '`'
let l:state = !l:state
continue
endif
call add(l:echo_list, [l:highlight_lookup[l:state], l:char])
endfor
call add(l:echo_list, ['Question', "\n[Press any key to continue]"])
call s:Echo(l:echo_list)
call s:GetChar()
redraw | echo ''
Expand Down
4 changes: 2 additions & 2 deletions doc/win.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@ These can be customized (see |win-configuration| below).
- Enter a window number (where applicable, press <enter> to submit).
- Use `w` or `W` to sequentially move to the next or previous window.
* Hold <shift> and use movement keys to resize the active window.
- `Left` movements decrease width and `right` movements increase width.
- `Down` movements decrease height and `up` movements increase height.
- Left movements decrease width and right movements increase width.
- Down movements decrease height and up movements increase height.
* Press `s` or `S` followed by a movement key or window number, to swap buffers.
- The active window changes with `s` and is retained with `S`.
* Press `?` to show a help message.
Expand Down

0 comments on commit ff955df

Please sign in to comment.