Git Product home page Git Product logo

dotfiles's Introduction

Dotfiles

Toolbox

Gruvbox theme everywhere

Oh my Zsh + plugins tmux + tpm (Tmux Plugin Manager) mc (Midnight Commander) LunarVim + Packer + bunch of plugins (worth separate README)

Welcome to my digital world. This is a collection of neovim, tmux, zsh, git, homebrew configurations.

Obviously this setup works for me, a JavaScript developer on macOS, but this particularly setup may not work for you. If this particular setup doesn't work for you, please steal ideas from this and if you like, contribute back tips, tricks, and other tidbits via Pull Requests if you like!

I was a little tired of having long alias files and everything strewn about (which is extremely common on other dotfiles projects, too). That led to this project being much more topic-centric. I realized I could split a lot of things up into the main areas I used (Ruby, git, system libraries, and so on), so I structured the project accordingly.

If you're interested in the philosophy behind why projects like these are awesome, you might want to read my post on the subject.

topical

Everything's built around topic areas. If you're adding a new area to your forked dotfiles — say, "Java" — you can simply add a java directory and put files in there. Anything with an extension of .zsh will get automatically included into your shell. Anything with an extension of .symlink will get symlinked without extension into $HOME when you run script/bootstrap.

what's inside

A lot of stuff. Seriously, a lot of stuff. Check them out in the file browser above and see what components may mesh up with you. Fork it, remove what you don't use, and build on what you do use.

components

