LintaoAmons / scratch.nvim

Create temporary playground files effortlessly. Find them later without worrying about filenames or locations.
Other
225 stars 9 forks source link

Fix: Initialize config directory before reading config file #8

Closed cfurrow closed 1 year ago

cfurrow commented 1 year ago

When you first install the plugin, nvim may complain when trying to read teh config file if the config directory has not been created yet.

vim/_editor.lua:0: /Users/carlfurrow/workspace/dotfiles/nvim-configs/basic/init.lua..nvim_exec2() called at /Users/carlfurrow/workspace/dotfiles/nvim-configs/basic/init.lua:0../Users/carlfurrow/.local/share/nvim-basic/lazy/scratch.nvim/plugin/scratch_plug
in.lua: Vim(source):E5113: Error while calling lua chunk: ...rlfurrow/.local/share/nvim/lazy/scratch.nvim/lua/api.lua:27: attempt to index local 'file' (a nil value)
stack traceback:
^I...rlfurrow/.local/share/nvim/lazy/scratch.nvim/lua/api.lua:27: in function 'getConfig'
^I...rlfurrow/.local/share/nvim/lazy/scratch.nvim/lua/api.lua:36: in main chunk

This PR adds a new method to initialize the config directory before trying to load the configuration file.

cfurrow commented 1 year ago

And I'm putting some extra efforts to allow user to choose where they want to put their config file

Great to hear! Looking forward to that change in the plugin config 😄