这是indexloc提供的服务,不要输入任何密码
Skip to content

VonHeikemen/lazy-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Lazy Template

Base configuration for Neovim. For those looking to make Neovim their new main editor. Here you'll find a popular combination of plugin to make your experience a little bit better.

A few things have been configured to resemble other modern text editors. You'll find a file explorer with tree style view, list open files in tabs, git integration and a terminal easy to toggle.

Autocompletion and "code intellisense" is provided by the LSP client built into Neovim. This means if you want smart completion and error detection for a programming language you'll need to install a language server.

Requirements

  • Neovim v0.11 or greater is recommended.
    • v0.9.5 is the minimum required.
  • git.
  • A C compiler. Can be gcc, tcc or zig.
  • tree-sitter CLI 0.25 or greater
  • (optional) A patched font to display icons. I hear nerdfonts has a good collection.
  • (optional) ripgrep. Improves project wide search speed.
  • (optional) fd. Improves file search speed.

Note for windows users

If you need a C compiler then zig is the easiest to install. It's available on winget, scoop and chocolatey. You can also find some links in the zig download page.

Installation

  • I recommend installing Neovim's latest stable version. Or at least Neovim v0.9.

  • Clone this repository in Neovim's configuration folder.

    If you don't know the location of that folder, use this command in your terminal.

    nvim --headless -c 'echo stdpath("config") | echo "" | quit'
  • After you cloned the repository in Neovim's folder, start Neovim using this command in your terminal.

    nvim

    The plugin manager will be installed automatically. And then all the plugins will be installed.

Learn how to use Neovim as a text editor

Neovim comes with an interactive tutorial that teaches the basics of the editor. The estimated time of this tutorial is around 45 minutes. It will show you how to move around text, how to execute commands and of course how to quit Neovim. You can access the tutorial by executing this command in your terminal.

nvim +Tutor

I've also created a documentation site aimed at teaching the basic features of Neovim. Note that it is mostly about how to use Neovim as a text editor without plugins, but there is still some valuable information there:

About language servers

They are external programs that provide IDE-like features to Neovim. If you want to know more about language servers watch this wonderful 5 minutes video: LSP explained.

In this configuration there is a plugin that will help you install language servers: mason-lspconfig. If you execute the command :LspInstall while you are inside a file then mason-lspconfig will suggest a list of language servers that support that particular type of file.

Keep in mind you need to meet the requirements of the language servers. For example, if you want to download the language server for the go programming language then you need to have go installed in your system. If you want to download a language server written in javascript you'll need NodeJS.

Learn more about the plugin manager

lazy.nvim is the plugin manager used in this configuration. Here are a few resources that will help you understand some of it's features:

Keybindings

Leader key: Space.

Mode Key Action
Normal <leader>h Go to first non empty character in line.
Normal <leader>l Go to last non empty character in line.
Normal <leader>a Select all text.
Normal gy Copy selected text to clipboard.
Normal gp Paste clipboard content.
Normal <leader>w Save file.
Normal <leader>qq Exit Neovim.
Normal <leader>bq Close current buffer.
Normal <leader>bc Close current buffer while preserving the window layout.
Normal <leader>bl Go to last active buffer.
Normal <leader><space> Search open buffers.
Normal <leader>ff Find file in current working directory.
Normal <leader>fh Search oldfiles history.
Normal <leader>fg Search pattern in current working directory.
Normal <leader>fd Search diagnostics in current file.
Normal <leader>fs Search pattern in current file.
Normal <leader>u Search undo history.
Normal <leader>? Search keymaps.
Normal <leader>/ Search snack pickers.
Normal <leader>e Open file explorer.
Normal <leader>ti Toggle indent guide lines.
Normal <Ctrl-g> Toggle a terminal window.
Terminal <Esc><Esc> Pressing Escape twice quickly goes back to normal mode.
Normal gw Begin a 2 character jump.
Normal gcc Toggle comment in current line.
Operator gc Toggle comment in text.
Operator sa Add surrounding.
Normal sd Delete surrounding.
Normal sr Surround replace.
Normal sf Find surrounding.
Normal sb Pick a visible tab.
Insert <Ctrl-j> Expand snippet trigger.
Insert <Ctrl-h> Go to previous snippet tabstop.
Insert <Ctrl-l> Go to next snippet tabstop.
Normal K Displays hover information about the symbol under the cursor.
Normal gd Jump to the definition.
Normal gq Format code in current buffer.
Normal gO Lists symbols in the current buffer.
Normal <Ctrl-s> Displays a function's signature information.
Normal gri Lists all the implementations for the symbol under the cursor.
Normal grr Lists all the references.
Normal grn Renames all references to the symbol under the cursor.
Normal gra Selects a code action available at the current cursor position.
Normal grd Jump to declaration.
Normal grt Jumps to the definition of the type symbol
Normal <Ctrl-w>d Show diagnostics in a floating window.
Normal [b Go to the previous buffer.
Normal ]b Go to the next buffer.
Normal [B Go to the first buffer.
Normal ]B Go to the last buffer.
Normal [d Move cursor to the previous diagnostic.
Normal ]d Move cursor to the next diagnostic.
Normal [q Move cursor to the previous location in the quickfix list.
Normal ]q Move cursor to the next location in the quickfix list.
Normal [Q Move cursor to the first location in the quickfix list.
Normal ]Q Move cursor to the last location in the quickfix list.

Autocomplete keybindings

Mode Key Action
Insert <Up> Move to previous item.
Insert <Down> Move to next item.
Insert <Ctrl-p> Move to previous item.
Insert <Ctrl-n> Move to next item.
Insert <Ctrl-u> Scroll up in documentation window.
Insert <Ctrl-d> Scroll down in documentation window.
Insert <Ctrl-e> Cancel completion.
Insert <Ctrl-y> Confirm completion.
Insert <Enter> Confirm completion.
Insert <Tab> If completion menu is open, go to next item. Else, open completion menu.
Insert <Shift-Tab> If completion menu is open, go to previous item.

Plugin list

Name Description
lazy.nvim Plugin manager.
tokyonight.nvim Collection of colorscheme for Neovim.
snacks.nvim Collection of QoL plugins.
bufferline.nvim Pretty tabline.
mini.nvim Collection of independent lua modules that enhance Neovim's features.
nvim-treesitter Configures treesitter parsers. Provides modules to manipulate code.
nvim-treesitter-textobjects Creates textobjects based on treesitter queries.
vim-repeat Add "repeat" support for plugins.
mason.nvim Portable package manager for Neovim.
mason-lspconfig.nvim Integrates nvim-lspconfig and mason.nvim.
nvim-lspconfig Quickstart configs for Neovim's LSP client.
nvim-cmp Autocompletion engine.
cmp-buffer nvim-cmp source. Suggest words in the current buffer.
cmp-path nvim-cmp source. Show suggestions based on file system paths.
cmp-mini-snippets nvim-cmp source. Show suggestions based on installed snippets.
cmp-nvim-lsp nvim-cmp source. Show suggestions based on LSP servers queries.
friendly-snippets Collection of snippets.
nvim-ts-context-commentstring It helps detect comment syntax.

About

An example of how you can use lazy.nvim to split your configuration in modules.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages