From c185c81f2b845a153cdacd6f9f48c1a8effe7973 Mon Sep 17 00:00:00 2001 From: Andrew Scott Date: Wed, 28 Dec 2022 14:56:33 -0500 Subject: [PATCH] Various updates and new templating by hostname --- .chezmoiignore | 3 + Packages.txt | 78 ++++++++++++ dot_Xresources => dot_Xresources.tmpl | 3 +- dot_bash_profile | 2 - dot_bashrc | 2 + ...utable_bspwmrc => executable_bspwmrc.tmpl} | 25 +++- dot_config/nvim/init.vim | 113 ++++++++++++++++++ dot_config/{private_tint2 => tint2}/tint2rc | 0 dot_emacs.d/init.el | 13 +- dot_profile => dot_profile.tmpl | 2 + dot_xinputrc | 1 + 11 files changed, 232 insertions(+), 10 deletions(-) create mode 100644 .chezmoiignore create mode 100644 Packages.txt rename dot_Xresources => dot_Xresources.tmpl (98%) rename dot_config/bspwm/{executable_bspwmrc => executable_bspwmrc.tmpl} (78%) create mode 100644 dot_config/nvim/init.vim rename dot_config/{private_tint2 => tint2}/tint2rc (100%) rename dot_profile => dot_profile.tmpl (92%) create mode 100644 dot_xinputrc diff --git a/.chezmoiignore b/.chezmoiignore new file mode 100644 index 0000000..8355f29 --- /dev/null +++ b/.chezmoiignore @@ -0,0 +1,3 @@ +LICENSE +README.md +Packages.txt diff --git a/Packages.txt b/Packages.txt new file mode 100644 index 0000000..a544325 --- /dev/null +++ b/Packages.txt @@ -0,0 +1,78 @@ +# List of basic packages I typically install. You may not need all of them. +# Adjust as necessary. + +# Arch repos +bind +bspwm +sxhkd +pulseaudio +pulseaudio-bluetooth +pavucontrol +neofetch +dunst +emacs +galculator +git +gsimplecal +htop +dex +feh +emacs +gnome-keyring +logrotate +ncdu +neovim +nextcloud-client +noto-fonts-cjk +noto-fonts-emoji +kitty +ranger +redshift +rofi +rxvt-unicode +papirus-icon-theme +snapper # btrfs only +ttf-dejavu +ttf-fira-code +ttf-font-awesome +ttf-hack +ttf-ibm-plex +ttf-liberation +xsecurelock +xss-lock +polkit-gnome +xorg-xserver +xorg-xinit +xorg-xsetroot +xorg-xrandr +xorg-xset +xclip +maim +xdotool +dbus-pyton + +# AUR +arkenfox-user.js +birdtray +btrfs-du # more accurate du for btrfs +pa-notify +polybar +pulseaudio-control +needrestart +neovim-plug-git +gruvbox-dark-gtk +sbkeys +sbupdate-git +spotify +spotify-adblock-git +polybar-spotify +rofi-power-menu +st +vimix-gtk-themes-git +xidlehook + +# Laptop/Thinkpads (for xbacklight etc., your needs may vary) +acpi_call +acpi_call-lts # only if LTS kernel installed, see 'acpi_call-dkms' for other variants +acpilight # or 'light' is sometimes needed for older thinkpads +rtw89-dkms-git # wifi for thinkpad t14 gen2 amd, not needed for kernel 5.16 or later diff --git a/dot_Xresources b/dot_Xresources.tmpl similarity index 98% rename from dot_Xresources rename to dot_Xresources.tmpl index 4ef25dc..f72cba0 100644 --- a/dot_Xresources +++ b/dot_Xresources.tmpl @@ -4,9 +4,10 @@ ! https://github.com/jef/forest-night-xresources ! https://github.com/jnurmine/Zenburn ! ----------------------------------------------------------------------------- - +{{if eq .chezmoi.hostname "helix" }} ! Laptop screen DPI Xft.dpi: 216 +{{- end}} Xft.autohint: 0 Xft.lcdfilter: lcddefault diff --git a/dot_bash_profile b/dot_bash_profile index 799c2ac..13b41c3 100644 --- a/dot_bash_profile +++ b/dot_bash_profile @@ -8,5 +8,3 @@ if [ -z "${DISPLAY}" ] && [ "${XDG_VTNR}" -eq 1 ]; then exec startx fi - -export EDITOR=emacs diff --git a/dot_bashrc b/dot_bashrc index 6c11fd5..f85d0a6 100644 --- a/dot_bashrc +++ b/dot_bashrc @@ -8,6 +8,8 @@ alias ls='ls --color=auto' PS1='[\u@\h \W]\$ ' +export EDITOR=emacs + alias nv=nvim alias r="urxvt -name Ranger -e ranger & disown" alias kssh="/usr/bin/kitty +kitten ssh" diff --git a/dot_config/bspwm/executable_bspwmrc b/dot_config/bspwm/executable_bspwmrc.tmpl similarity index 78% rename from dot_config/bspwm/executable_bspwmrc rename to dot_config/bspwm/executable_bspwmrc.tmpl index c444b6b..ad2185a 100644 --- a/dot_config/bspwm/executable_bspwmrc +++ b/dot_config/bspwm/executable_bspwmrc.tmpl @@ -1,7 +1,11 @@ #!/bin/bash - +{{ if eq .chezmoi.hostname "helix" }} bspc monitor eDP-1 -d 1 2 3 4 5 6 7 8 9 10 - +{{ end }} +{{ if eq .chezmoi.hostname "hydrus"}} +bspc monitor DP-0 -d 1 2 3 4 5 +bspc monitor DVI-I-1 -d 6 7 8 9 10 +{{ end }} bspc config border_width 2 bspc config window_gap 10 bspc config top_padding 70 @@ -50,16 +54,25 @@ bspc desktop -f 1 grep -x sxhkd > /dev/null || sxhkd & /usr/lib/polkit-gnome/polkit-gnome-authentication-agent-1 & xss-lock -n /usr/lib/xsecurelock/dimmer -l -- xsecurelock & -xidlehook --not-when-audio --not-when-fullscreen --timer 120 "killall -q redshift && xrandr --output eDP-1 --brightness .1" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" --timer 480 "xset s activate" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" & xsettingsd & sh ~/.fehbg & pa-notify -t 3 & -#$HOME/.local/bin/single-polybar-launcher & -$HOME/.local/bin/tint2-launcher & redshift -r & picom & dunst & dex -a & -cbatticon -u 20 -i standard -c "systemctl hibernate" & birdtray & +{{- if eq .chezmoi.hostname "helix" }} +xidlehook --not-when-audio --not-when-fullscreen --timer 120 "killall -q redshift && xrandr --output eDP-1 --brightness .1" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" --timer 480 "xset s activate" "xrandr --output eDP-1 --brightness 1 && redshift -r & disown" & +cbatticon -u 20 -i standard -c "systemctl hibernate" & +$HOME/.local/bin/tint2-launcher & +{{- end }} +{{- if eq .chezmoi.hostname "hydrus"}} +xidlehook --not-when-audio --not-when-fullscreen --timer 360 "xset s activate" "" & +$HOME/.local/bin/dual-polybar-launcher & +{{- end }} +{{- if eq .chezmoi.hostname "triangulum"}} +xidlehook --not-when-audio --not-when-fullscreen --timer 360 "xset s activate" "" & +$HOME/.local/bin/single-polybar-launcher & +{{- end }} sleep 10 && nextcloud --background & diff --git a/dot_config/nvim/init.vim b/dot_config/nvim/init.vim new file mode 100644 index 0000000..8bb630b --- /dev/null +++ b/dot_config/nvim/init.vim @@ -0,0 +1,113 @@ +" set leader key +let g:mapleader = "\" + +" vim hardcodes background color erase even if the terminfo file does +" not contain bce (not to mention that libvte based terminals +" incorrectly contain bce in their terminfo files). This causes +" incorrect background rendering when using a color theme with a +" background color. +let &t_ut='' + +syntax enable " Enables syntax highlighing +set hidden " Required to keep multiple buffers open +set nowrap " Display long lines as just one line +set encoding=utf-8 " The encoding displayed +set pumheight=10 " Makes popup menu smaller +set fileencoding=utf-8 " The encoding written to file +set ruler " Show the cursor position all the time +set cmdheight=2 " More space for displaying messages +set iskeyword+=- " treat dash separated words as a word text object" +"set mouse=a " Enable your mouse +set splitbelow " Horizontal splits will automatically be below +set splitright " Vertical splits will automatically be to the right +set t_Co=256 " Support 256 colors +set conceallevel=0 " So that I can see `` in markdown files +set tabstop=4 " Insert 4 spaces for a tab +set shiftwidth=4 " Change the number of space characters inserted for indentation +set smarttab " Makes tabbing smarter will realize you have 2 vs 4 +set expandtab " Converts tabs to spaces +set smartindent " Makes indenting smart +set autoindent " Good auto indent +set laststatus=0 " Always display the status line +"set number " Line numbers +"set cursorline " Enable highlighting of the current line +set background=dark " tell vim what the background color looks like +set showtabline=4 " Always show tabs +"set noshowmode " We don't need to see things like -- INSERT -- anymore +set nobackup " This is recommended by coc +set nowritebackup " This is recommended by coc +set updatetime=300 " Faster completion +set timeoutlen=500 " By default timeoutlen is 1000 ms +set formatoptions-=cro " Stop newline continution of comments +"set clipboard=unnamedplus " Copy paste between vim and everything else +set autochdir " Your working directory will always be the same as your working directory + +au! BufWritePost $MYVIMRC source % " auto source when writing to init.vim alternatively you can run :source $MYVIMRC + +" You can't stop me +cmap w!! w !sudo tee % + +"" Plugins +" Install neovim-plug-git from AUR +call plug#begin() +" A fuzzy file finder +Plug 'kien/ctrlp.vim' +" Comment/Uncomment tool +Plug 'scrooloose/nerdcommenter' +" Switch to the begining and the end of a block by pressing % +Plug 'tmhedberg/matchit' +" A Tree-like side bar for better navigation +Plug 'scrooloose/nerdtree' +" A cool status bar +Plug 'vim-airline/vim-airline' +" Airline themes +Plug 'vim-airline/vim-airline-themes' +" Better syntax-highlighting for filetypes in vim +Plug 'sheerun/vim-polyglot' +" Intellisense engine +Plug 'neoclide/coc.nvim', {'branch': 'release'} +" Git integration +Plug 'tpope/vim-fugitive' +" Auto-close braces and scopes +Plug 'jiangmiao/auto-pairs' +""Themes +" Everforest theme +Plug 'sainnhe/everforest' +" Nord +"Plug 'arcticicestudio/nord-vim' + +call plug#end() + +" Important!! +if has('termguicolors') + set termguicolors +endif + +" Set contrast. +" This configuration option should be placed before `colorscheme everforest`. +" Available values: 'hard', 'medium'(default), 'soft' +let g:everforest_background = 'soft' +" For better performance +let g:everforest_better_performance = 1 +colorscheme everforest + +" plug-in autostart +"augroup nerdtree_open +" autocmd! +" autocmd VimEnter * NERDTree | wincmd p +"augroup END + +" NERDTree Toggle +nmap k :NERDTreeToggle + +" CoC completion +inoremap + \ pumvisible() ? "\" : + \ CheckBackspace() ? "\" : + \ coc#refresh() +inoremap pumvisible() ? "\" : "\" + +function! CheckBackspace() abort + let col = col('.') - 1 + return !col || getline('.')[col - 1] =~# '\s' +endfunction diff --git a/dot_config/private_tint2/tint2rc b/dot_config/tint2/tint2rc similarity index 100% rename from dot_config/private_tint2/tint2rc rename to dot_config/tint2/tint2rc diff --git a/dot_emacs.d/init.el b/dot_emacs.d/init.el index a9a3946..e77bb02 100644 --- a/dot_emacs.d/init.el +++ b/dot_emacs.d/init.el @@ -38,6 +38,10 @@ (setq user-emacs-directory (expand-file-name "~/.cache/emacs/") url-history-file (expand-file-name "url/history" user-emacs-directory)) +;; Store autosaves in cache dir instead of littering all over the filesystem +(setq auto-save-file-name-transforms + `((".*" "~/.cache/emacs/autosave/" t))) + ;; No annoying Windows errors (set-default-coding-systems 'utf-8) @@ -61,6 +65,11 @@ (setq-default tab-width 4) (setq indent-line-function 'insert-tab) +;; Recent files +(recentf-mode 1) +(setq recentf-max-menu-items 25) +(setq recentf-max-saved-items 25) + ;; Line numbers (setq column-number-mode t) (dolist (mode '(text-mode-hook @@ -221,6 +230,7 @@ ("C-c m" . consult-mode-command) ("C-c k" . consult-kmacro) ;; C-x bindings (ctl-x-map) + ("C-x C-r" . consult-recent-file) ("C-x M-:" . consult-complex-command) ;; orig. repeat-complex-command ("C-x b" . consult-buffer) ;; orig. switch-to-buffer ("C-x 4 b" . consult-buffer-other-window) ;; orig. switch-to-buffer-other-window @@ -438,7 +448,7 @@ (zig-mode . lsp) (lsp-mode . lsp-enable-which-key-integration)) :custom - (lsp-eldoc-render-all t) + (lsp-eldoc-render-all nil) (lsp-idle-delay 0.6) ;; (lsp-rust-analyzer-cargo-watch-command "clippy") ;; (lsp-rust-analyzer-server-display-inlay-hints t) @@ -481,6 +491,7 @@ :config (global-company-mode 1) (setq company-global-modes '(not gud-mode)) + (setq company-global-modes '(not comint-mode)) :custom (company-idle-delay 0) (company-minimum-prefix-length 1) diff --git a/dot_profile b/dot_profile.tmpl similarity index 92% rename from dot_profile rename to dot_profile.tmpl index 140b482..1f043fc 100644 --- a/dot_profile +++ b/dot_profile.tmpl @@ -5,6 +5,7 @@ export GOPATH="$HOME/.local/opt/go" export PATH="$HOME/.local/opt/go/bin:$PATH" # add .local/bin to $PATH export PATH="$HOME/.local/bin:$PATH" +{{- if eq .chezmoi.hostname "helix" }} # make GTK apps scale correctly on hidpi export GDK_SCALE=2 GDK_DPI_SCALE=0.50 thunar export GDK_SCALE=2 GDK_DPI_SCALE="0.50 Simple-scan" @@ -14,3 +15,4 @@ export GDK_SCALE=2 GDK_DPI_SCALE=0.50 pinta export GDK_SCALE=2 GDK_DPI_SCALE=0.50 Gajim export GDK_SCALE=2 GDK_DPI_SCALE=0.50 Ristretto export GDK_SCALE=2 GDK_DPI_SCALE=0.50 ghex +{{- end }} diff --git a/dot_xinputrc b/dot_xinputrc new file mode 100644 index 0000000..e344e1e --- /dev/null +++ b/dot_xinputrc @@ -0,0 +1 @@ +xinput set-prop 13 312 .8