diff options
| -rw-r--r-- | ghostty/.config/ghostty/config.ghostty | 1 | ||||
| -rw-r--r-- | neovim/.config/nvim/lua/config/autocmds.lua | 21 |
2 files changed, 22 insertions, 0 deletions
diff --git a/ghostty/.config/ghostty/config.ghostty b/ghostty/.config/ghostty/config.ghostty index 93c790c..774014f 100644 --- a/ghostty/.config/ghostty/config.ghostty +++ b/ghostty/.config/ghostty/config.ghostty | |||
| @@ -1,6 +1,7 @@ | |||
| 1 | keybind = ctrl+,=unbind | 1 | keybind = ctrl+,=unbind |
| 2 | window-decoration = true | 2 | window-decoration = true |
| 3 | working-directory = home | 3 | working-directory = home |
| 4 | window-inherit-working-directory = false | ||
| 4 | font-size = 11 | 5 | font-size = 11 |
| 5 | font-family = "JetBrainsMono NL Nerd Font Mono" | 6 | font-family = "JetBrainsMono NL Nerd Font Mono" |
| 6 | 7 | ||
diff --git a/neovim/.config/nvim/lua/config/autocmds.lua b/neovim/.config/nvim/lua/config/autocmds.lua index e9ebe04..5ebe5ec 100644 --- a/neovim/.config/nvim/lua/config/autocmds.lua +++ b/neovim/.config/nvim/lua/config/autocmds.lua | |||
| @@ -13,6 +13,27 @@ vim.api.nvim_create_autocmd("BufWritePre", { | |||
| 13 | callback = strip_trailing_whitespace, | 13 | callback = strip_trailing_whitespace, |
| 14 | }) | 14 | }) |
| 15 | 15 | ||
| 16 | -- Make the directory Neovim was opened with (`nvim .`, `nvim ~/project`, | ||
| 17 | -- `nvim /some/dir`) the cwd for the whole session, not just the cwd of the | ||
| 18 | -- directory-listing buffer it shows. Only fires for the "single directory | ||
| 19 | -- argument" invocation; opening files, multiple args, or no args leaves cwd | ||
| 20 | -- untouched. Uses chdir() (global scope, like :cd) rather than :lcd/:tcd | ||
| 21 | -- since this should apply session-wide. This itself fires DirChanged, so | ||
| 22 | -- the handler below re-runs and correctly picks up a .nvim.lua for the new | ||
| 23 | -- directory too. | ||
| 24 | vim.api.nvim_create_autocmd("VimEnter", { | ||
| 25 | callback = function() | ||
| 26 | if vim.fn.argc() ~= 1 then | ||
| 27 | return | ||
| 28 | end | ||
| 29 | local arg = vim.fn.argv(0) | ||
| 30 | if vim.fn.isdirectory(arg) == 0 then | ||
| 31 | return | ||
| 32 | end | ||
| 33 | vim.fn.chdir(vim.fn.fnamemodify(arg, ":p")) | ||
| 34 | end, | ||
| 35 | }) | ||
| 36 | |||
| 16 | -- Project-local config: search upward from cwd for a .nvim.lua, the same | 37 | -- Project-local config: search upward from cwd for a .nvim.lua, the same |
| 17 | -- nearest-ancestor pattern LSP root-dir detection uses, so it's found | 38 | -- nearest-ancestor pattern LSP root-dir detection uses, so it's found |
| 18 | -- regardless of exactly which subdirectory Neovim's cwd is or how you got | 39 | -- regardless of exactly which subdirectory Neovim's cwd is or how you got |
