[vim] Clean up the gitTopLevelDirectory() method
Mostly change double quotes to single quotes. Add a nil check.
This commit is contained in:
parent
4b566050af
commit
a4883068de
1 changed files with 4 additions and 4 deletions
|
@ -1,14 +1,14 @@
|
||||||
-- Eryn Wells <eryn@erynwells.me>
|
-- Eryn Wells <eryn@erynwells.me>
|
||||||
|
|
||||||
require "os"
|
require 'os'
|
||||||
|
|
||||||
function gitTopLevelDirectory()
|
function gitTopLevelDirectory()
|
||||||
local handle = io.popen("git rev-parse --show-toplevel")
|
local handle = io.popen('git rev-parse --show-toplevel')
|
||||||
if handle == nil then
|
if handle == nil then
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
|
||||||
local gitRepoTopLevelDirectoryPath = vim.fn.trim(handle:read("*a"))
|
local gitRepoTopLevelDirectoryPath = vim.fn.trim(handle:read('*a'))
|
||||||
handle:close()
|
handle:close()
|
||||||
|
|
||||||
return gitRepoTopLevelDirectoryPath
|
return gitRepoTopLevelDirectoryPath
|
||||||
|
@ -30,7 +30,7 @@ end
|
||||||
|
|
||||||
function addGitTopLevelDirectoryToRuntimePath()
|
function addGitTopLevelDirectoryToRuntimePath()
|
||||||
local gitTopLevelPath = gitTopLevelDirectory()
|
local gitTopLevelPath = gitTopLevelDirectory()
|
||||||
if string.len(gitTopLevelPath) == 0 then
|
if gitTopLevelPath == nil or string.len(gitTopLevelPath) == 0 then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue