GithubHelp home page GithubHelp logo

neophyte's Introduction

Neophyte

Crates.io Version

Neophyte is a Neovim GUI rendered with WebGPU and written in Rust. It offers several niceties over the default terminal-based UI:

  • Text shaping and rasterization by Swash, providing high-quality font rendering features such as ligatures, fallback fonts, and emoji
  • Smooth scrolling
  • Cursor animations
  • Pixel-level window positioning
demo.mp4

Installation

Neophyte currently works best on MacOS and Linux. It also requires a compatible graphics driver, namely Vulkan, Metal, or DX12. Linux targets require the fontconfig library. Installing from Crates.io or Git requires the Rust toolchain.

Crates.io

cargo install neophyte

Git

git clone --recurse-submodules https://github.com/tim-harding/neophyte
cd neophyte
cargo build --release

The binary will be target/release/neophyte.

Releases

Prebuilt binaries are available in the releases.

Packages

AUR

neophyte

Builds from source hosted on Crates.io.

yay -S neophyte
neophyte-git

Builds from the latest tagged release on GitHub.

yay -S neophyte-git
neophyte-bin

Installs the latest binary release artifacts from GitHub.

yay -S neophyte-bin

Configuration

Scripting

Neophyte is scriptable with Lua. The API is LuaLS type-annotated for discoverability.

-- lazy.nvim example:
{
  'tim-harding/neophyte',
  tag = '0.2.5',
  event = 'VeryLazy',
  opts = {
    -- Same as neophyte.setup({ ... })
  },
}

-- API usage example:
local neophyte = require('neophyte')
neophyte.setup({
  fonts = {
    {
      name = 'Cascadia Code PL',
      features = {
        {
          name = 'calt',
          value = 1,
        },
        -- Shorthand to set a feature to 1
        'ss01', 
        'ss02',
      },
    },
    -- Fallback fonts 
    {
      name = 'Monaspace Argon Var',
      -- Variable font axes
      variations = {
        {
          name = 'slnt',
          value = -11,
        },
      },
    },
    -- Shorthand for no features or variations
    'Symbols Nerd Font',
    'Noto Color Emoji',
  },
  font_size = {
    kind = 'width', -- 'width' | 'height'
    size = 10,
  },
  -- Multipliers of the base animation speed.
  -- To disable animations, set these to large values like 1000.
  cursor_speed = 2,
  scroll_speed = 2,
  -- Increase or decrease the distance from the baseline for underlines.
  underline_offset = 1,
  -- For transparent window effects, use this to set the default background color. 
  -- This is because most colorschemes in transparent mode unset the background,
  -- which normally defaults to the terminal background, but we don't have that here. 
  -- You must also pass --transparent as a command-line argument to see the effect.
  -- Channel values are in the range 0-255. 
  bg_override = {
    r = 48,
    g = 52,
    b = 70,
    a = 128,
  },
})

-- Alternatively, the guifont option is supported:
vim.opt.guifont = 'Cascadia Code PL:w10, Symbols Nerd Font, Noto Color Emoji'

-- There are also freestanding functions to set these options as desired:

-- Increase font size
vim.keymap.set('n', '<c-+>', function()
  neophyte.set_font_width(neophyte.get_font_width() + 1)
end)

-- Decrease font size
vim.keymap.set('n', '<c-->', function()
  neophyte.set_font_width(neophyte.get_font_width() - 1)
end)

-- Use cmd-ctrl-f to toggle fullsreen on MacOS
if this_os:find('Darwin') then
  vim.keymap.set('n', '<DC-f>', function()
    neophyte.set_fullscreen(not neophyte.get_fullscreen())
  end)
end

-- Neophyte can also record frames to a PNG sequence.
-- You can convert to a video with ffmpeg:
--
-- ffmpeg -framerate 60 -pattern_type glob -i '/my/frames/location/*.png' 
-- -pix_fmt yuv420p -c:v libx264 -vf 
-- "colorspace=all=bt709:iprimaries=bt709:itrc=srgb:ispace=bt709:range=tv:irange=pc"  
-- -color_range 1 -colorspace 1 -color_primaries 1 -crf 23 -y /my/output/video.mp4
neophyte.start_render('/directory/to/output/frames/')
neophyte.end_render()

Noice