There's a few special files in the hierarchy.

  • bin/: Anything in bin/ will get added to your $PATH and be made available everywhere.
  • topic/*.zsh: Any files ending in .zsh get loaded into your environment.
  • topic/path.zsh: Any file named path.zsh is loaded first and is expected to setup $PATH or similar.
  • topic/completion.zsh: Any file named completion.zsh is loaded last and is expected to setup autocomplete.
  • topic/install.sh: Any file named install.sh is executed when you run script/install. To avoid being loaded automatically, its extension is .sh, not .zsh.
  • topic/*.symlink: Any file ending in *.symlink gets symlinked into your $HOME. This is so you can keep all of those versioned in your dotfiles but still keep those autoloaded files in your home directory. These get symlinked in when you run script/bootstrap.

install

Run this:

git clone https://github.com/alexarcherr/dotfiles.git ~/.dotfiles
cd ~/.dotfiles
script/bootstrap

This will symlink the appropriate files in .dotfiles to your home directory. Everything is configured and tweaked within ~/.dotfiles.

The main file you'll want to change right off the bat is zsh/zshrc.symlink, which sets up a few paths that'll be different on your particular machine.

dot is a simple script that installs some dependencies, sets sane macOS defaults, and so on. Tweak this script, and occasionally run dot from time to time to keep your environment fresh and up-to-date. You can find this script in bin/.

Initial Setup and Installation

Backup

First, you may want to backup any existing files that exist so this doesn't overwrite your work.

Run install/backup.sh to backup all symlinked files to a ~/dotfiles-backup directory.

This will not delete any of these files, and the install scripts will not overwrite any existing. After the backup is complete, you can delete the files from your home directory to continue installation.

Installation

If on OSX, you will need to install the XCode CLI tools before continuing. To do so, open a terminal and type

➜ xcode-select --install

Then, clone the dotfiles repository anywhere you like on your machine.

➜ git clone https://github.com/nicknisi/dotfiles.git
➜ cd dotfiles
➜ ./install.sh

install.sh will start by initializing the submodules used by this repository (if any). Read through this file and comment out anything you don't want installed. Then, it will install all symbolic links into your home directory. Every file with a .symlink extension will be symlinked to the home directory with a . in front of it. As an example, vimrc.symlink will be symlinked in the home directory as ~/.vimrc. Then, this script will create a ~/.vim-tmp directory in your home directory, as this is where vim is configured to place its temporary files. Additionally, all files in the $DOTFILES/config directory will be symlinked to the ~/.config/ directory for applications that follow the XDG base directory specification, such as neovim.

Next, the install script will perform a check to see if it is running on an OSX machine. If so, it will install Homebrew if it is not currently installed and will install the homebrew packages listed in Brewfile. Then, it will run osx.sh and change some OSX configurations. This file is pretty well documented and so it is advised that you read through and comment out any changes you do not want.

Terminal Capabilities

In order to properly support italic fonts in and out of tmux, a couple of terminal capabilities need to be described. Run the following from the root of the project:

tic -x resources/xterm-256color-italic.terminfo
tic -x resources/tmux.terminfo

ZSH Setup

ZSH is configured in the zshrc.symlink file, which will be symlinked to the home directory. The following occurs in this file:

  • set the EDITOR to nvim
  • Load any ~/.terminfo setup
  • Set the CODE_DIR variable, pointing to the location where the code projects exist for exclusive autocompletion with the c command
  • Recursively search the $DOTFILES/zsh directory for files ending in .zsh and source them
  • Setup zplug plugin manager for zsh plugins and installed them.
  • source a ~/.localrc if it exists so that additional configurations can be made that won't be kept track of in this dotfiles repo. This is good for things like API keys, etc.
  • Add the ~/bin and $DOTFILES/bin directories to the path
  • And more...

Prompt

The prompt is meant to be simple while still providing a lot of information to the user, particularly about the status of the git project, if the PWD is a git project. This prompt sets precmd, PROMPT and RPROMPT. The precmd shows the current working directory in it and the RPROMPT shows the git and suspended jobs info. The main symbol used on the actual prompt line is .

The prompt attempts to speed up certain information lookups by allowing for the prompt itself to be asynchronously rewritten as data comes in. This prevents the prompt from feeling sluggish when, for example, the user is in a large git repo and the git prompt commands take a considerable amount of time.

It does this by writing the actual text that will be displayed int he prompt to a temp file, which is then used to update the prompt information when a signal is trapped.

Git Prompt

The git info shown on the RPROMPT displays the current branch name, along with the following symbols.

  • + - New files were added
  • ! - Existing files were modified
  • ? - Untracked files exist that are not ignored
  • » - Current changes include file renaming
  • - An existing tracked file has been deleted
  • $ - There are currently stashed files
  • = - There are unmerged files
  • - Branch is ahead of the remote (indicating a push is needed)
  • - Branch is behind the remote (indicating a pull is needed)
  • - The branches have diverged (indicating history has changed and maybe a force-push is needed)
  • - The current working directory is clean

Jobs Prompt

The prompt will also display a character in the RPROMPT indicating that there is a suspended job that exists in the background. This is helpful in keeping track of putting vim in the background by pressing CTRL-Z.

Node Prompt

If a package.json file or a node_modules directory exists in the current working directory, display the node symbol, along with the current version of Node. This is useful information when switching between projects that depend on different versions of Node.

Vim and Neovim Setup

Neovim is a fork and drop-in replacement for vim. in most cases, you would not notice a difference between the two, other than Neovim allows plugins to run asynchronously so that they do not freeze the editor, which is the main reason I have switched over to it. Vim and Neovim both use Vimscript and most plugins will work in both (all of the plugins I use do work in both Vim and Neovim). For this reason, they share the same configuration files in this setup. Neovim uses the XDG base directory specification which means it won't look for a .vimrc in your home directory. Instead, its configuration looks like the following:

Vim Neovim
Main Configuration File ~/.vimrc ~/.config/nvim/init.vim
Configuration directory ~/.vim ~/.config/nvim

Installation

Vim is likely already installed on your system. If using a Mac, MacVim will be installed from Homebrew. Neovim will also be installed from Homebrew by default on a Mac. For other systems, you may need to install Neovim manually. See their web site for more information.

link.sh will symlink the XDG configuration directory into your home directory and will then create symlinks for .vimrc and .vim over to the Neovim configuration so that Vim and Neovim will both be configured in the same way from the same files. The benefit of this configuration is that you only have to maintain a single vim configuration for both, so that if Neovim (which is still alpha software) has issues, you can very seamlessly transition back to vim with no big impact to your productivity.

Inside of .zshrc, the EDITOR shell variable is set to nvim, defaulting to Neovim for editor tasks, such as git commit messages. Additionally, I have aliased vim to nvim in aliases.zsh You can remove this if you would rather not alias the vim command to nvim.

vim and neovim should just work once the correct plugins are installed. To install the plugins, you will need to open Neovim in the following way:

➜ nvim +PlugInstall

Fonts

I am currently using free and opensource superior JetBrains Mono Nerd as my default font. You do not need this font at all and there is nothing directly referencing it in the setup. For a great, free programming fonts, check out full nerd-fonts collection, which support non-ascii characters via iTerm2's profile settings. If you would prefer not to do this, then simply remove the Plug 'ryanoasis/vim-devicons' plugin from vim/nvim.

Tmux Configuration

Tmux is a terminal multiplexor (modern replacement of classic analog "screen") which lets you create windows and splits in the terminal that you can attach and detach from. I use it to keep multiple projects open in separate windows and to create an IDE-like environment to work in where I can have my code open in vim/neovim and a shell open to run tests/scripts. Tmux is configured in ~/.tmux.conf, and in ~/tmux/base16.sh, which defines the colors used, the layout of the tmux bar, and what what will be displayed, including the time and date, open windows, tmux session name, computer name, and current iTunes song playing.

If not running on macOS, this configuration should be removed.

bugs

I want this to work for everyone.

If you're brand-new to the project and run into any blockers, please open an issue on this repository and I'd love to get it fixed for you!

thanks

Initialy I forked Nick Nisi's dotfiles, lately scramble it with Zach Holman's dotfiles and my own settings. A decent amount of the code in my dotfiles stem or are inspired from that repos. Thank you, guys!

Corrections

Found errors? PR are welcome!

dotfiles's People

Contributors

alexarcherr avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.