pepper

Pepper Editor

A simple and opinionated modal code editor for your terminal

View the Project on GitHub

make lsp server run automatically

An LSP server is usually started when a file it should handle is opened, normally known from its extension. By using the lsp command, it’s possible to automatically start an LSP server like that. For each LSP server you wish to register, add this to one of your config files:

lsp "lsp-server-command" "**/*.ext"

Where "**/*.ext" is a glob pattern that, when matched against a buffer just opened, will invoke the LSP server using "lsp-server-command". In this case, whenever we open a buffer with the extension .ext.

If you need to inspect/debug the protocol messages, they are logged to the editor log which you can open with the open-log command.

Example of LSP server configurations

# rust-analyzer (rust)
lsp rust-analyzer "**/*.rs"

# clangd (c/cpp)
lsp "clangd --offset-encoding=utf-8" "**/*.{c,cpp,h,hpp}"

# omnisharp (c#)
lsp "omnisharp -lsp --encoding utf-8" "**/*.cs"

# zls (zig)
lsp zls "**/*.zig"

bindings

binding expands to action
K : lsp-hover<enter> display hover information (requires a running lsp server)
gd : lsp-definition<enter> jumps to where the symbol under the cursor is defined (requires a running lsp server)
gr : lsp-references -context=2<enter> lists all references of the symbol under the cursor with 2 lines of context (requires a running lsp server)
gs : lsp-document-symbols<enter> lists all symbols in the buffer (requires a running lsp server)
rr : lsp-rename<enter> rename the symbol under the cursor (requires a running lsp server)
ra : lsp-code-action<enter> suggests possible refactors for the region under the cursor (requires a running lsp server)
rf : lsp-format<enter> auto-format the buffer’s content (requires a running lsp server)

commands

lsp

Automatically starts a lsp server (by running <lsp-command>) when a buffer matching a glob <glob> is opened. The lsp command only runs if the server is not already running.

lsp-start

Manually starts a lsp server (by running <lsp-command>).

lsp-stop

Stops the lsp server associated with the current buffer.

lsp-stop-all

Stops all lsp servers. usage: lsp-stop-all

lsp-hover

Displays lsp hover information for the item under the main cursor.

lsp-definition

Jumps to the location of the definition of the item under the main cursor.

lsp-declaration

Jumps to the location of the declaration of the item under the main cursor.

lsp-implementation

Jumps to the location of the implementation of the item under the main cursor.

lsp-references

Opens up a buffer with all references of the item under the main cursor. Optionally overrides the <context-len> (default is 2). That is: how many lines above and under each reference to show.

lsp-rename

Renames the item under the main cursor.

lsp-code-action

Lists and then performs a code action based on the main cursor context.

lsp-document-symbols

Pick and jump to a symbol in the current buffer listed by the lsp server.

lsp-workspace-symbols

Opens up a buffer with all symbols in the workspace found by the lsp server. Optionally pre-filters results with a <query>.

lsp-format

Format the whole buffer.