/Neovim.Config

Personal configuration of neovim as IDE.

Primary LanguageLuaMIT LicenseMIT

Neovim.Config

IDE configuration for Neovim

banner_01 banner_02 banner_03 banner_04 banner_05

preview_image preview_image

This repository contains my custom configuration for Neovim, an advanced text editor that can be turned into a powerful integrated development environment (IDE). With my configuration, Neovim becomes a virtually full-featured IDE, supporting multiple programming languages and offering a smooth and agile user experience thanks to the use of the Lazy plugin manager. You'll find everything you need to start working with Neovim right away, from installing plugins to customizing keyboard shortcuts and display options - enjoy the productivity Neovim has to offer!.

Index

๐Ÿ˜ธ Why ?

This repository was created to share my custom configuration of Neovim, an advanced text editor that I have used for a long time for my daily programming work. I have spent many hours customizing and refining my configuration to make Neovim perfectly suited to my needs, and I think other programmers could benefit from it.

๐Ÿ”จ Requirements

In order to be able to use the code editor correctly, it is necessary to have some programs previously installed.

๐Ÿฆ‰ Features

  • Support for multiple programming languages (Syntax coloring, Code auto-completion, Snippets)
  • Commands to quickly execute and compile code.
  • Visually pleasing and developer friendly interface.
  • Useful information for the status bar.
  • Convenient keyboard shortcuts based on the standard of other IDEs like VSCode.

๐Ÿ”ฌ Supported languages

  • javascript - tsserver
  • typescript - tsserver
  • javascript react - tsserver
  • typescript react - tsserver
  • python - pyright
  • json - jsonls
  • css - cssls
  • sass - cssls
  • scss - cssls
  • less - cssls
  • html - html - emmet_ls
  • go - gopls
  • rust - rust_analyzer
  • bash - bashls
  • vimscript - vimls
  • lua - lua_ls
  • java - jdtls
  • C - clangd
  • C++ - clangd
  • objective C - clangd
  • C# - csharp_ls
  • dockerfile - dockerls
  • docker-Compose - docker_compose_language_service
  • sql - sqlls
  • mysql - sqlls
  • markdown - marksman
  • assembly - asm_lsp
  • arduino - arduino_language_server

โš— Install LSP Clients

It is important to mention that not all languages will be installed automatically, this is done to improve the performance of the configuration and each person can decide which languages he/she needs.

By default the most common languages javascript, typescript, html, css, json, markdown, python, lua will be installed, the other languages can be installed using the command :Mason and look for the name of the LSP client already configured for the language you need.

Another option is to modify the LSP_CLIENTS variable found in globals.lua, here you can add the names of the servers you need and the Mason plugin will install them if they are not already installed.

โš™ LSP configuration

You can also change, add or remove LSP clients for each language, the settings for this can be found in the lsp.lua file and can be guided in the settings of the lsp-config plugin. You can also install the clients with the Mason plugin, you can use the :Mason command or add it to the LSP_CLIENTS line in globals.lua.

๐Ÿ›  Configurations

The editor has some settings that can be useful and quick to configure, these are found in the globals.lua file, and are global variables that are used throughout the deeper configuration of the plugins.

VARIABLE TYPE FUNCTION
BACKGROUND_TRANSPARENT Boolean This variable indicates whether a transparent background is desired
STATUSBAR Table This table contains properties that allow you to modify the style and layout of the status bar (lualine).
ALPHA String This variable stores the ASCII drawing that is displayed when the editor is opened. There are already drawings loaded in the configuration in the drawings.lua file, you just need to import the drawing you like or add your own.
TODO_PATTERN String This variable stores the search pattern to search for TODO comments in the code.
TODO_ICONS Table This variable indicates the table of icons to represent each TODO comment.
ICONS Table This variable stores a table of most of the icons found throughout the editor for general use.
GIT_SYMBOLS Table This variable stores a table with the icons or symbols that you will use to identify changes in a git repository.
TREE_SYMBOLS Table This variable stores a table with the icons to be used by the Neotree file manager.
TREE_WIDTH Integer This variable stores the width of the file manager.
TREE_DIRECTION String This variable stores from which point the file manager will open, left or right.
CMP_GHOST_TEXT Boolean This variable indicates whether you want a virtual text preview of the autocomplete options.
LSP_CLIENTS Table This variable contains the names of the LSP clients to be installed automatically.
EXCLUDE_FORMATTERS_FILES Table This variable contains the file type names that will not use neoformat to be formatted.
CODE_FORMATTERS Table This variable contains the names of the language and the code formatter to be used for that language.