I recommend using Neophyte with Noice for best results, unless you choose to disable cursor animations. This is because Noice externalizes several UI features such that Neovim cedes responsibility for rendering them, namely the cmdline and messages. Without this, the cursor tends to jump around in a way that is jarring when combined with animations. Eventually we may support externalizing these UI elements without a plugin (this is already partially implemented), but in the meantime, Noice is the best option. If you want to try Noice without opting in to popup notifications or the popup cmdline, you can try these settings:

-- lazy.nvim
{
  'folke/noice.nvim',
  event = 'VeryLazy',
  opts = {
    presets = {
      bottom_search = true,
      command_palette = true,
      long_message_to_split = true,
    },
    lsp = {
      message = {
        view = 'mini',
      },
    },
    messages = {
      view = 'mini',
      view_search = false,
    },
    cmdline = {
      view = 'cmdline',
    },
  },
  dependencies = {
    'MunifTanjim/nui.nvim',
  },
}

neophyte's People

Contributors

tim-harding avatar

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

Forkers

neonvim

neophyte's Issues

Ui::grid_under_cursor(): called `Option::unwrap()` on a `None` value

Neophyte panics on startup:

thread 'main' panicked at <snip>/neophyte-0.2.3/src/ui/mod.rs:447:50:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

That's this line on main branch. Seems like just replacing the unwrap with ? makes it work, but there's probably a bigger underlying issue.

I'm on Arch Linux, i3wm using picom. My nvim config is based on LazyVim.

[question] Pixel-precise scrolling

Hi! I was about to start building my own wgpu-based frontend for neovim, when I found this repo. Cool! My motivation was lack of smooth scrolling (I mean something like emacs GUI pixel-precise scroll) and better keyboard bindings handling. And I see you already implemented smooth scrolling. But it looks like kind of interpolation for vim's line based scrolling. Given that you have experience with it, I'd like to ask your opinion on implementing pixel-precise scrolling. My idea was using scroll delta to shift text lines to additional pixels, so you could scroll by pixels using delta and when it's more than a line height, it would send a scroll event to the neovim. Do you think, would it be possible in a practical way? And if so, could you point me to related code parts in your repo, so I could try it out on my fork? If you're interested, and I'd had any luck with it, I could contribute this feature back in the repo:) Otherwise, I'd just use it as a fork. Thanks!

Oversized metrics for some fonts

When trying to launch neophyte i get a blank window and the following output in stdout

WARN [sctk_adwaita::buttons] Ignoring unknown button type:
INFO [neophyte::neovim] Calling method nvim_ui_attach
INFO [neophyte::neovim::stdout_thread] RPC response to 0: Nil
INFO [wgpu_hal::vulkan::instance] Debug utils not enabled: debug_utils_user_data not passed to Instance::from_raw
INFO [wgpu_core::instance] Adapter Vulkan AdapterInfo { name: "Intel(R) Graphics (ADL GT2)", vendor: 32902, device: 18086, device_type: IntegratedGpu, driver: "Intel open-source Mesa driver", driver_info: "Mesa 23.2.1-1ubuntu3.1", backend: Vulkan }
INFO [neophyte::event_handler] Got resize: PhysicalSize { width: 800, height: 600 }
INFO [neophyte::neovim] Calling method nvim_ui_try_resize_grid
ERROR [neophyte::event_handler] Unknown event: chdir
ERROR [neophyte::event_handler] Unknown event: chdir
ERROR [neophyte::event_handler] Unknown event: chdir
INFO [neophyte::neovim::stdout_thread] RPC response to 1: Nil

For some reason the issue is not triggered when passing --clean to the neovim instance. When running :source ~/.config/nvim/init.lua after launching with --clean, the window freezes for several seconds, outputting the error log repeatedly, but eventually recovers.

I have yet to make a minimal config which will trigger this issue

I'm using nightly neovim, version 202402192105 on Ubuntu 23.10

File explorer are not visible

Hey, I have an issue with floating file-explorer in my case, nvim-tree. See the video:
The left side is neophyte, and the right side is my tmux alacritty.
Seams inner width is wider then the main window

Screencast.from.2024-01-12.12-31-59.webm

Panic on startup in src/text/fonts.rs

Attempting to run neophyte fails with the following panic message

thread 'main' panicked at src/text/fonts.rs:100:14:
called `Option::unwrap()` on a `None` value
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

