File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -275,31 +275,31 @@ Above code will generate a solid white background.
275275CodeSnap.nvim use gradient background by default, you can specify the gradient colors by setting ` background.stops ` to a table of colors, for example:
276276
277277``` lua
278- " background" : {
279- " start" : {
280- " x " : 0 ,
281- " y " : 0
278+ background = {
279+ start = {
280+ x = 0 ,
281+ y = 0
282282 },
283- " end" : {
284- " x " : " max" ,
285- " y " : " max"
283+ end = {
284+ x = " max" ,
285+ y = " max"
286286 },
287- " stops" : [
287+ stops = [
288288 {
289- " position" : 0 ,
290- " color" : " #EBECB2"
289+ position = 0 ,
290+ color = " #EBECB2"
291291 },
292292 {
293- " position" : 0.28 ,
294- " color" : " #F3B0F7"
293+ position = 0.28 ,
294+ color = " #F3B0F7"
295295 },
296296 {
297- " position" : 0.73 ,
298- " color" : " #92B5F0"
297+ position = 0.73 ,
298+ color = " #92B5F0"
299299 },
300300 {
301- " position" : 0.94 ,
302- " color" : " #AEF0F8"
301+ position = 0.94 ,
302+ color = " #AEF0F8"
303303 }
304304 ]
305305}
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ local table_utils = require("codesnap.utils.table")
33local module = require (" codesnap.module" )
44local config_module = require (" codesnap.config" )
55local modal = require (" codesnap.modal" )
6+ local path = require (" codesnap.path" )
67
78-- Prepare the path of the Rust module
89-- Try to fetch pre-built library first, then fallback to development build
@@ -15,6 +16,9 @@ local main = {
1516
1617function main .setup (config )
1718 static .config = table_utils .merge_config (static .config , config == nil and {} or config )
19+ if static .config .snapshot_config then
20+ path .expand_paths_in_config (static .config .snapshot_config )
21+ end
1822end
1923
2024-- Save snapshot to specified save_path
Original file line number Diff line number Diff line change 1+ local path_module = {}
2+
3+ local function expand_path (path )
4+ if type (path ) ~= " string" then
5+ return path
6+ end
7+ if path :sub (1 , 1 ) == " ~" then
8+ local home = os.getenv (" HOME" ) or os.getenv (" USERPROFILE" ) or " "
9+ return home .. path :sub (2 )
10+ end
11+ return path
12+ end
13+
14+ function path_module .expand_paths_in_config (config )
15+ if config .themes_folders and # config .themes_folders > 0 then
16+ config .themes_folders = vim .tbl_map (expand_path , config .themes_folders )
17+ end
18+
19+ if config .fonts_folders and # config .fonts_folders > 0 then
20+ config .fonts_folders = vim .tbl_map (expand_path , config .fonts_folders )
21+ end
22+ return config
23+ end
24+
25+ return path_module
Original file line number Diff line number Diff line change @@ -35,6 +35,11 @@ function table_utils.merge_config(t1, t2)
3535 t1 [k ] = t2 [k ]
3636 end
3737 end
38+ for k , v in pairs (t2 ) do
39+ if t1 [k ] == nil and v ~= nil then
40+ t1 [k ] = v
41+ end
42+ end
3843
3944 return t1
4045end
You can’t perform that action at this time.
0 commit comments