• Stars
    star
    411
  • Rank 104,759 (Top 3 %)
  • Language
    Lua
  • License
    MIT License
  • Created over 3 years ago
  • Updated 3 months ago

Reviews

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

Repository Details

The neovim language-server-client UI

lspsaga.nvim

A maintained fork of glepnir/lspsaga.nvim.

Lspsaga is light-weight lsp plugin based on neovim built-in lsp with highly a performant UI. SEE IN ACTION

Features

TODO .......

Install

Packer

use { 'kkharji/lspsaga.nvim' }  -- nightly
use { 'kkharji/lspsaga.nvim', branch = 'nvim6.0' or 'nvim51' } -- for specific version

Requirements

  • neovim/nvim-lspconfig

Setup

Lspsaga support use command Lspsaga with completion or use lua function.

local lspsaga = require 'lspsaga'
lspsaga.setup { -- defaults ...
  debug = false,
  use_saga_diagnostic_sign = true,
  -- diagnostic sign
  error_sign = "ο™™",
  warn_sign = "ο”©",
  hint_sign = "ο ΅",
  infor_sign = "",
  diagnostic_header_icon = " ο†ˆ  ",
  -- code action title icon
  code_action_icon = "ο ΄ ",
  code_action_prompt = {
    enable = true,
    sign = true,
    sign_priority = 40,
    virtual_text = true,
  },
  finder_definition_icon = "οŒ‘  ",
  finder_reference_icon = "οŒ‘  ",
  max_preview_lines = 10,
  finder_action_keys = {
    open = "o",
    vsplit = "s",
    split = "i",
    quit = "q",
    scroll_down = "<C-f>",
    scroll_up = "<C-b>",
  },
  code_action_keys = {
    quit = "q",
    exec = "<CR>",
  },
  rename_action_keys = {
    quit = "<C-c>",
    exec = "<CR>",
  },
  definition_preview_icon = "ο”Έ  ",
  border_style = "single",
  rename_prompt_prefix = "➀",
  rename_output_qflist = {
    enable = false,
    auto_open_qflist = false,
  },
  server_filetype_map = {},
  diagnostic_prefix_format = "%d. ",
  diagnostic_message_format = "%m %c",
  highlight_prefix = false,
}

Example Keymapings

--- In lsp attach function
local map = vim.api.nvim_buf_set_keymap
map(0, "n", "gr", "<cmd>Lspsaga rename<cr>", {silent = true, noremap = true})
map(0, "n", "gx", "<cmd>Lspsaga code_action<cr>", {silent = true, noremap = true})
map(0, "x", "gx", ":<c-u>Lspsaga range_code_action<cr>", {silent = true, noremap = true})
map(0, "n", "K",  "<cmd>Lspsaga hover_doc<cr>", {silent = true, noremap = true})
map(0, "n", "go", "<cmd>Lspsaga show_line_diagnostics<cr>", {silent = true, noremap = true})
map(0, "n", "gj", "<cmd>Lspsaga diagnostic_jump_next<cr>", {silent = true, noremap = true})
map(0, "n", "gk", "<cmd>Lspsaga diagnostic_jump_prev<cr>", {silent = true, noremap = true})
map(0, "n", "<C-u>", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(-1, '<c-u>')<cr>", {})
map(0, "n", "<C-d>", "<cmd>lua require('lspsaga.action').smart_scroll_with_saga(1, '<c-d>')<cr>", {})

Customize Appearance

Colors

Colors can be simply changed by overwriting the default highlights groups LspSaga is using.

highlight link LspSagaFinderSelection Search
" or
highlight link LspSagaFinderSelection guifg='#ff0000' guibg='#00ff00' gui='bold'

The available highlight groups are:

Group Name Description
LspSagaFinderSelection Currently active entry in the finder window that gets previewed.
LspFloatWinNormal
LspFloatWinBorder
LspSagaBorderTitle
TargetWord
ReferencesCount
DefinitionCount
TargetFileName
DefinitionIcon
ReferencesIcon
ProviderTruncateLine
SagaShadow
LspSagaFinderSelection
DiagnosticTruncateLine
DiagnosticError
DiagnosticWarning
DiagnosticInformation
DiagnosticHint
DefinitionPreviewTitle
LspSagaShTruncateLine
LspSagaDocTruncateLine
LineDiagTuncateLine
LspSagaCodeActionTitle
LspSagaCodeActionTruncateLine
LspSagaCodeActionContent
LspSagaRenamePromptPrefix
LspSagaRenameBorder
LspSagaHoverBorder
LspSagaSignatureHelpBorder
LspSagaCodeActionBorder
LspSagaAutoPreview
LspSagaDefPreviewBorder
LspLinesDiagBorder

Filetypes

Autocmds can be added for dedicated filetypes of LspSaga floating windows. For example, one can use <Esc> to close the hover window when jumping into it by calling :Lspsaga hover_doc twice.

augroup lspsaga_filetypes
  autocmd!
  autocmd FileType LspsagaHover nnoremap <buffer><nowait><silent> <Esc> <cmd>close!<cr>
augroup END

The available filetypes are:

  • LspsagaCodeAction
  • LspsagaDiagnostic
  • LspsagaFinder
  • LspsagaFloaterm
  • LspsagaHover
  • LspsagaRename
  • LspsagaSignatureHelp

License

MIT

More Repositories

1

xbase

Develop Apple software products within your favorite editor.
Rust
524
star
2

sqlite.lua

SQLite LuaJIT binding with a very simple api.
Lua
468
star
3

lispdocs.nvim

https://clojuredocs.org examples and notes, instantly under your finger tips
Lua
43
star
4

compe-conjure

compe-nvim source for conjure
Lua
18
star
5

redis-derive

This crate implements the FromRedisValue and ToRedisArgs Traits from mitsuhiko / redis-rs for any struct
Rust
16
star
6

swift.nvim

Swift Development environment for hard-core vim users. (WIIIIIP)
Lua
14
star
7

yctrl

Thin wrapper around yabai that adds convenient and intuitive fixes
Rust
11
star
8

process-stream

Thin wrapper around [`tokio::process`] to make it streamable
Rust
9
star
9

redis-om

A Rust/Redis ORM-style library define and manipulate data using derive macros
Rust
8
star
10

denv

small configuration utility written as an excuse to experiment with janet.
Clojure
7
star
11

base16

Lua
4
star
12

nixenv

Nix Library for creating OS independent Systems.
Nix
4
star
13

mdenv.nvim

WIP markdown editing environment
Vim Script
3
star
14

solid-codeblock

Simple lightweight solid codeblock component on top of shiki library
TypeScript
2
star
15

kkharji

2
star
16

vlang.nvim

Simple asynchronous and non blocking features and utilities for working with Vlang.
Lua
2
star
17

nix-templates

Personal Nix Templates
Nix
2
star
18

clj-dev

Data-driven clojure development environment
Clojure
2
star
19

py-test-with-devenv

Nix
1
star
20

vplayground

A tmp playground for vlang
V
1
star
21

build-server-protocol

Rust crate for creating BSP Servers.
Rust
1
star
22

clj-duct-reitit

Duct Module for routing with reitit and handling requests with ring.
Clojure
1
star
23

vim-iced-compe

nvim-compe source for vim-iced
Vim Script
1
star
24

nixlua

Package and develop lua with nix with ease. (WIP)
Nix
1
star
25

rspc-proxy

Experimental type-safe proxy for rspc web/js clients
TypeScript
1
star