๐Ÿ“ฆ Additional functions

The editor has some additional commands for different proportions, here is a list of the available commands.

COMMAND FUNCTION
:InitialPrettierrc The command creates a .pretierrc file in your project's root path.
:InitialEditorconfig The command creates a .editorconfig file in your project root path
:InitialDockerfile The command creates a dockerfile file in your project root path
:InitialDockercompose The command creates a docker-compose.yaml file in your project root path
:InitialStructureSass <path> The command creates a default file structure for sass, the command receives as a parameter the path where the folders are to be created
:InitialStructureNode <path> The command creates a default file structure for node project, the command receives as a parameter the path where the folders are to be created
:RunPython The command executes the python file at the side of the editor.
:RunJavascript The command executes the javascript file at the side of the editor
:RunTypescript The command compiles the typescript file, and then executes the resulting javascript file next to the editor.
:RunScss The command compiles the current scss file
:RunGo The command compiles the open go file and then executes the resulting binary at the side of the editor.
:RunCPP The command compiles the open c++ file and then executes the resulting binary at the side of the editor.
:RunC The command compiles the open c file and then executes the resulting binary at the side of the editor.
:OpenHTML This command opens the current HTML file in your default browser.

๐Ÿงช How to install

Fast installation

Once you have the above requirements you can proceed to install the configuration.

  1. The first thing is to have all the code formatters you like such as Prettier, Black, Clang-format, etc. installed on your system. You can install them through the mason plugin by running the :Mason command and searching for the formatter of your choice but I recommend installing them independently.

  2. Then you can install the configuration using the following command depending on your environment.

    Windows

    git clone --branch main https://github.com/EddyBel/Neovim.Config.git $HOME\AppData\Local\nvim --depth 1 && nvim

    Linux / Macos

    git clone --branch main https://github.com/EddyBel/Neovim.Config.git ~/.config/nvim --depth 1 && nvim

    This command will clone the latest version of the repository in the configuration path of neovim, once cloned, neovim will be opened with the nvim command so that lazy proceeds with the installation of all plugins.

Step by step installation

Once you have fulfilled the necessary requirements for the correct functioning of the configuration, you can proceed to the installation of this configuration.

  1. The first thing is to clone the configuration repository this can be done with git or download it directly from github. to clone it with git you can use this command:

    git clone --branch main https://github.com/EddyBel/Neovim.Config.git --depth 1
  2. Next is to move to the cloned repository folder once there you must copy the files init.lua, lazy-lock.json and finally the lua folder, these must go in your neovim configuration folder, for Linux systems you can use ~/.config/nvim, for Windows you can use C:\Users\Username\AppData\Local\nvim or wherever neovim defines the configuration path.

    Windows

    cd Neovim.Config
    xcopy init.lua lazy-lock.json lua C:\Users\Username\AppData\Local\nvim /s /e /i

    Linux / Macos

    cd Neovim.Config
    cp init.lua lazy-lock.json lua ~/.config/nvim
  3. Before opening neovim it is important to install the code formatters, these will allow your code to maintain a good structure and design, for this we use the Neoformat plugin to manage the formatters but we must install them separately with the following commands:

    npm install -g prettier
    pip install black
    pip install clang-format
  4. Finally you can open the editor with the command nvim and lazy will install all the plugins automatically, and that's it! you can start coding.

Delete configuration

You can remove the configuration by deleting the configuration folder (where the init.lua file is located) and the folder that stores the plugins and their respective plugin manager data (the neovim data folder), for this you can use the following command:

Windows cmd

rmdir /s $HOME\AppData\Local\nvim\ $HOME\AppData\Local\nvim-data\

Windows powershell

Remove-Item -Recurse -Force $HOME\AppData\Local\nvim\, $HOME\AppData\Local\nvim-data\

Linux / Macos

rm -rf ~/.config/nvim ~/.local/share/nvim/

๐ŸŽข Project status

The project is constantly changing because it is my usual code editor and I will be improving and adding things as I see fit.

๐Ÿ“‘ LICENCE

This project is released under the terms of the MIT license. The MIT license allows users to use, copy, modify and distribute the source code of the project with certain restrictions and requirements. For more information on the terms and conditions of the MIT license, please refer to the license file included with this project or visit https://opensource.org/licenses/MIT.


Github LinkedIn