• Stars
    star
    137
  • Rank 256,816 (Top 6 %)
  • Language
    Lua
  • License
    GNU General Publi...
  • Created 6 months ago
  • Updated about 2 months ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Garbage collector that stops inactive LSP clients to free RAM

garbage-day.nvim

Garbage collector that stops inactive LSP clients to free RAM

screenshot_2023-11-08_08-12-12_851558101

Why

In many scenarios, unmanaged LSP clients running on background can take several Gb of RAM. So I wrote this LSP garbage collector for NormalNvim to auto free it. But you can use it on any distro.

How to setup

Add this to lazy

{
  "zeioth/garbage-day.nvim",
  dependencies = "neovim/nvim-lspconfig",
  event = "VeryLazy",
  opts = {
    -- your options here
  }
},

We also support changing opts on execution time like :let g:garbage_day_config['option']='value'

Available options

Name Default Description
aggressive_mode false Set it to true to stop all lsp clients except the current buffer, every time you enter a buffer. aggressive_mode ignores grace_period, and it only triggers when entering a buffer with a different filetype than the current buffer. Ensures the maximum RAM save.
excluded_lsp_clients {"null-ls", "jdtls"} LSP clients that should never be stopped. Useful for LSP clients that miss behave.
grace_period 60*15 Seconds to wait before stopping all LSP clients after neovim loses focus.
wakeup_delay 0 Milliseconds to wait before restoring LSP after the mouse re-enters nvim. Useful to avoid waking up the LSP clients by accident when passing the mouse over it.

Debug options

You can tweak them in case some particular LSP client don't start/stop correctly on your machine.

Name Default Description
aggressive_mode_ignore here Buffers to ignore on aggressive_mode.
notifications false Set it to true to get a notification every time LSP garbage collection triggers.
retries 3 Times to try to start a LSP client before giving up.
timeout 1000 Milliseconds that will take for retries to complete. Example: by default we try 3 retries for 1000ms.

IMPORTANT: If you change the default values, make sure the value of grace_period is always bigger than timeout/1000. This ensures you are leaving enough time between stop_lsp()/start_lsp(), so they don't overlap.

FAQ

  • If it doesn't work This plugin has been tested with neovim 0.9 and 0.10. If you are in a neovim version superior to nvim 0.10, and it doesn't work, please open a issue tagging me and I will fix it.
  • Can I manually trigger garbage collection? Yes, you can do it like
require("garbage-day.utils").stop_lsp()  -- stop all lsp clients.
require("garbage-day.utils").start_lsp() -- start lsp clients for the current buffer.

🌟 Support the project

If you want to help me, please star this repository to increase the visibility of the project.

Stargazers over time

Where do that cheesy name come from?

Other alternatives

Roadmap

  • Once nvim 0.10 is oficially released and we drop 0.9 support, we must replace the deprecated function get_active_clients() by get_clients().

More Repositories

1

compiler.nvim

Neovim compiler for building and running your code without having to configure anything
Lua
348
star
2

markmap.nvim

Visualize your Markdown as mindmaps with markmap
Lua
121
star
3

rofi-shortcuts

The ultimate shortcuts cheatsheet
Shell
51
star
4

rofi-zeal

Use rofi to search documentation on Zeal and Man
Shell
46
star
5

heirline-components.nvim

Distro agnostic components for your Neovim heirline config
Lua
33
star
6

termux-docker

Just a script that setups everything for you
Shell
33
star
7

dooku.nvim

Code documentation generator for Neovim
Lua
28
star
8

XFCE-Wacom-Settings

Wacom settings for XFCE
Shell
24
star
9

django-dual-authentication

Allows authentication with either a username or an email address.
Python
18
star
10

django-email-blacklist

Python class to detect Disposable Emails.
Python
17
star
11

wofi-calc

A simple calculator for wofi, inspired in rofi-calc
Shell
17
star
12

zeioth-hyprland-config

My personal config - Feel free to get ideas from here
Roff
14
star
13

atom-visual-studio-code-ui

The experience of Visual Studio Code, now in Atom.
Less
11
star
14

zeioth-lutris

My contributions to Lutris
10
star
15

makeit.nvim

Neovim Makefile plugin
Lua
10
star
16

atom-visual-studio-code-light-ui

The real experience of Visual Studio Code, now in Atom.
Less
7
star
17

latencyflex2-installer

LatencyFlex2 installer easy to hack
Shell
6
star
18

fzf-kill

Kill -9 with zfz
Shell
3
star
19

zeioth-zmk

My wireless keyboard drivers
C
3
star
20

hyprshotgun

Screenshots the way you like: Local, or online
Shell
3
star
21

vim-doxygen

Doxygen integration for vim
Vim Script
3
star
22

distroupdate.nvim

Neovim plugin to update your current distro from its github remote
Lua
3
star
23

zeioth-qmk

My wired keyboard drivers
C
2
star
24

vim-dooku

(Highly customizable) Documentation generator(s) for VIM
2
star
25

mason-extra-cmds

Provides the command :MasonUpdateAll
Lua
2
star
26

vim-typedoc

Autogenerate and open your typedoc documentation from vim
Vim Script
2
star
27

vim-zeioth-config

One of the best vimconfigs you are gonna find out there. Most likely.
Python
2
star
28

norecaptcha-python3

Python 3 client for Google No CAPTCHA reCAPTCHA services.
Python
2
star
29

new-project.nvim

A neovim plugin to create a new project
2
star
30

idoven-technical-challenge

Challenger: Adrian Lopez
Python
1
star
31

linux-security-notifications

Systemd service that displays important security information as friendly desktop notifications.
1
star
32

IDE.nvim

The bastard son of Neovim, Visual Studio and IntelliJ
1
star
33

package-manager.nvim

A package manager to rule them all.
1
star
34

BrrrOS

The OS that goes like brrr
Python
1
star
35

paco

Aliases to make the most common pacman commands more intuitive.
Shell
1
star
36

basic-programming-principles

Examples for people initiating in coding
Python
1
star