Skip to content

Commit

Permalink
Init
Browse files Browse the repository at this point in the history
  • Loading branch information
nikitavoloboev committed Jul 23, 2018
0 parents commit 8394aec
Show file tree
Hide file tree
Showing 43 changed files with 9,327 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .gitignore
@@ -0,0 +1,7 @@
/nvim/plugged/
/sublime/WakaTime.sublime-settings
/sublime/oscrypto-ca-bundle.crt
/sublime/Package Control.cache
/sublime/Package Control.merged-ca-bundle
/sublime/Package Control.user-ca-bundle
/sublime/Package Control.last-run
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "dotbot"]
path = dotbot
url = https://github.com/anishathalye/dotbot
79 changes: 79 additions & 0 deletions .install.conf.yaml
@@ -0,0 +1,79 @@
# Settings
- defaults:
link:
create: true
relink: true
# force: true # Swap the original file

# TODO: ?
- clean: ['~', '~/.config']

# Run shell commands
- shell:
# Install submodules
- [git submodule update --init --recursive, Installing submodules]

# TODO: Make sure ./install works independent of where dotfiles are stored

# TODO: Install Antibody. Check if Antibody is installed first.

# Install Zsh plugins with Antibody
- [antibody bundle <~/.dotfiles/zsh/plugins.txt >~/.zsh_plugins.sh]
- [antibody update]

# TODO: Install Nix. Check if Nix is installed first.
# - [curl https://nixos.org/nix/install | sh]

# TODO: Install all the commands I use with Nix

# TODO: Look into https://github.com/LnL7/nix-darwin and maybe add/use it
# TODO: Look into https://github.com/rycee/home-manager and maybe add/use it

# TODO: Install go tools (~/go/bin)

# TODO: Install rust tools (~/.cargo/bin)

# Symlink files
- link:
# Zsh
~/.zshrc: zsh/zshrc.zsh
# Git
~/.gitconfig: git/gitconfig
~/.gitignore_global: git/gitignore_global
# Hammerspoon
~/.hammerspoon: hammerspoon
# Sublime Text
"~/Library/Application Support/Sublime Text 3/Packages/User": sublime
# Neovim
~/.config/nvim: nvim
# VS Code
~/Library/Application Support/Code/User/settings.json: vscode/settings.json
~/Library/Application Support/Code/User/keybindings.json: vscode/keybindings.json

# macOS Time Machine install:
# 1. Boot into new macOS with hard drive that has Time Machine backup inside.
# 1. Boot macOS from time machine.

# macOS fresh install:
# Can use this: https://macdaddy.io/create-bootable-usb-macos-installer

# Recovery mode > Disk Utility > Select your disk >
# > Erase > Close Disk Utility > Select option Reinstall MacOS (Choose macOS ver. to install)

# There's also option of:
# Use Disk Utility in recovery partition to erase the hard drive to replace system files for full reset.
# 1. Go to recovery partition. Reinstall macOS from scratch, don’t select the option to reinstall from Time Machine.
# 1. Go through install process, setup a new account, then log in.
# 2. When logged in, open Time Machine Migration Assistant and chose what you want to transfer from it.
# 2. You can select specific things like Applications, Documents, etc.

# ~/Library/Application Support -> App auxiliary files
# ~/Library/Preferences -> App preferences
# ~/Pictures/Photos Library -> Apple Photos
# ~/Library/Fonts -> Custom fonts
# ~/.wakatime.cfg -> WakaTime settings (API Key)
# ~/.ssh -> SSH config + certs
# ~/.npm-global/bin -> npm globally installed commands (have to run 'npm set prefix ~/.npm-global' to set this install location)
# ~/Library/Preferences/com.pilotmoon.popclip.plist & ~/Library/Application Support/PopClip -> Popclip extensions

# 3. Clone dotfiles to `~/.dotfiles` and run ./install.
21 changes: 21 additions & 0 deletions LICENSE
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2017 Nikita Voloboev (nikitavoloboev.xyz)

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
152 changes: 152 additions & 0 deletions README.md
@@ -0,0 +1,152 @@
# My configuration files for macOS [![Thanks](https://img.shields.io/badge/Say%20Thanks-💗-ff69b4.svg)](https://www.patreon.com/nikitavoloboev)
> Zsh, Karabiner, VS Code, Sublime, Neovim, Nix, Hammerspoon
<img src="https://i.imgur.com/3cPVMJQ.jpg" width="600" alt="img">

