From b8978215ffb97d79acfc552bb099cddf172b84b9 Mon Sep 17 00:00:00 2001 From: Ein Verne Date: Wed, 8 Feb 2023 11:25:53 +0900 Subject: [PATCH] feat: update macos bootstrap --- Makefile | 3 +++ README.md | 55 ++++++++++++++++++++++++--------------- config/bootstrap.conf.yml | 31 +--------------------- config/macos.conf.yml | 54 ++++++++++++++++++++++++++++++++++++++ config/packages.conf.yml | 2 -- hammerspoon/README.md | 4 +-- install | 2 +- install.sh | 22 ---------------- mac_bootstrap.sh | 5 ---- 9 files changed, 95 insertions(+), 83 deletions(-) create mode 100644 config/macos.conf.yml delete mode 100755 install.sh diff --git a/Makefile b/Makefile index f4cbc5e..a049389 100644 --- a/Makefile +++ b/Makefile @@ -13,6 +13,9 @@ bootstrap: _prepare dotfiles _bootstrap ## Bootstrap new machine termux: _prepare dotfiles termux ## Bootstrap new termux +mac: + @./install -c config/macos.conf.yml --plugin-dir dotbot-brew + termux: @./install -c config/termux.conf.yml diff --git a/README.md b/README.md index 8645efc..9e8b10c 100644 --- a/README.md +++ b/README.md @@ -1,16 +1,19 @@ -dotfiles config contains vim, zsh, tmux configurations. +This is my personal dotfiles which contain config for vim, zsh, tmux, git, fzf, etc; -## MacOS setup -Set up using dotbot: +## macOS setup +Set up by using [dotbot](https://blog.einverne.info/post/2020/08/use-dotbot-dotfiles-management.html): + cd ~ git clone git@github.com:einverne/dotfiles.git cd dotfiles - # to bootstrap + # to bootstrap config for vim, zsh, tmux, git, fzf, etc make bootstrap # under Linux desktop, install essential packages make linux - # under macOS - make macos + # under macOS, install applications by brew + make mac + +Log out and log in again, zinit will install all plugins automatically. If you tried to edit file by vi, the vim-plug will install all plugins automatically. ## Termux setup Install dependency first: @@ -29,10 +32,16 @@ then: - zsh, using [zinit](https://blog.einverne.info/post/2020/10/use-zinit-to-manage-zsh-plugins.html) as zsh plugin management - vim, using [vim-plug](https://github.com/junegunn/vim-plug) to manage vim plugins, vim-plug relate configuration is under `vim-plug_vimrc`. In Vim, `:PlugInstall` to install all vim plugins. - tmux, using [tpm](https://blog.einverne.info/post/2017/12/tmux-plugins.html) to manage tmux plugins, in tmux, press `Ctrl +B` + `I` to install all tmux plugins. -- other useful tools, like [fzf](https://blog.einverne.info/post/2019/08/fzf-usage.html) to fuzzy search, ripgrep for recursively searching directories, zoxide to replace cd, exa to replace ls +- other useful tools, like [fzf](https://blog.einverne.info/post/2019/08/fzf-usage.html) to fuzzy search, ripgrep for recursively searching directories, zoxide to replace cd, exa to replace ls. + +GUI applications: + +- Kitty +- Karabiner-Elements +- Hammerspoon ### zsh config -to see `.zshrc` file +to see `.zshrc` file. ### Vim config vim-plug related configuration is under `vim-plug_vimrc`, to show all plugins list, use `:PluginList` in vim. @@ -44,9 +53,9 @@ python related configurations is under `python_vimrc`. - bin/: executable shell scripts, Anything in bin/ will get added to your $PATH and be made available everywhere. - conf/: configuration file of zsh etc -## Instruction under Linux +## Instruction for vim -Just run `./install.sh`, everything is done. Then Enter the vim run `:PlugInstall` to install all plugins. +Enter the vim and then run `:PlugInstall` to install all plugins. ### install manually Or, you can do it manually follow the step: @@ -63,28 +72,32 @@ with yum: sudo yum install ctags-etags +## Tmux config +I take some Tmux config from [gpakosz](https://github.com/gpakosz/.tmux). If you want to learn more about tmux, you can check [this article](http://einverne.github.io/post/2017/07/tmux-introduction.html). -## Tmux -Tmux 配置參考了 [gpakosz](https://github.com/gpakosz/.tmux) 的大部分配置。Tmux 的基础部分可以参考[这篇](http://einverne.github.io/post/2017/07/tmux-introduction.html) 文章。 +You can manually install tmux plugins by `prefix + I`. -需要满足 +Tmux need: - `tmux >= 2.1` -- 在 tmux 运行的环境中,`$TERM` 需要设置为 `xterm-256color` +- You should set `$TERM` environment for `xterm-256color` -功能 +Tmux config: -- 在保留`C-b` 的前提下,`C-a` 作为第二选择 -- `prefix + |` 开启垂直分割的新 panel, `prefix + -` 水平分割 -- `C-hjkl` 直接在多 panel 中跳转 -- Tmux 调整 Pane 窗口大小 `prefix + Shift + HJKL` +- You can use `C-b` as prefix, and use `C-a` as second choice +- `prefix + |` to split panel vertically, `prefix + -` split panel horizontally +- `C-hjkl` to switch pane +- `prefix + Shift + HJKL` to adjust pane size -使用 Tmux Plugin Manager 管理,默认有如下插件 +I use Tmux Plugin Manager to manage tmux plugins, and by default I use following plugins: set -g @plugin 'tmux-plugins/tpm' set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-yank' - + set -g @plugin 'tmux-plugins/tmux-resurrect' + set -g @plugin 'tmux-plugins/tmux-continuum' + set -g @plugin 'tmux-plugins/tmux-open' + set -g @plugin 'tmux-plugins/tmux-copycat' ## fzf config There are following alias in `.zshrc` : diff --git a/config/bootstrap.conf.yml b/config/bootstrap.conf.yml index 850aab8..8a51048 100644 --- a/config/bootstrap.conf.yml +++ b/config/bootstrap.conf.yml @@ -1,11 +1,9 @@ +# bootstrap linux, macos # Setup zinit - create: - ~/.zinit - ~/.tmux -- create: - - ~/.config/kitty - - shell: - description: Clone zinit quiet: true @@ -46,30 +44,3 @@ ~/.config/espanso: if: '[ `uname` = Linux ]' path: espanso - ~/Library/Preferences/espanso: - if: '[ `uname` = Darwin ]' - path: espanso - ~/.hammerspoon: - if: '[ `uname` = Darwin ]' - path: hammerspoon - ~/.mackup.cfg: - if: '[ `uname` = Darwin ]' - path: mackup/mackup.cfg - ~/.Brewfile: - if: '[ `uname` = Darwin ]' - path: Brewfile - ~/.config/kitty/kitty.conf: - if: '[ `uname` = Darwin ]' - path: kitty/kitty.conf - ~/.config/kitty/base16-solarized-dark-256.conf: - if: '[ `uname` = Darwin ]' - path: kitty/base16-solarized-dark-256.conf - ~/.skhdrc: - if: '[ `uname` = Darwin ]' - path: skhd/skhdrc - ~/.yabairc: - if: '[ `uname` = Darwin ]' - path: yabai/yabairc - ~/.yabai_focus_display: - if: '[ `uname` = Darwin ]' - path: yabai/yabai_focus_display diff --git a/config/macos.conf.yml b/config/macos.conf.yml new file mode 100644 index 0000000..edc07ea --- /dev/null +++ b/config/macos.conf.yml @@ -0,0 +1,54 @@ +# bootstrap: macos +- create: + - ~/.config/kitty + +- link: + ~/Library/Preferences/espanso: + if: '[ `uname` = Darwin ]' + path: espanso + ~/.hammerspoon: + if: '[ `uname` = Darwin ]' + path: hammerspoon + ~/.mackup.cfg: + if: '[ `uname` = Darwin ]' + path: mackup/mackup.cfg + ~/.Brewfile: + if: '[ `uname` = Darwin ]' + path: Brewfile + ~/.config/kitty/kitty.conf: + if: '[ `uname` = Darwin ]' + path: kitty/kitty.conf + ~/.config/kitty/base16-solarized-dark-256.conf: + if: '[ `uname` = Darwin ]' + path: kitty/base16-solarized-dark-256.conf + ~/.skhdrc: + if: '[ `uname` = Darwin ]' + path: skhd/skhdrc + ~/.yabairc: + if: '[ `uname` = Darwin ]' + path: yabai/yabairc + ~/.yabai_focus_display: + if: '[ `uname` = Darwin ]' + path: yabai/yabai_focus_display + +- brew: + - git + - zsh + - tmux + - pyenv + - assh + - ripgrep + - ffmpeg + +- tap: + - homebrew/cask-fonts + +- cask: + - kitty + - iterm2 + - warp + - syncthing + - hammerspoon + - obsidian + - bigwig-club/brew/upic + - visual-studio-code \ No newline at end of file diff --git a/config/packages.conf.yml b/config/packages.conf.yml index 8936ef2..4d30643 100644 --- a/config/packages.conf.yml +++ b/config/packages.conf.yml @@ -1,8 +1,6 @@ - brew: - - git - mackup - mas - - zsh - cask: - syncthing diff --git a/hammerspoon/README.md b/hammerspoon/README.md index 047c424..8341440 100644 --- a/hammerspoon/README.md +++ b/hammerspoon/README.md @@ -7,7 +7,7 @@ hammerspoon is my configuration for [Hammerspoon](http://www.hammerspoon.org/). - Install [Hammerspoon](http://www.hammerspoon.org/) first `brew install --cask hammerspoon` - `git clone https://github.com/einverne/dotfiles.git ~/dotfiles` - `ln -s ~/dotfiles/hammerspoon ~/.hammerspoon` -- Reload the configutation. +- Reload the configuration. ## Keep update @@ -19,7 +19,7 @@ hammerspoon is my configuration for [Hammerspoon](http://www.hammerspoon.org/). - `ime.lua`, auto switch different Input methods in different applications ## How to use -Use Karabier-Elements to set caps lock as hyper key. Press caps lock is just like press Cmd+Control+Option+Shift at the same time. +Use Karabiner-Elements to set caps lock as hyper key. Press caps lock is just like press Cmd+Control+Option+Shift at the same time. ## Reload config diff --git a/install b/install index 589e7a7..012ed92 100755 --- a/install +++ b/install @@ -1,5 +1,5 @@ #!/usr/bin/env bash - +# init dotbot and it's submodules set -e CONFIG="config/install.conf.yml" diff --git a/install.sh b/install.sh deleted file mode 100755 index b034a4e..0000000 --- a/install.sh +++ /dev/null @@ -1,22 +0,0 @@ -#!/bin/bash - -#=============================================================================== -# -# FILE: install.sh -# -# USAGE: ./install.sh -# -# DESCRIPTION: -# -# OPTIONS: --- -# REQUIREMENTS: --- -# BUGS: --- -# NOTES: --- -# AUTHOR: YOUR NAME (), -# ORGANIZATION: -# CREATED: 10/21/2022 03:56:45 PM -# REVISION: --- -#=============================================================================== - -set -o nounset # Treat unset variables as an error - -make bootstrap diff --git a/mac_bootstrap.sh b/mac_bootstrap.sh index 97d7046..8f5ea32 100644 --- a/mac_bootstrap.sh +++ b/mac_bootstrap.sh @@ -44,8 +44,3 @@ echo "- fzf" $(brew --prefix)/opt/fzf/install # echo "- neovim" # ./neovim/neovim - -echo "Link editors" -mkdir -p ~/Applications/ -sudo ln -s /Applications/Visual\ Studio\ Code.app/Contents/Resources/app/bin/code /usr/local/bin/code -