DEV Community

Cover image for How to turn NEOVIM into an IDE-like code editor in NIXOS?
Mirsoli Mirzaahmad õğli
Mirsoli Mirzaahmad õğli

Posted on

1

How to turn NEOVIM into an IDE-like code editor in NIXOS?

Welcome to my optimized Laravel development setup featuring Nvim with LazyVim integration. This configuration is tailored to enhance productivity and streamline the development workflow for Laravel projects.

Features:​

  • Efficient Code Editing: Leverage the power of Nvim’s fast, extensible code editing with LazyVim’s user-friendly enhancements.
  • Laravel-Specific Tools: Pre-configured tools and plugins to support Laravel development, including syntax highlighting, code completion, and route navigation.
  • Enhanced Productivity: Enjoy a suite of features aimed at boosting efficiency, such as automatic code formatting, linting, and integrated terminal support.
  • Customizable: Easily adapt the setup to your preferences with a modular and customizable configuration.

Setup​:

  • Clone this repository:
git clone https://github.com/codahiri/dotfiles.git ~/.config/nvim
Enter fullscreen mode Exit fullscreen mode
  • Remove the .git folder, so you can add it to your own repo later
rm -rf ./nvim/.git
Enter fullscreen mode Exit fullscreen mode
  • Create a folder called neovim and copy the cloned nvim folder into it. Then create a file called deafult.nix and add the following code inside it:
{
  config,
  lib,
  pkgs,
  ...
}:
###############################################################################
#
#  NvChad's configuration and all its dependencies(lsp, formatter, etc.)
#
#e#############################################################################
let
  shellAliases = {
    v = "nvim";
    vdiff = "nvim -d";
  };
  # the path to nvim directory
  # to make this symlink work, we need to git clone this repo to your home directory.
  configPath = "${config.home.homeDirectory}/nixos-config/modules/home/neovim/nvim";
in
{
  xdg.configFile."nvim".source = config.lib.file.mkOutOfStoreSymlink configPath;

  home.shellAliases = shellAliases;
  programs.nushell.shellAliases = shellAliases;

  programs = {
    neovim = {
      enable = true;
      package = pkgs.neovim-unwrapped;

      # defaultEditor = true; # set EDITOR at system-wide level
      viAlias = true;
      vimAlias = true;

      # These environment variables are needed to build and run binaries
      # with external package managers like mason.nvim.
      #
      # LD_LIBRARY_PATH is also needed to run the non-FHS binaries downloaded by mason.nvim.
      # it will be set by nix-ld, so we do not need to set it here again.
      extraWrapperArgs = with pkgs; [
        # LIBRARY_PATH is used by gcc before compilation to search directories
        # containing static and shared libraries that need to be linked to your program.
        "--suffix"
        "LIBRARY_PATH"
        ":"
        "${lib.makeLibraryPath [
          stdenv.cc.cc
          zlib
        ]}"

        # PKG_CONFIG_PATH is used by pkg-config before compilation to search directories
        # containing .pc files that describe the libraries that need to be linked to your program.
        "--suffix"
        "PKG_CONFIG_PATH"
        ":"
        "${lib.makeSearchPathOutput "dev" "lib/pkgconfig" [
          stdenv.cc.cc
          zlib
        ]}"
      ];

      # Currently we use lazy.nvim as neovim's package manager, so comment this one.
      #
      # NOTE: These plugins will not be used by astronvim by default!
      # We should install packages that will compile locally or download FHS binaries via Nix!
      # and use lazy.nvim's `dir` option to specify the package directory in nix store.
      # so that these plugins can work on NixOS.
      #
      # related project:
      #  https://github.com/b-src/lazy-nix-helper.nvim
      # plugins = with pkgs.vimPlugins; [
      #   # search all the plugins using https://search.nixos.org/packages
      #   telescope-fzf-native-nvim

      #   nvim-treesitter.withAllGrammars
      # ];
    };
  };
}
Enter fullscreen mode Exit fullscreen mode
  • Build NixOS and Start Neovim!
# build nixos
sudo nixos-rebuild switch --flake ./#yourhostname

# start nvim
nvim
Enter fullscreen mode Exit fullscreen mode

To get started, clone the repository and follow the installation instructions in the README. This repository includes all necessary configurations, plugins, and dependencies to get your Laravel development environment up and running quickly.

Image of Datadog

Create and maintain end-to-end frontend tests

Learn best practices on creating frontend tests, testing on-premise apps, integrating tests into your CI/CD pipeline, and using Datadog’s testing tunnel.

Download The Guide

Top comments (0)

AWS Q Developer image

Your AI Code Assistant

Automate your code reviews. Catch bugs before your coworkers. Fix security issues in your code. Built to handle large projects, Amazon Q Developer works alongside you from idea to production code.

Get started free in your IDE

👋 Kindness is contagious

DEV shines when you're signed in, unlocking a customized experience with features like dark mode!

Okay