These are the various configuration files I use on macOS. I wrote about how you can customize your shell experience in an article [here](https://medium.com/@NikitaVoloboev/pretty-and-fast-shell-97ea870f2805).

You can also see my top used applications, Safari extensions and Alfred workflows I use [here](https://github.com/nikitavoloboev/my-mac-os#readme).

##### Contents
- [Install](#install)
- [Karabiner](#karabiner)
- [Neovim](#neovim)
- [VS Code](#vs-code)
- [Sublime Text](#sublime-text)
- [Hammerspoon](#hammerspoon)
- [Zsh](#zsh)
- [Aliases and functions](#aliases-and-functions)
- [FZF](#fzf)
- [Interesting dotfiles](#interesting-dotfiles)
- [Contributing](#contributing)

## Install
To install my configuration, clone the repository and run: `./install`. This install assumes that this repository is placed in `~/.dotfiles` dir.

This will automatically setup all the configuration files using [Dotbot](https://github.com/anishathalye/dotbot). Look [here](https://github.com/nikitavoloboev/dotfiles/blob/master/.install.conf.yaml#L1) for what exactly it will do.

I describe my custom configuration I use below. It is heavily tailored to my own workflow so it is best you take ideas from it rather than copying the entire config.

## Karabiner

<img src="https://imgs.xkcd.com/comics/borrow_your_laptop_2x.png" width="300" alt="img">

The most exciting thing in here is probably how I utilize [Karabiner](https://pqrs.org/osx/karabiner/). It has absolutely transformed the way I interact with my computer and there is no going back now.

I go over how I use Karabiner in detail [here](https://wiki.nikitavoloboev.xyz/macOS/apps/karabiner/karabiner.html). I generate my config for it [here](https://github.com/nikitavoloboev/karabiner-generator).

## Neovim
The best text editing experience you will ever get. It is worth learning it as you will start thinking about text editing differently.

My Neovim config can be seen [here](nvim/init.vim). I use [Ayu theme](https://github.com/ayu-theme/ayu-vim) with [many plugins](https://wiki.nikitavoloboev.xyz/text-editors/vim/vim-plugins.html). Here is how it looks:

<img src="https://i.imgur.com/m6CK29L.png" width="500" alt="img">

## VS Code
My main editor of choice is [VS Code](https://github.com/Microsoft/vscode) since it has well built [vim mode](https://github.com/VSCodeVim/Vim).

Configs I use for it can be seen [here](https://github.com/nikitavoloboev/dotfiles/tree/master/vscode). And [here](https://wiki.nikitavoloboev.xyz/text-editors/vs-code/vs-code-extensions.html) is a list of extensions I use.

## Sublime Text
I use it primarily to edit markdown files like [my wiki](https://wiki.nikitavoloboev.xyz/other/wiki-workflow.html). I also edit config files and open large and small files for quick edits.

I use [many plugins](https://wiki.nikitavoloboev.xyz/text-editors/sublime-text/sublime-text-plugins.html) together with [Ayu theme](https://github.com/dempfi/ayu).

## Hammerspoon
I don't use [Hammerspoon](http://www.hammerspoon.org/) as extensively however I am looking into implementing more of its features into my workflow.

## Zsh
I am using [Zsh](http://www.zsh.org) as my shell and [Antibody](https://github.com/getantibody/antibody) to install all [my Zsh plugins](https://wiki.nikitavoloboev.xyz/unix/shell/zsh/zsh-plugins.html).

I am also using [Ayu theme](https://github.com/nikitavoloboev/my-mac-os/tree/master/iterm#readme) I made in Zsh. Here is how my prompt looks:

<img src="https://i.imgur.com/3G9QffJ.png" width="400" alt="img">

### Aliases and functions
I use many aliases to get around my system as fast as possible. You can view them all [here](zsh/alias.zsh).

There is a lot of awesome programs I use from my command line. You can see [here](https://github.com/nikitavoloboev/my-mac-os#command-line-apps) for all of them.

I also love customizing my shell experience with various aliases and Zsh functions. Here are some that I like and use often:

#### Commit and push repository to GitHub

```Bash
ggi() {
git init
mit
git add .
git commit -m "Init"
git remote add origin $(osascript -e 'tell application "Safari" to return URL of front document')
git push -u origin master
}
```

Say I created some project and wrote some code in it or added a simple README with some text in it. I then go on to create a [new GitHub repository](https://github.com/new) and give it a name. After that I just run this `ggi` command.

It will initialize my current directory with git if it wasn't already. It will then call this function:

```Bash
mit() {
license-up mit Nikita Voloboev nikitavoloboev.xyz
git add LICENSE
}
```

Which using [this CLI tool](https://github.com/nikitavoloboev/license-up), will create a license file and git add it. It will then take the URL of my current browser window which will be at the newly created repository, point the local git repo to push there and push it.

And thus in one command I initialized and pushed the repo. To create a new repo quickly I use [this Alfred workflow](https://github.com/nikitavoloboev/alfred-ask-create-share).

#### Commit all with generic `update` message
I use this command often when I find no commit message necessary.

```Bash
ggs() {
git add .
git commit . -m 'update'
git push
}
```

#### Clone current url in clipboard

```Bash
gll(){
git clone "$(pbpaste)"
}
```

I use this often to quickly clone the URL that I copied from GitHub.

#### Trash files / folders
A lot safer than to `rm -rf` files as you can always check out `~/.Trash` in cases of emergency or mistakes.

```Bash
re(){
mv "$1" ~/.Trash
}
```

## FZF
[FZF](https://github.com/junegunn/fzf) is a command line tool that lets you fuzzy search on text. I use it often now for fuzzy searching for files to open with neovim, or fuzzy searching through my commit messages and more. Here are [all the functions I use](https://github.com/nikitavoloboev/dotfiles/blob/master/zsh/functions/fzf-functions.zsh#L1) with it.

## Interesting dotfiles
These are dotfiles I got many ideas from and liked.
- [bluz71](https://github.com/bluz71/dotfiles) - Interesting vim setup.
- [caarlos0](https://github.com/caarlos0/dotfiles) - Made antibody.
- [wangsongiam](https://github.com/wangsongiam/dotfiles) - Interesting Hammerspoon and Zsh config.
- [rvolosatovs](https://github.com/rvolosatovs/dotfiles) - Good vim setup for Go.
- [Keith](https://github.com/keith/dotfiles) - Vim, Zsh, Tmux, and macOS.
- [bresilla](https://github.com/bresilla/dotfiles) - Neat Linux look.

## Interesting Nix configs
- [cmacrae (Darwin)](https://github.com/cmacrae/.nixpkgs/blob/master/darwin-configuration.nix)

## Contributing
[Suggestions](../../issues/) on how I can improve the structure of these dotfiles as well as suggesting new and awesome tools are welcome.

## Thank you 💜
You can support me on [Patreon](https://www.patreon.com/nikitavoloboev) or look into [other projects](https://nikitavoloboev.xyz/projects) I shared.

## License
MIT © [Nikita Voloboev](https://www.nikitavoloboev.xyz)
21 changes: 21 additions & 0 deletions bin/package-workflow
@@ -0,0 +1,21 @@
#!/usr/bin/env bash
# Packages Alfred workflows to ~/Desktop.

readonly workflow_dir="${1}"
readonly info_plist="${workflow_dir}/info.plist"

readonly workflow_name="$(/usr/libexec/PlistBuddy -c 'print name' "${info_plist}")"
readonly workflow_file="${HOME}/Desktop/${workflow_name}.alfredworkflow"

if /usr/libexec/PlistBuddy -c 'print variablesdontexport' "${info_plist}" &> /dev/null; then
readonly workflow_dir_to_package="$(mktemp -d)"
cp -R "${workflow_dir}/"* "${workflow_dir_to_package}"

readonly tmp_info_plist="${workflow_dir_to_package}/info.plist"
/usr/libexec/PlistBuddy -c 'Print variablesdontexport' "${tmp_info_plist}" | grep ' ' | sed -E 's/ {4}//' | xargs -I {} /usr/libexec/PlistBuddy -c "Set variables:'{}' ''" "${tmp_info_plist}"
else
readonly workflow_dir_to_package="${workflow_dir}"
fi

ditto -ck "${workflow_dir_to_package}" "${workflow_file}"
echo "Exported worflow to ${workflow_file}."

0 comments on commit 8394aec

Please sign in to comment.