Coder Social home page Coder Social logo

louisjackman / neovim-config Goto Github PK

View Code? Open in Web Editor NEW
0.0 3.0 0.0 55 KB

Offical GitHub mirror of https://gitlab.com/louis.jackman/neovim-config. A pure-Lua Neovim configuration with LSP support and pinned package versions.

License: GNU General Public License v3.0

Lua 100.00%

neovim-config's Introduction

neovim-config

My Neovim configuration, as used by my dockerfiles and elsewhere. Entirely Lua-based and running on Neovim 0.8. Reproducible with pinned third-party package versions, and focused on LSP (the Language Server Protocol).

  • Pure Lua configuration, no VimScript.
  • Expects LSP-based tooling by default and accomodates it.
  • Declarative package definitions with exact pinned versions for reproducibility.
  • Spacemacs/Doom Emacs-inspired keybindings which embrace Vim's keybindings but additionally utilise space as the leader key. The additional keybindings are still in the spirit of Vim, but more egonomic due to tapping space rather than holding modifier keys on the side of the keyboard.
  • Try it out without installing anything on your main system, even if you don't have Neovim. Use an image from my dockerfiles that combine this config with a preinstalled version of Neovim 0.8: docker run -it --rm -v "$PWD:/home/user/workspace" registry.gitlab.com/louis.jackman/dockerfiles/base-dev. Once inside that container's shell, run vi or nvim.
  • The ability to add additional_setup.lua files in derived environments for additional custom configuration -- used in my dockerfiles for environment-specific additions such as installing language-specific packages and LSP configurations.
  • Lua-based packages used for third party packages whenever possible; currently only the Nord colour scheme is still VimScript-based, as far as I know.
  • A single flag for disabling all downloaded packages while retaining the configuration's core benefits. Run it fully-fledged within chroot jails, but run a more minimal version on your main system to reduce the impact of potential supply chain attacks against Neovim package authors.

Official Mirror of the GitLab Repository

This repository is currently hosted on GitLab.com. An official mirror exists on GitHub. GitLab is still the official hub for contributions such as PRs and issues.

Installing

Clone the repository to ~/.config/nvim, assuming that directory doesn't yet exist:

git clone https://gitlab.com/louis.jackman/neovim-config.git ~/.config/nvim

Alternatively, clone it elsewhere or download the source tarball and unpack it, and then symlink the directory to ~/.config/neovim. Or use something like GNU Stow.

Configuring

To add your own configuration, the best way is to add a new file called additional_setup.lua within lua/user. It expects a table to be returned from the file with three optional keys defined:

  • use_third_party_packages: a boolean value that determines whether to pull in third party packages, i.e. anything outside of core Neovim.
  • pre_init: a function called before the configuration's main setup.
  • post_init: a function called after the configuration's main setup.

For example, this configuration disables third party packages which is a good idea when running outside of a chroot jail or a container:

return {
  use_third_party_packages = false,
}

For a configuration running inside an isolated environment that wants more features, it can keep third party packages enabled and start adding more nicities such as LSP configuration. Here's an example for JavaScript development that adds auto-completion and language support:

local additional_setup = {}

function additional_setup.post_init()
  require 'lazy'.setup {
    {'pangloss/vim-javascript',    commit = 'c470ce1399a544fe587eab950f571c83cccfbbdc'},
    {'MaxMEllon/vim-jsx-pretty',   commit = '6989f1663cc03d7da72b5ef1c03f87e6ddb70b41'},
    {'leafgarland/typescript-vim', commit = '52f3ca3474d51f5021696ffb7297d989e49121ac'},
    {'ianks/vim-tsx',              commit = '77c89c42e189fefd3c9a632b37b7e3b3b9edf918'},
  }

  vim.api.nvim_create_autocmd('filetype', {
    pattern = 'javascript.jsx,typescript.tsx,javascript',

    callback = function()
      vim.opt.tabstop = 2
      vim.opt.shiftwidth = 2
      vim.opt.softtabstop = 2
    end,
  })

  user.set_up_cmp_enhanced_lsp('tsserver', {'typescript-language-server', '--stdio'})
  user.set_up_cmp_enhanced_lsp('stylelint_lsp', {'stylelint-lsp', '--stdio'})
end

return additional_setup

neovim-config's People

Contributors

louisjackman avatar

Watchers

 avatar  avatar  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.