[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>
 | 
			
		||||
 | 
			
		||||
require "os"
 | 
			
		||||
require 'os'
 | 
			
		||||
 | 
			
		||||
function gitTopLevelDirectory()
 | 
			
		||||
    local handle = io.popen("git rev-parse --show-toplevel")
 | 
			
		||||
    local handle = io.popen('git rev-parse --show-toplevel')
 | 
			
		||||
    if handle == nil then
 | 
			
		||||
        return nil
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
    local gitRepoTopLevelDirectoryPath = vim.fn.trim(handle:read("*a"))
 | 
			
		||||
    local gitRepoTopLevelDirectoryPath = vim.fn.trim(handle:read('*a'))
 | 
			
		||||
    handle:close()
 | 
			
		||||
 | 
			
		||||
    return gitRepoTopLevelDirectoryPath
 | 
			
		||||
| 
						 | 
				
			
			@ -30,7 +30,7 @@ end
 | 
			
		|||
 | 
			
		||||
function addGitTopLevelDirectoryToRuntimePath()
 | 
			
		||||
    local gitTopLevelPath = gitTopLevelDirectory()
 | 
			
		||||
    if string.len(gitTopLevelPath) == 0 then
 | 
			
		||||
    if gitTopLevelPath == nil or string.len(gitTopLevelPath) == 0 then
 | 
			
		||||
        return
 | 
			
		||||
    end
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue