Compare commits

...

5 commits

Author SHA1 Message Date
Ade Attwood
8cdd862133 feat(core): make wezterm nushell and nvim adapt theme
Now all the terminal themes will adapt with the system theme. Like other apps
it will not do this automatically, however needing to restart the terminal
session is not to much is an issue.
2025-07-25 11:29:07 +01:00
Ade Attwood
2b73b75ad3 refactor(vim): make the the status even more basic 2025-07-25 11:26:09 +01:00
Ade Attwood
adf01758f0 fix(terminal): wezterm nvim switch pane integration
When working on windows the top most process name is the current foreground
process name. For example if you are runing something like a terminal in nvim
the terminal process is the foreground like `nu`

This now gets the full process stack and if any of the processes in the stack
are a editor then it will send the binding to the editor to change the pane.

This now will give you windows wezterm integration for the tmux navigator
custom plugins.
2025-07-25 09:13:30 +01:00
Ade Attwood
42cbeed7de fix(nu): support windows nicely
The main thing we are doing is setting the `HOME` and `USER` env variables so
we can use comon variables over linux and windows.

There is also a windows wezterm issue `shell_integration.osc133` feature needs
to be disabled. This will stop the prompt adding a new line on every char typed
into the prompt.
2025-07-25 09:03:11 +01:00
Ade Attwood
18ce1c8695 refactor(emacs): updates for some windows writing 2025-07-25 08:57:08 +01:00
7 changed files with 88 additions and 115 deletions

View file

@ -33,15 +33,15 @@ This is better than the `C-x +` and C-x - because this is global to emacs not
just in in the current buffer."
(interactive "nFont Size: ")
(setq aa-font "Hack Nerd Font Mono")
(setq aa-v-font "ETBembo")
(setq aa-font "Hasklug Nerd Font")
(setq aa-v-font "Hasklug Nerd Font")
(set-face-attribute 'default nil :font aa-font :height a-font-size)
(set-face-attribute 'fixed-pitch nil :font aa-font :height a-font-size)
(set-face-attribute 'variable-pitch nil :font aa-v-font :height (+ a-font-size 30) :weight 'regular))
;; Set the default font size when emacs starts
(aa/set-font 100)
(aa/set-font 120)
(use-package all-the-icons
:straight t
@ -95,7 +95,6 @@ just in in the current buffer."
(require 'org-tempo)
(require 'ob)
(add-hook 'org-mode-hook 'variable-pitch-mode)
(use-package ob-nushell
:straight '(ob-nushell :type git :host github :repo "ln-nl/ob-nushell")
@ -232,7 +231,7 @@ just in in the current buffer."
`((,(concat (file-name-as-directory org-directory) "Todo.org") :maxlevel . 1)))
(add-hook 'org-mode-hook (lambda ()
(electric-pair-mode)
(visual-line-mode)
(org-indent-mode)
(flyspell-mode)))

View file

@ -1,3 +1,8 @@
if ((sys host | get name) == "Windows") {
$env.HOME = $env.USERPROFILE
$env.USER = $env.USERNAME
}
use path.nu *
use fzf.nu *
@ -5,9 +10,6 @@ use neovim.nu *
use prompt.nu *
use sapling.nu *
use nvm.nu *
use rvm.nu *
nvm use default
$env.config = {
show_banner: false,
@ -15,10 +17,16 @@ $env.config = {
env_change: {
PWD: [
{|_, after| nvm dir-hook $after }
{|_, after| rvm-dir-hook $after }
{|_, after| node-modules-dir-hook $after }
]
}
}
}
$env.config.show_banner = false
$env.config.shell_integration.osc133 = false
if $env.OS_THEME == "Light" {
use std/config light-theme
$env.config.color_config = (light-theme)
}

View file

@ -1,84 +1,13 @@
def 'nvm path' [subdir?: string]: nothing -> string {
if ($subdir | into string | str length) == 0 {
return $"($env.HOME)/.nvm"
}
$"($env.HOME)/.nvm/($subdir)"
}
export def 'nvm get-alias' [alias: string]: nothing -> string {
mut alias_version = if ($alias | find "stable" | is-not-empty) {
["lts/*"]
} else {
nvm aliases | where {|x| $x == $alias}
}
if $alias_version == ["stable"] {
$alias_version = ["lts/*"]
}
if ($alias_version | is-empty) {
return null
}
if ($alias_version | length) > 1 {
$alias_version = [$"($alias_version | first)/*"]
}
let version = (open ([(nvm path "alias"), ($alias_version | first)] | path join)) | str trim
if not ($version | str starts-with "v") {
return (nvm get-alias $version)
}
$version
}
def 'nvm index' [] {
http get 'https://nodejs.org/dist/index.json' | get version
}
export def 'nvm aliases' [] {
ls -a ...(glob (nvm path "alias/**/*"))
| each {|p| $p.name | path relative-to (nvm path "alias") }
| filter {|p| not ($p | str ends-with "*")}
| uniq
}
export def 'nvm list' [] {
ls -a (nvm path "versions/node")
| each {|p| $p.name | path relative-to (nvm path "versions/node") }
| filter {|p| not ($p | str ends-with "*")}
}
export def 'nvm resolve' [version: string] {
let resolved_version = (nvm list | find $version)
let resolved_alias = (nvm get-alias $version)
if (($resolved_version | length) != 1) and ($resolved_alias | is-empty) {
(error make --unspanned { msg: $"Unable to resolve '($version)'" })
}
if not ($resolved_version | is-empty) {
$resolved_version | first
} else {
$resolved_alias
}
}
export def --env 'nvm use' [version: string] {
let resolved = (nvm resolve $version)
let node_path = [(nvm path "versions/node") $resolved] | path join
$env.PATH = $env.PATH
| split row ":"
| where {|x| not ($x | str starts-with (nvm path "versions/node"))}
| prepend ([$node_path "bin"] | path join)
| str join ":"
}
export def --env 'nvm dir-hook' [dir: string] {
let file = $"($dir)/.nvmrc"
if ($file | path exists) and ($file | path type) == "file" {
nvm use (open $file | lines | get 0) | str trim
let version = (open $file | lines | get 0 | str trim)
if (nvm list | find $version | is-empty) {
nvm install $version
nvm use $version
npm i -g typescript-language-server typescript emmet-ls cspell vscode-langservers-extracted yarn
} else {
nvm use $version | complete | ignore
}
}
}

View file

@ -1,20 +1,22 @@
export-env {
$env.GOPATH = $"($env.HOME)/Code"
$env.GOPATH = if ($env.COMPUTERNAME == "LAFITE") {
$"D:/Code"
} else {
$"($env.HOME)/Code"
}
$env.PATH = $env.PATH
| split row ":"
| prepend ([$env.HOME ".cargo" "bin"] | path join)
| str join ":"
}
export def --env node-modules-dir-hook [dir: string] {
let nodePath = ([$dir, "node_modules", ".bin"] | path join)
if ($nodePath | path exists) {
$env.PATH = $env.PATH
| split row ":"
| where {|x| not ($x | str contains "node_modules")}
| prepend $nodePath
| str join ":"
}
}

View file

@ -1,9 +1,11 @@
" Set color theme
lua << EOF
require("nord").setup({})
EOF
colorscheme nord
" Set color theme based on the OS theme
if $OS_THEME ==# 'Dark'
set background=dark
colorscheme tairiki
else
set background=light
colorscheme tairiki
end
" Set tailing white space to errors
match ErrorMsg '\s\+$'

View file

@ -1,10 +1,2 @@
" The most basic status line ever
function GitStatus()
return trim(system("git diff --shortstat 2> /dev/null | awk '{print \"+\"$4\" -\"$6}'"))
endfunction
function GitBranch()
return trim(system("git rev-parse --abbrev-ref HEAD 2> /dev/null || echo 'no-git'"))
endfunction
set statusline=\ %y%r\ %m%f:%l:%c%=[%{GitBranch()}]\ %{GitStatus()}\
set statusline=\ %y%r\ %m%f:%l:%c%=

View file

@ -1,17 +1,54 @@
local wezterm = require "wezterm"
function scheme_for_appearance(appearance)
if appearance:find 'Dark' then
return 'Tomorrow Night'
else
return 'Tomorrow'
end
end
local scheme = wezterm.get_builtin_color_schemes()
local theme = scheme["Poimandres"]
local theme = scheme[scheme_for_appearance(wezterm.gui.get_appearance())]
function collect_executables(process)
local executables = {}
if process.executable then
table.insert(executables, process.executable)
end
if process.ppid and process.ppid > 0 then
local parent_process = wezterm.procinfo.get_info_for_pid(process.ppid)
if parent_process then
local parent_executables = collect_executables(parent_process)
for _, exe in ipairs(parent_executables) do
table.insert(executables, exe)
end
end
end
return executables
end
local function matches_editor(process)
local executables = collect_executables(process)
for _, executable in ipairs(executables) do
if string.match(executable, "vim") or string.match(executable, "emacs") then
return true
end
end
return false
end
local function vim_pass_though_action(config)
return {
key = config.key,
mods = config.mods,
action = wezterm.action_callback(function(win, pane)
local process_name = pane:get_foreground_process_name()
-- If we are in vim then we want to send the key to go to the net pain
if string.match(process_name, "vim") or string.match(process_name, "emacs") then
if matches_editor(pane:get_foreground_process_info()) then
win:perform_action({ SendKey = { key = config.key, mods = config.mods } }, pane)
return
end
@ -26,11 +63,15 @@ return {
-- You will need to install the beta version of the font to get the ligatures
-- https://github.com/intel/intel-one-mono/issues/9#issuecomment-1994958719
font = wezterm.font {
family = "FiraCode Nerd Font Mono",
family = "Hasklug Nerd Font Mono",
},
set_environment_variables = {
OS_THEME = wezterm.gui.get_appearance()
},
-- -- The nord theme to fit with everyting else
color_scheme = "Poimandres",
color_scheme = scheme_for_appearance(wezterm.gui.get_appearance()),
colors = {
tab_bar = {
background = theme.background,
@ -75,7 +116,7 @@ return {
audible_bell = "Disabled",
-- Have a really clean UI when there is only one tab open
hide_tab_bar_if_only_one_tab = false,
hide_tab_bar_if_only_one_tab = true,
-- Disabled all the padding, this makes vim look a lot nicer when all the
-- window bars go to the edges of the terminal