Browse Source

feat: update macos bootstrap

master
Ein Verne 2 years ago
parent
commit
b8978215ff
  1. 3
      Makefile
  2. 55
      README.md
  3. 31
      config/bootstrap.conf.yml
  4. 54
      config/macos.conf.yml
  5. 2
      config/packages.conf.yml
  6. 4
      hammerspoon/README.md
  7. 2
      install
  8. 22
      install.sh
  9. 5
      mac_bootstrap.sh

3
Makefile

@ -13,6 +13,9 @@ bootstrap: _prepare dotfiles _bootstrap ## Bootstrap new machine
termux: _prepare dotfiles termux ## Bootstrap new termux termux: _prepare dotfiles termux ## Bootstrap new termux
mac:
@./install -c config/macos.conf.yml --plugin-dir dotbot-brew
termux: termux:
@./install -c config/termux.conf.yml @./install -c config/termux.conf.yml

55
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 ## macOS setup
Set up using dotbot: Set up by using [dotbot](https://blog.einverne.info/post/2020/08/use-dotbot-dotfiles-management.html):
cd ~
git clone [email protected]:einverne/dotfiles.git git clone [email protected]:einverne/dotfiles.git
cd dotfiles cd dotfiles
# to bootstrap # to bootstrap config for vim, zsh, tmux, git, fzf, etc
make bootstrap make bootstrap
# under Linux desktop, install essential packages # under Linux desktop, install essential packages
make linux make linux
# under macOS # under macOS, install applications by brew
make macos 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 ## Termux setup
Install dependency first: 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 - 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. - 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. - 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 ### zsh config
to see `.zshrc` file to see `.zshrc` file.
### Vim config ### Vim config
vim-plug related configuration is under `vim-plug_vimrc`, to show all plugins list, use `:PluginList` in vim. 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. - bin/: executable shell scripts, Anything in bin/ will get added to your $PATH and be made available everywhere.
- conf/: configuration file of zsh etc - 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 ### install manually
Or, you can do it manually follow the step: Or, you can do it manually follow the step:
@ -63,28 +72,32 @@ with yum:
sudo yum install ctags-etags 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 You can manually install tmux plugins by `prefix + I`.
Tmux 配置參考了 [gpakosz](https://github.com/gpakosz/.tmux) 的大部分配置。Tmux 的基础部分可以参考[这篇](http://einverne.github.io/post/2017/07/tmux-introduction.html) 文章。
需要满足 Tmux need:
- `tmux >= 2.1` - `tmux >= 2.1`
- 在 tmux 运行的环境中,`$TERM` 需要设置为 `xterm-256color` - You should set `$TERM` environment for `xterm-256color`
功能 Tmux config:
- 在保留`C-b` 的前提下,`C-a` 作为第二选择 - You can use `C-b` as prefix, and use `C-a` as second choice
- `prefix + |` 开启垂直分割的新 panel, `prefix + -` 水平分割 - `prefix + |` to split panel vertically, `prefix + -` split panel horizontally
- `C-hjkl` 直接在多 panel 中跳转 - `C-hjkl` to switch pane
- Tmux 调整 Pane 窗口大小 `prefix + Shift + HJKL` - `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/tpm'
set -g @plugin 'tmux-plugins/tmux-sensible' set -g @plugin 'tmux-plugins/tmux-sensible'
set -g @plugin 'tmux-plugins/tmux-yank' 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 ## fzf config
There are following alias in `.zshrc` : There are following alias in `.zshrc` :

31
config/bootstrap.conf.yml

@ -1,11 +1,9 @@
# bootstrap linux, macos
# Setup zinit # Setup zinit
- create: - create:
- ~/.zinit - ~/.zinit
- ~/.tmux - ~/.tmux
- create:
- ~/.config/kitty
- shell: - shell:
- description: Clone zinit - description: Clone zinit
quiet: true quiet: true
@ -46,30 +44,3 @@
~/.config/espanso: ~/.config/espanso:
if: '[ `uname` = Linux ]' if: '[ `uname` = Linux ]'
path: espanso 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

54
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

2
config/packages.conf.yml

@ -1,8 +1,6 @@
- brew: - brew:
- git
- mackup - mackup
- mas - mas
- zsh
- cask: - cask:
- syncthing - syncthing

4
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` - Install [Hammerspoon](http://www.hammerspoon.org/) first `brew install --cask hammerspoon`
- `git clone https://github.com/einverne/dotfiles.git ~/dotfiles` - `git clone https://github.com/einverne/dotfiles.git ~/dotfiles`
- `ln -s ~/dotfiles/hammerspoon ~/.hammerspoon` - `ln -s ~/dotfiles/hammerspoon ~/.hammerspoon`
- Reload the configutation. - Reload the configuration.
## Keep update ## 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 - `ime.lua`, auto switch different Input methods in different applications
## How to use ## How to use
Use Karabier-Elements to set <kbd>caps lock</kbd> as hyper key. Press caps lock is just like press Cmd+Control+Option+Shift at the same time. Use Karabiner-Elements to set <kbd>caps lock</kbd> as hyper key. Press caps lock is just like press Cmd+Control+Option+Shift at the same time.
## Reload config ## Reload config

2
install

@ -1,5 +1,5 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# init dotbot and it's submodules
set -e set -e
CONFIG="config/install.conf.yml" CONFIG="config/install.conf.yml"

22
install.sh

@ -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

5
mac_bootstrap.sh

@ -44,8 +44,3 @@ echo "- fzf"
$(brew --prefix)/opt/fzf/install $(brew --prefix)/opt/fzf/install
# echo "- neovim" # echo "- neovim"
# ./neovim/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

Loading…
Cancel
Save