diff --git a/README.md b/README.md index c29fe4f..ad5e9f3 100644 --- a/README.md +++ b/README.md @@ -1,146 +1,159 @@ -# Neovide [![Gitter](https://badges.gitter.im/neovide/community.svg)](https://gitter.im/neovide/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) - -This is a simple graphical user interface for Neovim. Where possible there are some graphical improvements, but it should act -functionally like the terminal UI. - -![Basic Screen Cap](./assets/BasicScreenCap.png) - -I've been using this as my daily driver since November 2019. It should be relatively stable, but I'm still working out some kinks -and ironing out some cross platform issues. In general it should be usable at this point, and if it isn't I consider that a bug and -appreciate a report in the issues! Any help and ideas are also greatly appreciated. - -I'm also very interested in suggestions code quality/style wise when it comes to Rust. I'm pretty new to the language and appreciate -any critiques that you might have to offer. I won't take all of them, but I promise to consider anything you might have to offer. - -## Features - -Should be a standard full features Neovim GUI. Beyond that there are some visual niceties: - -### Ligatures - -Supports ligatures and full [HarfBuzz](https://www.freedesktop.org/wiki/Software/HarfBuzz/) backed font shaping. - -![Ligatures](./assets/Ligatures.png) - -### Animated Cursor - -Cursor animates into position with a smear effect to improve tracking of cursor position. - -![Animated Cursor](./assets/AnimatedCursor.gif) - -### Emoji Support - -Font fallback supports rendering of emoji not contained in the configured font. - -![Emoji](./assets/Emoji.png) - -### Some Nonsense ;) - -``` -let g:neovide_cursor_vfx_mode = "railgun" -``` - -![Railgun](./assets/Railgun.gif) - -### More to Come - -I've got more ideas for simple unobtrusive improvements. More to come. - -## Configuration - -Configuration is done almost completely via global neovide variables in your vim config and can be manipulated live at runtime. Details can be found [here](https://github.com/Kethku/neovide/wiki/Configuration). - -## Install - -Relatively recent binaries can be found in the [project releases](https://github.com/Kethku/neovide/releases). But if you want the latest and greatest you should clone it and build yourself. - -Installing should be as simple as downloading the binary, making sure `nvim.exe` with version 0.4 or greater is on your path, and running it. Everything should be self contained. - -## Building - -Building instructions are somewhat limited at the moment. All the libraries I use are cross platform and should have -support for Windows, Mac, and Linux. The rendering however is Vulkan-based, so driver support for Vulkan will be -necessary. On Windows this should be enabled by default if you have a relatively recent system. - -Note: Neovide requires neovim version 0.4 or greater. - -### Windows - -1. Install the latest version of Rust. I recommend -2. Install CMake. I use chocolatey: `choco install cmake --installargs '"ADD_CMAKE_TO_PATH=System"' -y` -3. Install LLVM. I use chocolatey: `choco install llvm -y` -4. Ensure graphics libraries are up to date. -5. `git clone https://github.com/Kethku/neovide` -6. `cd neovide` -7. `cargo build --release` -8. Copy `./target/release/neovide.exe` to a known location and enjoy. - -### Mac - -1. Install the latest version of Rust. I recommend -2. Install CMake. Using homebrew: `brew install cmake` -3. Install the Vulkan SDK. I'm told `brew cask install apenngrace/vulkan/vulkan-sdk` works, but I can't test locally to find out. -4. `git clone https://github.com/Kethku/neovide` -5. `cd neovide` -6. `cargo build --release` -7. Copy `./target/release/neovide` to a known location and enjoy. - -Note: If you run into issues with the vulkan libraries being reported as not verified, this issue thread may help: https://github.com/Kethku/neovide/issues/167#issuecomment-593314579 - -### Linux - -#### Arch Linux - -There is an [AUR package for neovide](https://aur.archlinux.org/packages/neovide-git/). - -```sh -git clone https://aur.archlinux.org/neovide-git.git -cd neovide -makepkg -si -``` - -#### Debian/Ubuntu - -Note: Neovide has been successfully built on other destros but this reportedly works on ubuntu. - -1. Install necessary dependencies - - ```sh - sudo apt-get install -y curl \ - gnupg ca-certificates git \ - gcc-multilib g++-multilib cmake libssl-dev pkg-config \ - libfreetype6-dev libasound2-dev libexpat1-dev libxcb-composite0-dev \ - libbz2-dev libsndio-dev freeglut3-dev libxmu-dev libxi-dev - ``` - -2. Install Vulkan SDK - - ```sh - curl -sL "http://packages.lunarg.com/lunarg-signing-key-pub.asc" | sudo apt-key add - - sudo curl -sLo "/etc/apt/sources.list.d/lunarg-vulkan-1.2.131-bionic.list" "http://packages.lunarg.com/vulkan/1.2.131/lunarg-vulkan-1.2.131-bionic.list" - sudo apt-get update -y - sudo apt-get install -y vulkan-sdk - ``` - - Alternatively if you are running an amd graphics card you may have more success by installing amdvlk. - https://github.com/Kethku/neovide/issues/209 - -3. Install Rust - - `curl --proto '=https' --tlsv1.2 -sSf "https://sh.rustup.rs" | sh` - -4. Clone the repository - - `git clone "https://github.com/Kethku/neovide"` - -5. Build - - `cd neovide && ~/.cargo/bin/cargo build --release` - -6. Copy `./target/release/neovide` to a known location and enjoy. - -If you see an error complaining about DRI3 settings, links in this issue may help: -. - -Note: If you run into libsndio errors, try building without default features which will disable static linking of the SDL -library. +# Neovide [![Gitter](https://badges.gitter.im/neovide/community.svg)](https://gitter.im/neovide/community?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge) + +This is a simple graphical user interface for Neovim. Where possible there are some graphical improvements, but it should act +functionally like the terminal UI. + +![Basic Screen Cap](./assets/BasicScreenCap.png) + +I've been using this as my daily driver since November 2019. It should be relatively stable, but I'm still working out some kinks +and ironing out some cross platform issues. In general it should be usable at this point, and if it isn't I consider that a bug and +appreciate a report in the issues! Any help and ideas are also greatly appreciated. + +I'm also very interested in suggestions code quality/style wise when it comes to Rust. I'm pretty new to the language and appreciate +any critiques that you might have to offer. I won't take all of them, but I promise to consider anything you might have to offer. + +## Features + +Should be a standard full features Neovim GUI. Beyond that there are some visual niceties: + +### Ligatures + +Supports ligatures and full [HarfBuzz](https://www.freedesktop.org/wiki/Software/HarfBuzz/) backed font shaping. + +![Ligatures](./assets/Ligatures.png) + +### Animated Cursor + +Cursor animates into position with a smear effect to improve tracking of cursor position. + +![Animated Cursor](./assets/AnimatedCursor.gif) + +### Animated Windows + +Windows animate into position when they are moved making it easier to see how layout changes happen. + +![Animated Windows](./assets/AnimatedWindows.gif) + +### Blurred Floating Windows + +The backgrounds of floating windows are blurred improving the visual separation between foreground and background from +built in window transparency. + +![Blurred Floating Windows](./assets/BlurredFloatingWindows.png) + +### Emoji Support + +Font fallback supports rendering of emoji not contained in the configured font. + +![Emoji](./assets/Emoji.png) + +### Some Nonsense ;) + +``` +let g:neovide_cursor_vfx_mode = "railgun" +``` + +![Railgun](./assets/Railgun.gif) + +### More to Come + +I've got more ideas for simple unobtrusive improvements. More to come. + +## Configuration + +Configuration is done almost completely via global neovide variables in your vim config and can be manipulated live at runtime. Details can be found [here](https://github.com/Kethku/neovide/wiki/Configuration). + +## Install + +Relatively recent binaries can be found in the [project releases](https://github.com/Kethku/neovide/releases). But if you want the latest and greatest you should clone it and build yourself. + +Installing should be as simple as downloading the binary, making sure `nvim.exe` with version 0.4 or greater is on your path, and running it. Everything should be self contained. + +## Building + +Building instructions are somewhat limited at the moment. All the libraries I use are cross platform and should have +support for Windows, Mac, and Linux. The rendering however is Vulkan-based, so driver support for Vulkan will be +necessary. On Windows this should be enabled by default if you have a relatively recent system. + +Note: Neovide requires neovim version 0.4 or greater. + +### Windows + +1. Install the latest version of Rust. I recommend +2. Install CMake. I use chocolatey: `choco install cmake --installargs '"ADD_CMAKE_TO_PATH=System"' -y` +3. Install LLVM. I use chocolatey: `choco install llvm -y` +4. Ensure graphics libraries are up to date. +5. `git clone https://github.com/Kethku/neovide` +6. `cd neovide` +7. `cargo build --release` +8. Copy `./target/release/neovide.exe` to a known location and enjoy. + +### Mac + +1. Install the latest version of Rust. I recommend +2. Install CMake. Using homebrew: `brew install cmake` +3. Install the Vulkan SDK. I'm told `brew cask install apenngrace/vulkan/vulkan-sdk` works, but I can't test locally to find out. +4. `git clone https://github.com/Kethku/neovide` +5. `cd neovide` +6. `cargo build --release` +7. Copy `./target/release/neovide` to a known location and enjoy. + +Note: If you run into issues with the vulkan libraries being reported as not verified, this issue thread may help: https://github.com/Kethku/neovide/issues/167#issuecomment-593314579 + +### Linux + +#### Arch Linux + +There is an [AUR package for neovide](https://aur.archlinux.org/packages/neovide-git/). + +```sh +git clone https://aur.archlinux.org/neovide-git.git +cd neovide +makepkg -si +``` + +#### Debian/Ubuntu + +Note: Neovide has been successfully built on other destros but this reportedly works on ubuntu. + +1. Install necessary dependencies + + ```sh + sudo apt-get install -y curl \ + gnupg ca-certificates git \ + gcc-multilib g++-multilib cmake libssl-dev pkg-config \ + libfreetype6-dev libasound2-dev libexpat1-dev libxcb-composite0-dev \ + libbz2-dev libsndio-dev freeglut3-dev libxmu-dev libxi-dev + ``` + +2. Install Vulkan SDK + + ```sh + curl -sL "http://packages.lunarg.com/lunarg-signing-key-pub.asc" | sudo apt-key add - + sudo curl -sLo "/etc/apt/sources.list.d/lunarg-vulkan-1.2.131-bionic.list" "http://packages.lunarg.com/vulkan/1.2.131/lunarg-vulkan-1.2.131-bionic.list" + sudo apt-get update -y + sudo apt-get install -y vulkan-sdk + ``` + + Alternatively if you are running an amd graphics card you may have more success by installing amdvlk. + https://github.com/Kethku/neovide/issues/209 + +3. Install Rust + + `curl --proto '=https' --tlsv1.2 -sSf "https://sh.rustup.rs" | sh` + +4. Clone the repository + + `git clone "https://github.com/Kethku/neovide"` + +5. Build + + `cd neovide && ~/.cargo/bin/cargo build --release` + +6. Copy `./target/release/neovide` to a known location and enjoy. + +If you see an error complaining about DRI3 settings, links in this issue may help: +. + +Note: If you run into libsndio errors, try building without default features which will disable static linking of the SDL +library. diff --git a/assets/AnimatedWindows.gif b/assets/AnimatedWindows.gif new file mode 100644 index 0000000..32a948a Binary files /dev/null and b/assets/AnimatedWindows.gif differ diff --git a/assets/BlurredFloatingWindows.png b/assets/BlurredFloatingWindows.png new file mode 100644 index 0000000..f441125 Binary files /dev/null and b/assets/BlurredFloatingWindows.png differ diff --git a/src/renderer/mod.rs b/src/renderer/mod.rs index 4246b16..7718e4e 100644 --- a/src/renderer/mod.rs +++ b/src/renderer/mod.rs @@ -1,335 +1,335 @@ -use std::collections::HashMap; -use std::sync::mpsc::Receiver; -use std::sync::Arc; - -use log::{error, trace, warn}; -use skulpin::skia_safe::{colors, dash_path_effect, BlendMode, Canvas, Color, Paint, Rect}; -use skulpin::CoordinateSystemHelper; - -pub mod animation_utils; -mod caching_shaper; -pub mod cursor_renderer; -pub mod font_options; -mod rendered_window; - -pub use caching_shaper::CachingShaper; -pub use font_options::*; -pub use rendered_window::{RenderedWindow, WindowDrawDetails}; - -use crate::editor::{Colors, DrawCommand, Style, WindowDrawCommand}; -use crate::settings::*; -use cursor_renderer::CursorRenderer; - -// ---------------------------------------------------------------------------- - -#[derive(Clone)] -pub struct RendererSettings { - animation_length: f32, - floating_opacity: f32, - floating_blur: bool, -} - -pub fn initialize_settings() { - SETTINGS.set(&RendererSettings { - animation_length: 0.15, - floating_opacity: 0.7, - floating_blur: true, - }); - - register_nvim_setting!( - "window_animation_length", - RendererSettings::animation_length - ); - register_nvim_setting!( - "floating_window_opacity", - RendererSettings::floating_opacity - ); - register_nvim_setting!("floating_window_blur", RendererSettings::floating_blur); -} - -// ---------------------------------------------------------------------------- - -pub struct Renderer { - rendered_windows: HashMap, - cursor_renderer: CursorRenderer, - - pub paint: Paint, - pub shaper: CachingShaper, - pub default_style: Arc