From c6b7b6745d72ce93c48a57db5c329a6a6b1482b2 Mon Sep 17 00:00:00 2001 From: AnotherProksY Date: Mon, 20 Jul 2020 05:07:05 +0300 Subject: [PATCH] Initial commit --- .gitignore | 1 + README.md | 27 +++++++++++++++++++++++++++ plugin/ez-window.vim | 29 +++++++++++++++++++++++++++++ 3 files changed, 57 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 plugin/ez-window.vim diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..1377554 --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +*.swp diff --git a/README.md b/README.md new file mode 100644 index 0000000..fb28145 --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +Easy Window +========== +Simple and small plugin for fast navigation between windows. + +![Imgur](https://i.imgur.com/SOBhnQm.gif?1) + +Will create a new window, if it didn't exist earlier or move to an existing one. + +Installation +------------ + +* Manual + * Copy `plugin/ez-window.vim` to `~/.vim/plugin` +* [Pathogen](https://github.com/tpope/vim-pathogen) + * `git clone git://github.com/AnotherProksY/ez-window.git ~/.vim/bundle/vim-ez-window` +* [Vundle](https://github.com/VundleVim/Vundle.vim) + * `Plugin 'AnotherProksY/ez-window'` +* [Vim-Plug](https://github.com/junegunn/vim-plug) + * `Plug 'AnotherProksY/ez-window'` + +Shortcuts +--------- + + : New window or Move Left. + : New window or Move Down. + : New window or Move Up. + : New window or Move Right. diff --git a/plugin/ez-window.vim b/plugin/ez-window.vim new file mode 100644 index 0000000..94fc12c --- /dev/null +++ b/plugin/ez-window.vim @@ -0,0 +1,29 @@ +" Simple and small plugin for fast navigation between windows. +" Maintainer: AnotherProksY +" Repository: https://github.com/AnotherProksY/ez-window + +if exists('g:loaded_ezwindow') || &cp + finish +end +let g:loaded_ezwindow = 1 + + +function! EzWindow(key) + let t:curwin = winnr() + exec "wincmd ".a:key + if (t:curwin == winnr()) + if (match(a:key,'[jk]')) + wincmd v + else + wincmd s + endif + exec "wincmd ".a:key | enew + endif +endfunction + + +" Mapping +nmap :call EzWindow('h') +nmap :call EzWindow('j') +nmap :call EzWindow('k') +nmap :call EzWindow('l')