|
1 | 1 | -- Set <space> as the leader key |
2 | 2 | -- See `:help mapleader` |
3 | 3 | -- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used) |
| 4 | + |
| 5 | +if vim.fn.exists 'g:os' == 0 then |
| 6 | + local is_windows = vim.fn.has 'win64' == 1 or vim.fn.has 'win32' == 1 or vim.fn.has 'win16' == 1 |
| 7 | + if is_windows then |
| 8 | + vim.g.os = 'Windows' |
| 9 | + else |
| 10 | + local uname_output = vim.fn.system 'uname' |
| 11 | + vim.g.os = string.gsub(uname_output, '\n', '') |
| 12 | + end |
| 13 | +end |
| 14 | + |
4 | 15 | vim.g.mapleader = ' ' |
5 | 16 | vim.g.maplocalleader = ' ' |
6 | 17 |
|
@@ -452,7 +463,7 @@ require('lazy').setup({ |
452 | 463 | -- Where to put new notes. Valid options are |
453 | 464 | -- * "current_dir" - put new notes in same directory as the current buffer. |
454 | 465 | -- * "notes_subdir" - put new notes in the default notes subdirectory. |
455 | | - new_notes_location = 'notes_subdir', |
| 466 | + new_notes_location = 'current_dir', |
456 | 467 |
|
457 | 468 | -- Optional, customize how note IDs are generated given an optional title. |
458 | 469 | ---@param title string|? |
@@ -540,9 +551,13 @@ require('lazy').setup({ |
540 | 551 | ---@param url string |
541 | 552 | follow_url_func = function(url) |
542 | 553 | -- Open the URL in the default web browser. |
543 | | - vim.fn.jobstart { 'open', url } -- Mac OS |
| 554 | + |
| 555 | + if vim.g.os == 'Windows' then |
| 556 | + vim.cmd(':silent exec "!start ' .. url .. '"') -- Windows |
| 557 | + else |
| 558 | + vim.fn.jobstart { 'open', url } -- Mac OS |
| 559 | + end |
544 | 560 | -- vim.fn.jobstart({"xdg-open", url}) -- linux |
545 | | - -- vim.cmd(':silent exec "!start ' .. url .. '"') -- Windows |
546 | 561 | -- vim.ui.open(url) -- need Neovim 0.10.0+ |
547 | 562 | end, |
548 | 563 |
|
|
0 commit comments