Auto dark/light mode switching, fix Mason

This commit is contained in:
Bartek Stalewski 2024-09-26 02:21:11 +02:00
parent 0d1e6f2967
commit 4d516d6b9d
Signed by: ftpd
SSH Key Fingerprint: SHA256:vGQiaNJcfUMLt3wF58+Zx15C6SpRDA9spUeggjVY8Yo
7 changed files with 58 additions and 23 deletions

View File

@ -25,6 +25,12 @@ M.ui = {
statusline = { statusline = {
theme = "vscode_colored", theme = "vscode_colored",
} }
}
M.mason = {
cmd = true,
pkgs = {"lua-language-server"}
} }
return M return M

View File

@ -1,3 +1,10 @@
--local function set_theme(name)
-- local cur_theme = require('nvconfig').ui.theme
-- require("nvchad.utils").replace_word(cur_theme, name)
-- require('nvconfig').ui.theme = name
-- require('base46').load_all_highlights()
--end
return { return {
{ {
"stevearc/conform.nvim", "stevearc/conform.nvim",
@ -16,15 +23,6 @@ return {
-- end, -- end,
-- }, -- },
{
"williamboman/mason.nvim",
opts = {
ensure_installed = {
"lua-language-server",
},
},
},
{ {
"nvim-treesitter/nvim-treesitter", "nvim-treesitter/nvim-treesitter",
opts = { opts = {
@ -40,12 +38,19 @@ return {
}, },
}, },
{ -- {
"kdheepak/lazygit.nvim", -- "f-person/auto-dark-mode.nvim",
keys = { -- event = 'VeryLazy',
{ "<leader>lg", "<cmd>LazyGit<cr>", desc = "LazyGit" }, -- config = {
}, -- update_interval = 1000,
} -- set_dark_mode = function()
-- set_theme('monekai')
-- end,
-- set_light_mode = function()
-- set_theme('ayu_light')
-- end,
-- }
-- }
-- Install a plugin -- Install a plugin
-- { -- {

View File

@ -6,3 +6,4 @@ export XDG_STATE_HOME=$HOME/.local/state
export HISTFILE=$XDG_DATA_HOME/zsh/history export HISTFILE=$XDG_DATA_HOME/zsh/history
export HISTSIZE=10000 export HISTSIZE=10000
export SAVEHIST=$HISTSIZE export SAVEHIST=$HISTSIZE
source $ZDOTDIR/settheme.zsh

View File

@ -1,4 +1,4 @@
# mac specific configuration # macOS specific
if [[ $(uname -s) = "Darwin" ]]; then if [[ $(uname -s) = "Darwin" ]]; then
eval "$(/opt/homebrew/bin/brew shellenv)" eval "$(/opt/homebrew/bin/brew shellenv)"
fi fi
@ -36,7 +36,11 @@ fpath=(~/.local/git/zsh_modules/wd $fpath)
# theme and colors # theme and colors
if [[ $(command -v vivid) ]]; then if [[ $(command -v vivid) ]]; then
export LS_COLORS=$(vivid generate molokai) if [[ "${macos_interface_style}" = "Dark" ]]; then
export LS_COLORS=$(vivid generate molokai)
else
export LS_COLORS=$(vivid generate ayu)
fi
else else
unset LS_COLORS unset LS_COLORS
fi fi

View File

@ -12,7 +12,11 @@ gd() {
alias less='less -R' alias less='less -R'
if [[ $(command -v bat) ]]; then if [[ $(command -v bat) ]]; then
alias cat='bat -pp --color=always --tabs=2 --theme=Monokai\ Extended\ Bright' if [[ "${macos_interface_style}" = "Dark" ]]; then
alias cat='bat -pp --color=always --tabs=2 --theme=Monokai\ Extended\ Bright'
else
alias cat='bat -pp --color=always --tabs=2 --theme=Monokai\ Extended\ Light'
fi
fi fi
if [[ $(command -v eza) ]]; then if [[ $(command -v eza) ]]; then
@ -44,9 +48,6 @@ elif [ $(command -v vim) ] ; then
else else
export EDITOR=vi export EDITOR=vi
fi fi
if [ $(command -v zed) ] && [ $(id -u) -ne 0 ]; then
alias vim=zed
fi
if [[ $(command -v rg) ]]; then if [[ $(command -v rg) ]]; then
alias grep='rg -i' alias grep='rg -i'

View File

@ -2,8 +2,19 @@ if [[ $(command -v fzf) ]]; then
source <(fzf --zsh) source <(fzf --zsh)
export FZF_DEFAULT_COMMAND='fd -H -L --ignore-file ~/.local/config/fd' export FZF_DEFAULT_COMMAND='fd -H -L --ignore-file ~/.local/config/fd'
export FZF_CTRL_T_COMMAND='fd -H -L --ignore-file ~/.local/config/fd' export FZF_CTRL_T_COMMAND='fd -H -L --ignore-file ~/.local/config/fd'
export FZF_DEFAULT_OPTS="--multi -e --ansi --layout=reverse --preview='bat --color=always --tabs=2 --style=plain --theme=Monokai\ Extended\ Bright {}'" if [[ $macos_interface_style = "Light" ]]; then
export FZF_CTRL_R_OPTS="-e --ansi --layout=reverse --preview=''" FZF_COLORS='
--color=fg:#5C6166,fg+:#FCFCFC,bg:#FCFCFC,bg+:#5C6166
--color=hl:#4196df,hl+:#6daee6,info:#eba54d,marker:#80ab24
--color=prompt:#e7666a,spinner:#9870c3,pointer:#b294d2,header:#51b891
--color=border:#5C6166,label:#e7666a,query:#5C6166
--border="rounded" --border-label="" --preview-window="border-rounded" --prompt="> "
--marker=">" --pointer="◆" --separator="─" --scrollbar="│"'
else
FZF_COLORS=""
fi
export FZF_DEFAULT_OPTS=$FZF_COLORS" --multi -e --ansi --layout=reverse --preview='bat --color=always --tabs=2 --style=plain --theme=Monokai\ Extended\ Light {}'"
export FZF_CTRL_R_OPTS=$FZF_COLORS" -e --ansi --layout=reverse --preview=''"
_fzf_compgen_path() { _fzf_compgen_path() {
fd -H -L --ignore-file ~/.local/config/fd . "$1" fd -H -L --ignore-file ~/.local/config/fd . "$1"
} }

7
config/zsh/settheme.zsh Normal file
View File

@ -0,0 +1,7 @@
if [[ $(uname -s) = "Darwin" ]]; then
if defaults read -g AppleInterfaceStyle > /dev/null 2>&1; then
export macos_interface_style=Dark
else
export macos_interface_style=Light
fi
fi