From 5612bca52703a371128f16c8e00ac95a8c4a8706 Mon Sep 17 00:00:00 2001 From: ElKowar <5300871+elkowar@users.noreply.github.com> Date: Fri, 17 Sep 2021 13:01:40 +0200 Subject: [PATCH] laptop stuff --- nvim/.config/nvim/fnl/dots/plugins.fnl | 13 +++--- nvim/.config/nvim/fnl/dots/plugins/lsp.fnl | 5 +-- scripts/scripts/battery_indicator.sh | 10 +++++ zsh/.config/zsh/.zshrc | 40 ++++++++++++++++++ zsh/.config/zsh/fzf-tab.zsh | 23 +++++++++++ zsh/.config/zsh/prompt.zsh | 48 ++++++++++++++++++++++ 6 files changed, 130 insertions(+), 9 deletions(-) create mode 100755 scripts/scripts/battery_indicator.sh create mode 100644 zsh/.config/zsh/.zshrc create mode 100644 zsh/.config/zsh/fzf-tab.zsh create mode 100644 zsh/.config/zsh/prompt.zsh diff --git a/nvim/.config/nvim/fnl/dots/plugins.fnl b/nvim/.config/nvim/fnl/dots/plugins.fnl index 15018a4..86790e3 100644 --- a/nvim/.config/nvim/fnl/dots/plugins.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins.fnl @@ -3,7 +3,8 @@ (packer-use "/home/leon/coding/projects/nvim-gehzu" {} - "/home/leon/coding/projects/yuck.vim" {} + ;"/home/leon/coding/projects/yuck.vim" {} + :elkowar/yuck.vim {} :elkowar/antifennel-nvim {:config #(set vim.g.antifennel_executable "/home/leon/tmp/antifennel/antifennel")} :elkowar/kmonad.vim {} @@ -24,7 +25,7 @@ (set vim.g.gruvbox_italicise_strings 0) (set vim.g.gruvbox_filetype_hi_groups 1) (set vim.g.gruvbox_plugin_hi_groups 1) - (vim.cmd "colorscheme gruvbox8") + (vim.cmd "colorscheme gruvbox8_hard") (req dots.utils.highlight :SignColumn {:bg (. (require :dots.colors) :dark0)}))} ;(req dots.utils.highlight :LspDiagnosticsUnderlineError {:gui "underline"}))} @@ -113,10 +114,10 @@ ; code-related ----------------------------------------- <<< :ray-x/lsp_signature.nvim {:events [:BufEnter]} - "/home/leon/coding/prs/trouble.nvim" {:mod "dots.plugins.trouble" - :cmd ["Trouble" "TroubleClose" "TroubleRefresh" "TroubleToggle"]} - ;:folke/lsp-trouble.nvim {:mod "dots.plugins.trouble" - ;:cmd ["Trouble" "TroubleClose" "TroubleRefresh" "TroubleToggle"]} + ;"/home/leon/coding/prs/trouble.nvim" {:mod "dots.plugins.trouble" + ;:cmd ["Trouble" "TroubleClose" "TroubleRefresh" "TroubleToggle"]} + :folke/lsp-trouble.nvim {:mod "dots.plugins.trouble" + :cmd ["Trouble" "TroubleClose" "TroubleRefresh" "TroubleToggle"]} :simrat39/symbols-outline.nvim {:mod "dots.plugins.symbols-outline"} :neovim/nvim-lspconfig {} diff --git a/nvim/.config/nvim/fnl/dots/plugins/lsp.fnl b/nvim/.config/nvim/fnl/dots/plugins/lsp.fnl index 82342b7..efd6094 100644 --- a/nvim/.config/nvim/fnl/dots/plugins/lsp.fnl +++ b/nvim/.config/nvim/fnl/dots/plugins/lsp.fnl @@ -108,11 +108,10 @@ :server {:on_attach on_attach :cmd ["/home/leon/coding/prs/rust-analyzer/target/release/rust-analyzer"]}})) -(let [sumneko_root_path (.. vim.env.HOME "/.local/share/lua-language-server") - sumneko_binary (.. sumneko_root_path "/bin/Linux/lua-language-server")] +(let [sumneko_binary "/usr/bin/lua-language-server"] (init-lsp :sumneko_lua - {:cmd [sumneko_binary "-E" (.. sumneko_root_path "/main.lua")] + {:cmd [sumneko_binary] :settings {:Lua {:runtime {:version "LuaJIT" :path (vim.split package.path ";")} :diagnostics {:globals ["vim"]} diff --git a/scripts/scripts/battery_indicator.sh b/scripts/scripts/battery_indicator.sh new file mode 100755 index 0000000..dd7ed8e --- /dev/null +++ b/scripts/scripts/battery_indicator.sh @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +#output="$(upower -i /org/freedesktop/UPower/devices/battery_BAT1)" +percentage="$(cat /sys/class/power_supply/BAT1/capacity)" +status="$(cat /sys/class/power_supply/BAT1/status)" + + +echo "${percentage}%" + + diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc new file mode 100644 index 0000000..e74fbf8 --- /dev/null +++ b/zsh/.config/zsh/.zshrc @@ -0,0 +1,40 @@ +source ~/.zplug/init.zsh + +zplug 'zplug/zplug', hook-build:'zplug --self-manage' +zplug "plugins/git", from:oh-my-zsh +zplug "zsh-users/zsh-completions" +zplug "Aloxaf/fzf-tab", defer:2 +zplug "zsh-users/zsh-history-substring-search", defer:2 +zplug "zdharma/fast-syntax-highlighting", defer:2 + +if ! zplug check --verbose; then + printf "Install? [y/N]: " + if read -q; then + echo; zplug install + fi +fi +zplug load + +eval "$(zoxide init zsh)" + +source "$ZDOTDIR/fzf-tab.zsh" + + +setopt nobeep +setopt HIST_IGNORE_ALL_DUPS +autoload -Uz colors && colors +autoload -Uz promptinit && promptinit + +my-backward-delete-word() { + local WORDCHARS=${WORDCHARS/\//} + zle backward-delete-word +} +zle -N my-backward-delete-word +bindkey '^W' my-backward-delete-word +bindkey '^H' backward-delete-word + + +alias ls="exa --icons" + + +source "$ZDOTDIR/prompt.zsh" diff --git a/zsh/.config/zsh/fzf-tab.zsh b/zsh/.config/zsh/fzf-tab.zsh new file mode 100644 index 0000000..5bea142 --- /dev/null +++ b/zsh/.config/zsh/fzf-tab.zsh @@ -0,0 +1,23 @@ +#!/usr/bin/env zsh + +FZF_TAB_COMMAND=( + fzf + --ansi + --expect='$continuous_trigger' # For continuous completion + '--color=hl:$(( $#headers == 0 ? 108 : 255 ))' + --nth=2,3 --delimiter='\x00' # Don't search prefix + --layout=reverse --height="''${FZF_TMUX_HEIGHT:=50%}" + --tiebreak=begin -m --bind=tab:down,btab:up,change:top,ctrl-space:toggle --cycle + '--query=$query' # $query will be expanded to query string at runtime. + '--header-lines=$#headers' # $#headers will be expanded to lines of headers at runtime + ) +zstyle ':fzf-tab:*' command $FZF_TAB_COMMAND +zstyle ':completion:complete:*:options' sort false +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS} +zstyle ':fzf-tab:complete:_zlua:*' query-string input +zstyle ':fzf-tab:complete:*:*' fzf-preview '/home/leon/scripts/preview.sh $realpath' + + + + + diff --git a/zsh/.config/zsh/prompt.zsh b/zsh/.config/zsh/prompt.zsh new file mode 100644 index 0000000..56833a0 --- /dev/null +++ b/zsh/.config/zsh/prompt.zsh @@ -0,0 +1,48 @@ +#!/usr/bin/env zsh + +local __bright_cyan="#8ec07c" +local __bright_white="#ebdbb2" +local __bright_green="#b8bb26" + +dir() { + local CUTOFF=3 + local IFS=/ + local my_path=($(print -P '%~')) + local p + for p in $my_path; do + printf %s "${s}${p[0,$CUTOFF]}" + local s=/ + done + printf '%s\n' "${p:$CUTOFF}" +} + + +git_status() { + local BRANCH=$(git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/*\s*\(.*\)/\1/') + + if [ ! -z $BRANCH ]; then + echo -n "(%F{$__bright_cyan}$BRANCH%F{$__bright_white}" + [ ! -z "$(git status --short)" ] && echo -n "*" + echo -n ")%f" + fi +} + +function _my_prompt() { + local exit_code="$?" + echo -n "%F{$__bright_white}╭───" + echo -n "%F{$__bright_cyan}$USER" + echo -n "%F{$__bright_white} in" + echo -n "%F{$__bright_green} $(dir)" + echo -n "%F{$__bright_white} $(git_status)" + if [ ! "$exit_code" = 0 ]; then + echo -n "%F{red} REEEEEEEEEEE $exit_code" + fi + echo + # %3{stuff%} tell's zsh that the characters are printed as 3 chars wide + echo -n "%F{$__bright_white}%3{╰─λ%} " +} + + +setopt prompt_subst +autoload -U colors && colors +PS1='$(_my_prompt)'