6

I'm trying to make a protable Neovim so I can use my plug&play IDE from a USB thumbdrive on any offline Windows computer.

I managed to store my plugins and my sysinit.vim onto the USB drive and make Neovim use them.

But while testing I realized that Neovim creates some folders on the host computer.

~\AppData\Local\nvim-data\shada and ~\AppData\Local\nvim-data\swap

Are there more?

In the manual I found that I can change where swap files are stored by setting directory which currently is ~\AppData\Local\nvim-data\swap\\

What about the ShaDa directory?

Is there any way to change stdpath('data')?

I guess there is no way to prevent nvim-qt to create registry entries? (beside making my own build)

2
  • This question is two years already. Have you found a way to better configure neovim to make it more portable? Also, do you mind share your current portable version?
    – Danielo515
    Aug 24, 2022 at 9:51
  • @Danielo515 not really. but I haven't spent too much time experimenting to be honest. I'm sure there is a way but after a while I just didn't care if there were some unwanted folders.
    – Piglet
    Aug 24, 2022 at 16:00

2 Answers 2

0

Are there more?

Swap, undo, shada, log... Whatever is found there.

I can change where swap files are stored

IMO, just set noswapfile and forget it.

What about the shada directory?

Read :h shada-n Get used to this: when you need something it's in the help.

I guess there is no way to prevent

Everything is possible. But, at the very least, shada/viminfo is too useful to switch it off.

Is there any way to change stdpath('data')?

From :h standard-path

The $XDG_CONFIG_HOME and $XDG_DATA_HOME environment variables are used if they exist, otherwise default values (listed below) are used

2
  • Thanks. Yeah the help is really great but I have a few problems to find what I need some times or if I find it it is hard to make sense of it, yet. I read the shada section befor and I didn't realize that changing the shada filename would also change where it is stored. I don't want to turn it off, I just don't want my NVIM to leave files other than those I edit on the computer.
    – Piglet
    May 19, 2020 at 15:59
  • 2
    To help with the first problem (not finding what you are looking for) I recommend reading chapter 2.8 (:h 02.8) including the summary afterwards (:h help-summary). And don't forget about :helpgrep. (If you are already familiar with these things then carry on.)
    – B Layer
    May 19, 2020 at 19:22
0
C:> set LOCALAPPDATA=Z:\appdata
C:> cd Z:\appdata
The system cannot find the path specified.

C:> nvim.exe --headless +":echo 'Vim datapath:'stdpath('data')|q"
Vim datapath: Z:\appdata\nvim-data

C:> cd /d Z:\appdata\nvim-data\shada
Z:\appdata\nvim-data\shada>
#ifdef MSWIN
static const char *const xdg_defaults_env_vars[] = {
  [kXDGConfigHome] = "LOCALAPPDATA",
  **[kXDGDataHome] = "LOCALAPPDATA",**
  [kXDGCacheHome] = "TEMP",
  [kXDGStateHome] = "LOCALAPPDATA",
  [kXDGRuntimeDir] = NULL,  // Decided by vim_mktempdir().
  [kXDGConfigDirs] = NULL,
  [kXDGDataDirs] = NULL,
};
#endif

Source: https://github.com/neovim/neovim/blob/master/src/nvim/os/stdpaths.c#L24

1
  • Welcome to Vi and Vim! This answer would benefit greatly from some explanation
    – D. Ben Knoble
    Oct 29, 2022 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.