After cursory testing this appears to happen on both nightly and stable neovim, both with fonts fully configured via the lua plugin, and with an entirely clean configuration, on both NixOS 23.11 and Ubuntu 23.10.

[Bug] Lazygit color syntax is not shown

First of all, congratulations on your project. I am sure it will be very successful, I already prefer it to other GUIs that have long been developed.

I wanted to report a bug, when I start Lazygit within Neovim, it seems that the color syntax is turned off (you can't see the colors):

immagine

It can be replicated easily using the LazyVim distribution in basic mode, on Windows 10.

This problem is not present if I use other GUIs.

Failed to get a graphics device

Hi,

I wanted to give this a try, but I wasn't able to start it. I tried both release and cargo package.
This is what I get when I try to start it (full backtrace):

╰─ RUST_BACKTRACE=full neophyte                                                                                                                                                                                                              ─╯
thread 'main' panicked at /home/kristijan/.cargo/registry/src/index.crates.io-6f17d22bba15001f/neophyte-0.2.0/src/rendering/state.rs:78:10:
Failed to get a graphics device: RequestDeviceError { inner: Core(UnsupportedFeature(Features(TEXTURE_BINDING_ARRAY | SAMPLED_TEXTURE_AND_STORAGE_BUFFER_ARRAY_NON_UNIFORM_INDEXING | UNIFORM_BUFFER_AND_STORAGE_TEXTURE_ARRAY_NON_UNIFORM_INDEXING))) }
stack backtrace:
   0:     0x563e70bd4cac - std::backtrace_rs::backtrace::libunwind::trace::he0644f4189ae2429
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/../../backtrace/src/backtrace/libunwind.rs:104:5
   1:     0x563e70bd4cac - std::backtrace_rs::backtrace::trace_unsynchronized::h9d17fc782d3b981a
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/../../backtrace/src/backtrace/mod.rs:66:5
   2:     0x563e70bd4cac - std::sys_common::backtrace::_print_fmt::hb438557330fe04dd
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/sys_common/backtrace.rs:67:5
   3:     0x563e70bd4cac - <std::sys_common::backtrace::_print::DisplayBacktrace as core::fmt::Display>::fmt::hfbaa40019107bf73
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/sys_common/backtrace.rs:44:22
   4:     0x563e70c00bc0 - core::fmt::rt::Argument::fmt::hb051b4144eaf7ba9
                               at /build/rust/src/rustc-1.75.0-src/library/core/src/fmt/rt.rs:142:9
   5:     0x563e70c00bc0 - core::fmt::write::h09ae4ee704823005
                               at /build/rust/src/rustc-1.75.0-src/library/core/src/fmt/mod.rs:1120:17
   6:     0x563e70bd13cd - std::io::Write::write_fmt::h2f754c40a62d69e7
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/io/mod.rs:1762:15
   7:     0x563e70bd4a95 - std::sys_common::backtrace::_print::h5aa33cefb716154f
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/sys_common/backtrace.rs:47:5
   8:     0x563e70bd4a95 - std::sys_common::backtrace::print::hba7db713d2ca6e46
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/sys_common/backtrace.rs:34:9
   9:     0x563e70bd60a3 - std::panicking::default_hook::{{closure}}::hdecc168c96eda73a
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/panicking.rs:272:22
  10:     0x563e70bd5dda - std::panicking::default_hook::h094baec9e5d8cab2
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/panicking.rs:292:9
  11:     0x563e70bd65d5 - std::panicking::rust_panic_with_hook::h1d7664437b07c6b2
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/panicking.rs:779:13
  12:     0x563e70bd64be - std::panicking::begin_panic_handler::{{closure}}::hcf3241a5a930cf68
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/panicking.rs:657:13
  13:     0x563e70bd5166 - std::sys_common::backtrace::__rust_end_short_backtrace::h5bffafd462cab801
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/sys_common/backtrace.rs:170:18
  14:     0x563e70bd6242 - rust_begin_unwind
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/panicking.rs:645:5
  15:     0x563e705d7605 - core::panicking::panic_fmt::h45860aff82e9ff99
                               at /build/rust/src/rustc-1.75.0-src/library/core/src/panicking.rs:72:14
  16:     0x563e705d7b43 - core::result::unwrap_failed::hd6cf52f00ee4ec6e
                               at /build/rust/src/rustc-1.75.0-src/library/core/src/result.rs:1653:5
  17:     0x563e70639ee5 - pollster::block_on::hd4b57c88dedc9ea4
  18:     0x563e70612323 - neophyte::event_handler::EventHandler::new::hb7244517bbb8b1cf
  19:     0x563e7066a9c6 - neophyte::main::hd757d3c298408d84
  20:     0x563e70642f93 - std::sys_common::backtrace::__rust_begin_short_backtrace::h1e8d254adb1e8910
  21:     0x563e70689c99 - std::rt::lang_start::{{closure}}::h4af22b246a612d39
  22:     0x563e70bca3ad - core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once::h6e58cd4b3aa0cedc
                               at /build/rust/src/rustc-1.75.0-src/library/core/src/ops/function.rs:284:13
  23:     0x563e70bca3ad - std::panicking::try::do_call::h1d63a6ddcddbf3d7
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/panicking.rs:552:40
  24:     0x563e70bca3ad - std::panicking::try::ha98263394816949f
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/panicking.rs:516:19
  25:     0x563e70bca3ad - std::panic::catch_unwind::hc08a17c58416f4cc
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/panic.rs:142:14
  26:     0x563e70bca3ad - std::rt::lang_start_internal::{{closure}}::h8a6385fe0d26a9d5
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/rt.rs:148:48
  27:     0x563e70bca3ad - std::panicking::try::do_call::h6b4548ddcceb66f1
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/panicking.rs:552:40
  28:     0x563e70bca3ad - std::panicking::try::ha4d76d1974f7f45a
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/panicking.rs:516:19
  29:     0x563e70bca3ad - std::panic::catch_unwind::h691bb3d050a579da
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/panic.rs:142:14
  30:     0x563e70bca3ad - std::rt::lang_start_internal::h1630c9ed041f86ee
                               at /build/rust/src/rustc-1.75.0-src/library/std/src/rt.rs:148:20
  31:     0x563e70689c8e - std::rt::lang_start::heafb588b959a170b
  32:     0x7fabfd4b2cd0 - <unknown>
  33:     0x7fabfd4b2d8a - __libc_start_main
  34:     0x563e705d7e45 - _start
  35:                0x0 - <unknown>

System: Arch Linux
Kernel: 6.6.10-arch1-1
Graphic card: AMD Radeon RX 580. Here's the output of lspci -v for VGA:

01:00.0 VGA compatible controller: Advanced Micro Devices, Inc. [AMD/ATI] Ellesmere [Radeon RX 470/480/570/570X/580/580X/590] (rev e7) (prog-if 00 [VGA controller])
	Subsystem: Gigabyte Technology Co., Ltd Ellesmere [Radeon RX 470/480/570/570X/580/580X/590]
	Flags: bus master, fast devsel, latency 0, IRQ 148
	Memory at 40000000 (64-bit, prefetchable) [size=256M]
	Memory at 50000000 (64-bit, prefetchable) [size=2M]
	I/O ports at 3000 [size=256]
	Memory at 50400000 (32-bit, non-prefetchable) [size=256K]
	Expansion ROM at 000c0000 [disabled] [size=128K]
	Capabilities: [48] Vendor Specific Information: Len=08 <?>
	Capabilities: [50] Power Management version 3
	Capabilities: [58] Express Legacy Endpoint, MSI 00
	Capabilities: [a0] MSI: Enable+ Count=1/1 Maskable- 64bit+
	Capabilities: [100] Vendor Specific Information: ID=0001 Rev=1 Len=010 <?>
	Capabilities: [150] Advanced Error Reporting
	Capabilities: [200] Physical Resizable BAR
	Capabilities: [270] Secondary PCI Express
	Capabilities: [2b0] Address Translation Service (ATS)
	Capabilities: [2c0] Page Request Interface (PRI)
	Capabilities: [2d0] Process Address Space ID (PASID)
	Capabilities: [320] Latency Tolerance Reporting
	Capabilities: [328] Alternative Routing-ID Interpretation (ARI)
	Capabilities: [370] L1 PM Substates
	Kernel driver in use: amdgpu
	Kernel modules: amdgpu

Neophyte rendering issue

after opening the neophyte, I ended up with this screen
My config is basic; I installed the plugin and pasted the default config in the opts table.

Screencast.from.2024-01-14.19-55-08.webm

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.