generated from mistricky/nvim-plugin-template
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Perf] wrap platform utils and refactor the logic to get default (#126)
save_path
- Loading branch information
Showing
3 changed files
with
34 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
local platform_utils = {} | ||
|
||
local current_os_name = vim.loop.os_uname().sysname | ||
|
||
function platform_utils.match_os(matches_table) | ||
local fn = matches_table[current_os_name] | ||
|
||
if fn == nil then | ||
error("codesnap.nvim not supported on " .. current_os_name) | ||
end | ||
|
||
return fn() | ||
end | ||
|
||
return platform_utils |