GithubHelp home page GithubHelp logo

deliasvcruz / neozoom.lua Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nyngwang/neozoom.lua

0.0 0.0 0.0 50 KB

Zoom-in Like a Boss, How? Layout-Preserving Zoomer weighing in ๐Ÿชถ

Lua 100.00%

neozoom.lua's Introduction

NeoZoom.lua

Important News

0203 update: Now it won't close any tab, but you can close it yourself via (possibly many) :q or one :tabclose.

Please use NeoSplit and NeoVSplit commands to create new split so this plugin will work correctly. Here is an example:

---- Tmux-like window-split (and jumps).
vim.keymap.set('n', '<C-W>"', function () vim.cmd('NeoSplit') end, {nowait=true,silent=true,noremap=true})
vim.keymap.set('n', '<C-W>%', function () vim.cmd('NeoVSplit') end, {nowait=true,silent=true,noremap=true})

DEMO

like_a_boss_demo.mov

Intro.

Are you still using <C-W>o to maximize a window split and DESTROY THE OTHER ONES under the same tab ๐Ÿ˜ต? You should try NeoZoom.lua!

You can think of NeoZoom.lua as enhanced :tab split , with these differences:

  1. :tab split won't restore your cursor position after you close the tab, while NeoZoom.lua will do.
  2. :tab split won't pin your current cursorline to 80% of the current height, while NeoZoom.lua will do to prevent you become a turtle ๐Ÿข.
  3. :tab split creates a new tab on any circumstance, while NeoZoom.lua tabclose one with a single window.

So NeoZoom.lua is more user friendly, you only need one key to zoom-in/out.

Some more details:

  1. It zoom-in on any tab with more than one windows, and zoom-out on any tab with only one window. The last window in the last tab won't be close.
  2. NeoZoom.lua is very lightweight. It's almost impossible to have any conflict with those favorite plugins that you already installed.
  3. Floating window on cursor-hover (e.g. showing LSP Diagnostics message on cursor-hover) increases the number of windows, while this is taken into account.
  4. If you're using kyazdani42/nvim-tree.lua:
    1. You can open it after zoom-in.
    2. You can have it open before zoom-in. It will also be restored on zoom-out.

Features

  • Cursor pos. is restored, after zoom-in
  • Very Light-weight (27 lines, excluding non-logics)
  • No dependencies, but you had better know nothing about tabs.
  • (For advance users) Floating window on cursor-hover (e.g. to show LSP line Diagnostics message) indeed increases window count, this case is covered by NeoZoom.lua :)

installation

Packer.nvim

use {
  'nyngwang/NeoZoom.lua'
}

Usage

Change <CR> to whatever shortcut you like~

Recommended, I will keep track of this one to make sure it always works after any possible breaking change

-- if you use `<CR>` as toggle, then you should handle when to fallback yourself so it won't intercept the plain-old `<CR>`.
vim.api.nvim_set_keymap('n', '<CR>', "&ft != 'qf' ? '<cmd>NeoZoomToggle<CR>' : '<CR>'", { noremap=true, silent=true, nowait=true })

Simple one, If you never use quickfix list, pick this one

vim.api.nvim_set_keymap('n', '<CR>', '<cmd>NeoZoomToggle<CR>', { noremap=true, silent=true, nowait=true })

TODO list

  • a better README.md
    • add a DEMO
    • add packer.nvim installation guide
    • customizable shortcut
  • config setup tutorial, must be simple and useful
    • have to use setup function instead of the ugly _G. something
    • add a exclusion list for those strange buf/filetype

neozoom.lua's People

Contributors

nyngwang avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.