Giter Club home page Giter Club logo

nvim-lsp-config's Introduction

Neovim with LSP and tree-sitter

An opinionated and simple neovim configuration with native LSP and treesitter support.

You can use this repo either as a base config to build your own neovim configuration on top of, or as an example of how to configure neovim with treesitter and LSP support.

Why would you want this?

In short, because LSP and treesitter together give neovim superpowers. Treesitter provides highlighting and syntax checking for almost any programming language by parsing and creating an AST of the file. This beats the pants off of previous approaches which used error-prone regexes that didn't necessarily understand the contents of your code.

Neovim's new native LSP client means Neovim can now do things like intellisense/auto-completion, automated code refactoring, navigating to definitions (even across import statements or multiple files) and even automated code formatting.

In short, nearly everything that you would get with a full-on IDE like PyCharm or VS Code, but with all the speed, power and customizability of vim at your disposal.

This repo also includes Telescope which gives neovim fuzzy-finding capabilities on par with fzf and even lets you do ripgrep like searches across all the files in your project (or just the ones committed in git!).

For a demo of the final setup's capabilities check the video:

Installation

This repo uses recently neovim-specific features, and as a result this repo requires neovim 0.5.0+/nightly. This configuration will not work with vanilla vim or neovim 0.4

To install, first make sure you have installed neovim nightly.

If you already have an existing neovim configuration, then it's best to cherrypick the pieces of this configuration into your own files as you see fit.

If you're configuring neovim for the first time, then do the following:

  1. clone this repo into nvim config location:

    mkdir -p ~/.config/nvim
    git clone https://github.com/nikvdp/nvim-lsp-config/ ~/.config/nvim
  2. install vim-plug:

    sh -c 'curl -fLo "${XDG_DATA_HOME:-$HOME/.local/share}"/nvim/site/autoload/plug.vim --create-dirs \
           https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
  3. Install a nerdfont and configure your terminal to use it (otherwise icons will not display correctly)

    On a mac you can install one via, eg:

    brew tap homebrew/cask-fonts
    brew install --cask font-victor-mono-nerd-font
    

    and then select "VictorMono Nerd Font" in your terminal emulator's font config.

    For iTerm2, this means hit โŒ˜+, to open up preferences, then go to Profiles -> Text -> Font and use the dropdown to select "VictorMono Nerd Font"

    Linux or Windows pelase follow the instructions provided at the nerd fonts repository.

  4. Install plugins:

    nvim '+PlugInstall | qa'
  5. Start neovim: nvim

  6. Install LSPs for the languages you care about via eg :LspInstall python. You can use tab completion after typing :LspInstall to see which language servers are available

  7. Add/customize your keybindings to ~/.config/nvim/init.vim.

nvim-lsp-config's People

Contributors

nikvdp avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.