Coder Social home page Coder Social logo

popui.nvim's Introduction

Logo

popui.nvim

NeoVim UI sweetness.

What's popui all about?

It's a tiny (currently 584 LoC) UI suite designed to make your NeoVim workflow faster. It currently consists of four components:

  • ui-overrider: alternative to NeoVim's default vim.ui.select menu
  • input-overrider: alternative to NeoVim's default vim.ui.input prompt
  • diagnostics-navigator: utility to quickly navigate and jump to LSP diagnostics issues in the current buffer
  • marks-manager: utility to quickly navigate, jump to or remove (permanently!) uppercase marks
  • references-navigator: utility to quickly navigate and jump to project-wide references to the symbol under the cursor

See it in action below:


Code action menu popup

Snapshot #1

Variable renaming input popup

Snapshot #2

Diagnostics navigator

(Displays all diagnostic messages for the current buffer. Press `Cr` to jump to the currently highlighted diagnostic coordinates.)

Snapshot #3

Marks manager

(Displays all uppercase marks. Press `Cr` to navigate to a mark's position, press `x` or `d` to permanently delete a mark.)

Snapshot #4

References navigator

(Displays all found references, Press `Cr` to navigate to the reference's position)

Snapshot #5

Installation

" Using vim-plug
Plug 'hood/popui.nvim'

" Using Vundle
Plugin 'hood/popui.nvim'

Setup

vim.ui.select = require"popui.ui-overrider"
vim.ui.input = require"popui.input-overrider"
vim.api.nvim_set_keymap("n", ",d", ':lua require"popui.diagnostics-navigator"()<CR>', { noremap = true, silent = true }) 
vim.api.nvim_set_keymap("n", ",m", ':lua require"popui.marks-manager"()<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap("n", ",r", ':lua require"popui.references-navigator"()<CR>', { noremap = true, silent = true })

Customize border style

" Available styles: "sharp" | "rounded" | "double"
let g:popui_border_style = "double"

Customize highlight groups

hi PopuiCoordinates guifg=#6A1010 ctermfg=Red
hi PopuiDiagnosticsCodes guifg=#777777 ctermfg=Gray

Dependencies

  • No dependencies baby!

popui.nvim's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

popui.nvim's Issues

Behavior on <ESC> or <Ctrl-C>

When the popup menu is open, both<Ctrl-C> and should cancel and exit the menu immediately.

Currently, <Ctrl-C> does nothing, and <Esc> does not exit the menu immediately (only after timeout) when there are other mappings that is prefixed by <Esc>.

Popup for Variable Renaming (vim.ui.input)

Thanks for this. It works great when running code actions. Is there any way this can be expanded to include renaming variables? I believe this is the vim.ui.input API.

CodeAction seems broken

Hello,

I use NvChad with Popui everything works fine except code_action and diagnostics.

Screenshot 2022-11-03 at 11 58 23

How can I debug this ?

Error about window being too small?

Generally popui works fine with all my files and I am happy about it!
In my .tex document however, where I have >100 warnings (chktex linting is very sensitive) I get the following error:

E5108: Error executing lua .../.local/share/nvim/plugged/popui.nvim/lua/popui/core.lua:54: unable to create the config, your window is too
small, please zoom out
stack traceback:

[C]: in function 'error'                                          .../.local/share/nvim/plugged/popui.nvim/lua/popui/core.lua:54: in function 'validatePopupSize'                                            .../.local/share/nvim/plugged/popui.nvim/lua/popui/core.lua:71: in function 'getListWindowConfiguration'                          .../.local/share/nvim/plugged/popui.nvim/lua/popui/core.lua:399: in function 'spawnListPopup'                                                ...m/plugged/popui.nvim/lua/popui/diagnostics-navigator.lua:11: in function <...m/plugged/popui.nvim/lua/popui/diagnostics-navigator.lua:3> [string ":lua"]:1: in main chunk

Zooming out with + + "-" does not help.
Any suggestions besides having less warnings?

no response on popui.diagnostics-navigator

Hi,

I am very curious about this plugin, but can't get it to work. Running NeoVide on Windows. When typing:

:lua require'popui.diagnostics-navigator'()

-- nothing happens. (Not even an error?).

The plug is installed, I have the following lines inside the lua section of my vimrc:

  vim.ui.select = require"popui.ui-overrider"
  vim.ui.input = require"popui.input-overrider"

Thanks!

Unable to open diagnostics navigator again

Hello! Thanks for your plugin.

I had some break so I guess it is not caused by any new commits.
When I try to call require('pop.diagnostics-navigator')() I'm getting this error:

Screenshot 2022-07-03 at 12 29 58

Error: 'replacement string' items contain newlines

When the list of choices have a title with multiple lines I get this error and the items in the popui window turn not selectable.

Particularly, haskell-language-server pops up the following (yet stupid) choice when some dependencies are missing:

Failed to find the GHC version of this Cabal project.
Error when calling cabal exec -v0 -- ghc --print-libdir:
1: Try to restart
Type number and <Enter> or click with the mouse (q or empty cancels):

Note the two lines before the choice.

The following patch fixes the issue for me:

diff --git a/lua/popui/core.lua b/lua/popui/core.lua
index 246f766..c36b527 100644
--- a/lua/popui/core.lua
+++ b/lua/popui/core.lua
@@ -377,6 +377,8 @@ function Core:spawnListPopup(
 )
     local popupBufferNumber = self:createBuffer()
 
+    windowTitle = windowTitle:gsub("\n", " ")
+
     -- Create the popup, calculating its size based on the entries.
     local popupWindowId = self:createWindow(
         popupBufferNumber,
@@ -428,6 +430,8 @@ function Core:spawnInputPopup(
 )
     local popupBufferNumber = self:createBuffer()
 
+    windowTitle = windowTitle:gsub("\n", " ")
+
     -- Create the popup, calculating its size based on the entries.
     local popupWindowId = self:createWindow(
         popupBufferNumber,

There is another (seemingly unrelated) issue after applying the patch. The two string concatenates well but the tail gets lost, it prints only Failed to find the GHC version of this Cabal project. Error when calling cabal exec -v0 -- ghc --print, i.e. the -libdir: part was lost. This is something related to math: when I have replaced + 4 by +6 in getWindowConfiguration(), the title was printed completely.

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.