Added syntax highlighting to zsh and some other minor tweaks
This commit is contained in:
5
.config/nvim/after/ftplugin/zsh.lua
Normal file
5
.config/nvim/after/ftplugin/zsh.lua
Normal file
@@ -0,0 +1,5 @@
|
||||
Event = 'VeryLazy'
|
||||
|
||||
vim.opt_local.tabstop = 2 -- number of visual spaces per TAB
|
||||
vim.opt_local.softtabstop = 2 -- number of idfk tab when editing
|
||||
vim.opt_local.shiftwidth = 2 -- number of spaces to insert on tab
|
||||
7
.config/nvim/after/queries/bash/highlights.scm
Normal file
7
.config/nvim/after/queries/bash/highlights.scm
Normal file
@@ -0,0 +1,7 @@
|
||||
;extends
|
||||
|
||||
; highlight `return` and `exit` like return statements in other languages with
|
||||
; `@keyword.return`
|
||||
|
||||
((word) @keyword.return
|
||||
(#any-of? @keyword.return "return" "exit"))
|
||||
@@ -6,7 +6,6 @@ return {
|
||||
---@type userdata
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
require('nvim-treesitter.configs').setup({
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = true,
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
@@ -16,6 +15,17 @@ return {
|
||||
max_file_lines = nil,
|
||||
},
|
||||
})
|
||||
|
||||
-- HACK: Workaround to have syntax highlighting in zsh until a zsh parser is added
|
||||
-- https://github.com/nvim-treesitter/nvim-treesitter/issues/655
|
||||
local ft_to_lang = require('nvim-treesitter.parsers').ft_to_lang
|
||||
---@diagnostic disable-next-line: duplicate-set-field
|
||||
require('nvim-treesitter.parsers').ft_to_lang = function(ft)
|
||||
if ft == 'zsh' then
|
||||
return 'bash'
|
||||
end
|
||||
return ft_to_lang(ft)
|
||||
end
|
||||
end,
|
||||
},
|
||||
{
|
||||
|
||||
30
.zshrc
30
.zshrc
@@ -2,11 +2,11 @@ START_TIME=$(date +%s.%3N)
|
||||
|
||||
# Install zinit if missing
|
||||
if [[ ! -f $HOME/.local/share/zinit/zinit.git/zinit.zsh ]]; then
|
||||
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
|
||||
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
|
||||
command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
|
||||
print -P "%F{33} %F{34}Installation successful.%f%b" || \
|
||||
print -P "%F{160} The clone has failed.%f%b"
|
||||
print -P "%F{33} %F{220}Installing %F{33}ZDHARMA-CONTINUUM%F{220} Initiative Plugin Manager (%F{33}zdharma-continuum/zinit%F{220})…%f"
|
||||
command mkdir -p "$HOME/.local/share/zinit" && command chmod g-rwX "$HOME/.local/share/zinit"
|
||||
command git clone https://github.com/zdharma-continuum/zinit "$HOME/.local/share/zinit/zinit.git" && \
|
||||
print -P "%F{33} %F{34}Installation successful.%f%b" || \
|
||||
print -P "%F{160} The clone has failed.%f%b"
|
||||
fi
|
||||
|
||||
# Load Zinit
|
||||
@@ -73,9 +73,9 @@ export EDITOR=nvim
|
||||
export PAGER=nvimpager
|
||||
export MANPAGER='nvim +Man!'
|
||||
export FZF_DEFAULT_OPTS=" \
|
||||
--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 \
|
||||
--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc \
|
||||
--color=marker:#f5e0dc,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8"
|
||||
--color=bg+:#313244,bg:#1e1e2e,spinner:#f5e0dc,hl:#f38ba8 \
|
||||
--color=fg:#cdd6f4,header:#f38ba8,info:#cba6f7,pointer:#f5e0dc \
|
||||
--color=marker:#f5e0dc,fg+:#cdd6f4,prompt:#cba6f7,hl+:#f38ba8"
|
||||
|
||||
export GOPATH="$HOME/go"
|
||||
export PATH="$GOPATH/bin:$PATH"
|
||||
@@ -92,17 +92,17 @@ esac
|
||||
# Start ssh-agent if not running
|
||||
eval $(keychain --quiet --eval --timeout 300 ~/.ssh/id_ed25519)
|
||||
|
||||
# HACK: Send a notification so systemd notification will work
|
||||
MARKER_FILE="/run/user/$(id -u)/zshrc_once_marker"
|
||||
if [ ! -f "$MARKER_FILE" ]; then
|
||||
notify-send --urgency=normal --expire-time=1 " "
|
||||
touch "$MARKER_FILE"
|
||||
fi
|
||||
|
||||
# Open tmux if it's not open
|
||||
# if [ -z "$TMUX" ]; then
|
||||
# tmux a || tmux
|
||||
# fi
|
||||
|
||||
# HACK: Send a notification so systemd notification will work
|
||||
MARKER_FILE="/run/user/$(id -u)/zshrc_once_marker"
|
||||
if [ ! -f "$MARKER_FILE" ]; then
|
||||
notify-send --urgency=normal --expire-time=1 " "
|
||||
touch "$MARKER_FILE"
|
||||
fi
|
||||
|
||||
END_TIME=$(date +%s.%4N)
|
||||
echo "Zsh startup time: $(echo "${END_TIME} - ${START_TIME}" | bc) seconds"
|
||||
|
||||
Reference in New Issue
Block a user