Skip to content

Commit

Permalink
feat(nvim): introducing chezmoi plugins
Browse files Browse the repository at this point in the history
  • Loading branch information
kalocsaibotond committed Mar 24, 2024
1 parent ab84f23 commit 625b85b
Show file tree
Hide file tree
Showing 9 changed files with 74 additions and 32 deletions.
20 changes: 10 additions & 10 deletions home/Documents/PowerShell/Functions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -29,18 +29,18 @@ function Add-ContextMenuDir

if ($Global){
if (Test-Path $registryContextMenuLocation){
Remove-PSDrive HKCR | Out-Null
Remove-PSDrive HKCR
New-PSDrive @{
PSProvider = "registry"
Root = "HKEY_CLASSES_ROOT"
Name = "HKCR"
) | Out-Null
}
} else {
New-PSDrive
New-PSDrive @{
PSProvider = "registry"
Root = "HKEY_CLASSES_ROOT"
Name = "HKCR"
) | Out-Null
}
}
$psDriveClasses = "HKCR:"
} else {
Expand All @@ -59,7 +59,7 @@ function Add-ContextMenuDir
Join-Path $psDriveClasses $shell
) $DisplayName

New-Item -Path $registryPath -Force | Out-Null
New-Item -Path $registryPath -Force
Set-ItemProperty @{
Path = $registryPath
Name = "(Default)"
Expand All @@ -72,7 +72,7 @@ function Add-ContextMenuDir
}

$commandPath = Join-Path $registryPath "command"
New-Item -Path $commandPath -Force | Out-Null
New-Item -Path $commandPath -Force
Set-ItemProperty @{
Path = $commandPath
Name = "(Default)"
Expand Down Expand Up @@ -101,18 +101,18 @@ function Remove-ContextMenuDir

if ($Global){
if (Test-Path $registryContextMenuLocation){
Remove-PSDrive HKCR | Out-Null
Remove-PSDrive HKCR
New-PSDrive @{
PSProvider = "registry"
Root = "HKEY_CLASSES_ROOT"
Name = "HKCR"
} | Out-Null
}
} else {
New-PSDrive @{
PSProvider = "registry"
Root = "HKEY_CLASSES_ROOT"
Name = "HKCR"
} | Out-Null
}
}
$psDriveClasses = "HKCR:"
} else {
Expand All @@ -130,6 +130,6 @@ function Remove-ContextMenuDir
$registryPath = Join-Path (
Join-Path $psDriveClasses $shell
) $DisplayName
Remove-Item -Path $registryPath -Force -Recurse | Out-Null
Remove-Item -Path $registryPath -Force -Recurse
}
}
14 changes: 14 additions & 0 deletions home/dot_config/nvim/lua/config/autocmds.lua
Original file line number Diff line number Diff line change
@@ -1,3 +1,17 @@
-- Autocmds are automatically loaded on the VeryLazy event
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
-- Add any additional autocmds here

-- Chezmoi
local chezmoi_worktree = vim.env.HOME .. "/.local/share/chezmoi/**"
-- chezmoi_worktree = vim.api.nvim_exec2(
-- "!chezmoi execute-template '{{.chezmoi.workingTree}}/**'", -- HACK: abusing chezmoi template execution
-- { output = false }
-- )[0]
-- vim.print(chezmoi_worktree) -- ize ize ize
vim.api.nvim_create_autocmd({ "BufRead", "BufNewFile" }, {
pattern = { chezmoi_worktree },
callback = function()
vim.schedule(require("chezmoi.commands.__edit").watch)
end,
})
10 changes: 10 additions & 0 deletions home/dot_config/nvim/lua/config/keymaps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,13 @@ vim.keymap.set("n", "<space>rs", "<cmd>IronRepl<cr>")
vim.keymap.set("n", "<space>rr", "<cmd>IronRestart<cr>")
vim.keymap.set("n", "<space>rF", "<cmd>IronFocus<cr>")
vim.keymap.set("n", "<space>rh", "<cmd>IronHide<cr>")

-- Chezmoi
local telescope = require("telescope")
telescope.load_extension("chezmoi")
vim.keymap.set(
"n",
"<leader>fz",
telescope.extensions.chezmoi.find_files,
{ desc = "Find Chezmoi Source File" }
)
20 changes: 20 additions & 0 deletions home/dot_config/nvim/lua/plugins/chezmoi.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
return {
{
"alker0/chezmoi.vim", -- For syntax highlighting
lazy = false,
init = function()
-- This option is required.
vim.g["chezmoi#use_tmp_buffer"] = true
-- add other options here if needed.
end,
},
{
"xvzc/chezmoi.nvim", -- For chezmoi-managed file editing, applying
dependencies = { "nvim-lua/plenary.nvim" },
config = function()
require("chezmoi").setup({
-- your configurations
})
end,
},
}
34 changes: 17 additions & 17 deletions home/dot_config/nvim/lua/plugins/iron-repl.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
return { -- https://dev.to/rnrbarbosa/how-to-run-python-on-neovim-like-jupyter-3ln0
return { -- https://dev.to/rnrbarbosa/how-to-run-python-on-neovim-like-jupyter-3ln0
"Vigemus/iron.nvim",
config = function(plugins, opts)
local iron = require("iron.core")
Expand All @@ -9,22 +9,22 @@ return { -- https://dev.to/rnrbarbosa/how-to-run-python-on-neovim-like-jupyter-
scratch_repl = true,
-- Your repl definitions come here
repl_definition = {
python = {
command = {"ipython"},
-- format = require("iron.fts.common").bracketed_paste,
},
powershell = {
command = {"pwsh -ExecutionPolicy ByPass -NoExit"},
-- format = require("iron.fts.common").bracketed_paste,
},
sh = {
command = {"bash"},
-- format = require("iron.fts.common").bracketed_paste,
},
batch = {
command = {"cmd"},
-- format = require("iron.fts.common").bracketed_paste,
}
python = {
command = { "ipython" },
-- format = require("iron.fts.common").bracketed_paste,
},
powershell = {
command = { "pwsh -ExecutionPolicy ByPass -NoExit" },
-- format = require("iron.fts.common").bracketed_paste,
},
sh = {
command = { "bash" },
-- format = require("iron.fts.common").bracketed_paste,
},
batch = {
command = { "cmd" },
-- format = require("iron.fts.common").bracketed_paste,
},
},
-- How the repl window will be displayed
-- See below for more information
Expand Down
3 changes: 0 additions & 3 deletions home/dot_config/nvim/stylua.toml

This file was deleted.

2 changes: 1 addition & 1 deletion home/dot_local/windows_setup/Install-WindowsSetup.ps1.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ winget install @(

# Set up configuration

.\Add-ContextMenuDir.ps1 @{
Add-ContextMenuDir @{
DisplayName = "WezTerm"
ApplicationPath = "$(scoop prefix wezterm)\wezterm-gui.exe"
ApplicationArgs = 'start --no-auto-connect --cwd "%V"'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

# Cleaning up configuration

Remove-ContextMenuDir.ps1 -DisplayName "WezTerm"
Remove-ContextMenuDir -DisplayName "WezTerm"

$Targets = @(chezmoi managed --include files --path-style absolute)
foreach ($Target in $Targets) {
Expand Down
1 change: 1 addition & 0 deletions stylua.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
column_width = 79

0 comments on commit 625b85b

Please sign in to comment.