Skip to content

windwp/nvim-projectconfig

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

nvim-projectconfig

Load config depend on current directory.

Sample

current directory is /home/abcde/projects/awesome/. you open vim in awesome directory.

It will load a config file from ~/.config/nvim/projects/awesome.lua or ~/.config/nvim/projects/awesome.vim

this config save outside of your git repo and you don't need to check security on that file. It work perfect if you are working on monorepo.

Install

  Plug 'windwp/nvim-projectconfig'

then add this in your init.lua

require('nvim-projectconfig').setup()

FAQ

  • A command to open project config file

Command: EditProjectConfig

  • I want to change projects-config directory
require('nvim-projectconfig').setup({
  project_dir = "~/.config/projects-config/",
})
  • I have 2 directory have same name.
require('nvim-projectconfig').setup({
  project_dir = "~/.config/projects-config/",
  project_config={
    {
      -- full path of your project or a lua regex string
        path = "projectconfig", 
        -- use a function or a path to config file 
        config = function ()
            print("abcde")
        end
    },
  },
  silent = false,-- display message after load config file
})
  • I want to change my directory inside neovim and load project config.
require('nvim-projectconfig').setup({autocmd=true})

Bonus

a function to load and save json file and do whatever you want.

require('nvim-projectconfig').load_json()
require('nvim-projectconfig').save_json(data)