26

GitHub - brainfucksec/neovim-lua: Neovim Lua

 3 years ago
source link: https://github.com/brainfucksec/neovim-lua
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Neovim Lua

My Neovim configuration with Lua

This setup is for neovim v0.5.0

Plugins

paq-nvim - Neovim package manager written in Lua

indentLine - Show indent lines

lualine.nvim - Statusline written in pure Lua

nvim-compe - Auto completion plugin

nvim-lspconfig - A collection of common configurations for Neovim's built-in language server client.

nvim-tree.lua - A File Explorer written In Lua

nvim-web-devicons - A Lua fork of vim-devicons

tagbar - Browse the tags of the current file and get an overview of its structure

I use Paq for plugin manager, see: https://github.com/savq/paq-nvim#installation

Directory tree of Lua files

~/.config/nvim
.
├── init.lua
└── lua
    ├── keymapping.lua
    ├── nvim-compe
    │   └── main.lua
    ├── nvim-lspconfig
    │   └── main.lua
    ├── nvim-tree
    │   └── main.lua
    ├── settings.lua
    └── statusline.lua

Files and settings

  • init.lua: Main configuration file (call lua modules, load plugins etc.)

  • lua: Folder of lua modules, here reside all the Lua modules that needed. The logic is simple, inside the lua folder there are the files and/or folders for neovim and plugins settings (written in Lua), these modules are called from init.lua file (See below). For plugins settings I use the convention <plugin-folder/main.lua>. See: https://github.com/nanotee/nvim-lua-guide#where-to-put-lua-files

  • keymapping.lua: Keymaps configuration file, vim/neovim and plugins keymaps.

  • settings.lua: General Neovim settings and configuration

  • statusline.lua: Statusline configuration file (in this case I use this file for lualine.nvim configuration)

  • nvim-compe: Autocompletion settings, TAB completion also for LSP

  • nvim-lspconfig: LSP configuration: in this file I insert the language servers for LSP

  • nvim-tree: File manager settings

Screenshots

Bash

C

Python

Appearance

Colorscheme: molokai

Fonts: Cozette

Icons: nvim-web-devicons

Startup time

Installation

  1. Install neovim v0.5.0

  2. Install npm (for download the packages of LSP language servers)

  3. Download this repository with git and copy the required folders

    git clone https://github.com/brainfucksec/neovim-lua.git
    cd neovim-lua/
    cp -Rv nvim ~/.config/nvim/
  1. Install Paq

  2. Open neovim and run the command :PaqInstall to install the plugins

LSP Configuration

  1. Install LSP language servers with npm
    sudo npm install -g bash-language-server pyright vscode-langservers-extracted
  1. Install clang for use LSP with clangd

  2. Open a file with neovim and run command :LspInfo for testing the LSP support

Supported languages in my configuration:

Bash - bashls

Python - pyright

C, C++ - clangd

HTML, CSS, JavaScript - vscode-html

See: nvim-lspconfig #CONFIG.md

  • Add Lua (and other languages) to LSP configuration

  • Test nvim-treesitter (Replacing tagbar and after/syntax folder (maybe)...)


Resources

Examples:

Lua resources

Disclaimer

As all my setups I try to follow the KISS principle, probably some concepts may not be valid for everyone, then feel free to take what you need but don't install anything without checking first!


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK