diff options
Diffstat (limited to 'lua/talha/functions.lua')
-rw-r--r-- | lua/talha/functions.lua | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/lua/talha/functions.lua b/lua/talha/functions.lua index e27e1a2..fdad26c 100644 --- a/lua/talha/functions.lua +++ b/lua/talha/functions.lua @@ -87,3 +87,30 @@ function GetHomeDir() return nil end +function GetPlatformBuildCommand() + os_ver = vim.loop.os_uname().sysname + local build_command = '' + if os_ver == 'Linux' then + build_command = [[./build.sh]] + elseif os_ver == 'Windows' then + build_command = [[build.bat]] + end + return build_command +end + +function SafeCListNav(navdir) + -- dir: + -- 1 is cnext (forwards) + -- -1 is cprev (backwards) + local dircmd = '' + if navdir == 1 then + dircmd = 'cnext' + elseif navdir == -1 then + dircmd = 'cprev' + end + local status, result = pcall(vim.cmd, dircmd) + + if status == false then + return nil + end +end |