Skip to content

Project local settings

Peter Lithammer edited this page May 27, 2021 · 17 revisions

Local settings can be configured by enabling the exrc option with set exrc in your init.vim and creating a .nvimrc file in the project's root directory. If neovim is launched in the same directory as .nvimrc, it will evaluate your user configuration first, followed by the local configuration. An example .nvimrc might be as follows

lua << EOF
  local nvim_lsp = require('lspconfig')
  local servers = {'rust_analyzer'}
  nvim_lsp.rust_analyzer.setup {
    root_dir = function()
      return vim.fn.getcwd()
    end
  }
EOF

Be aware, after enabling exrc, neovim will execute any .nvimrc or .exrc owned by your user, including git clones.