Skip to content

Commit 4446069

Browse files
committed
fix(template): Use env variable USERNAME in Windows
1 parent 22094c4 commit 4446069

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Diff for: lua/orgmode/capture/template/init.lua

+3-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ local Calendar = require('orgmode.objects.calendar')
66
local Promise = require('orgmode.utils.promise')
77
local Input = require('orgmode.ui.input')
88

9+
local is_windows = vim.loop.os_uname().sysname == 'Windows_NT'
10+
911
local expansions = {
1012
['%%f'] = function()
1113
return vim.fn.expand('%')
@@ -14,7 +16,7 @@ local expansions = {
1416
return vim.fn.expand('%:p')
1517
end,
1618
['%%n'] = function()
17-
return os.getenv('USER')
19+
return is_windows and os.getenv('USERNAME') or os.getenv('USER')
1820
end,
1921
['%%x'] = function()
2022
return vim.fn.getreg('+')

0 commit comments

Comments
 (0)