Coder Social home page Coder Social logo

dotfiles's Introduction

Sam's Dot files

Configurations are primarily geared toward Python, Go, Javascript, Rust, and C/C++ programmers. Ruby dependencies or support is an artifact of the past and is possibly outdated. I don't write much Java either.

Main benefits

  • Vim settings using oh-my-zsh and a small bunch of very helpful plugins with sensible defaults.
  • Python is run through virtualenv by default in a workspace called default. This lets you use more virtualenvs if you'd like, but if you're like me it's more likely that you want 1 virtual space where you can pip install without super user privileges and keep the system's python nice and clean.
  • Irssi is set to log and has some sensible defaults as well.
  • Gitconfig makes config'ing git easy per machine.
  • ZSH theme is no-nonsense. Shows hostname, python environment, git repo.
  • npm defaults installs to userland as well. npm install -g js-beautify

Prereqs

  • zsh
  • python 3.9+
  • ack 2.14+ (note: you may want to use silver searcher instead, I heard it's good)
  • vim 7.3+ (mvim / gvim optional) w/ Ruby and Python extensions
  • npm
  • If osx, probably MacPorts (not required but I prefer it over homebrew)

Installing VIM with MacPorts

Make sure you install VIM with support for Python3, otherwise the jedi vim plugin won't work. While we're here, x11 support is nice too. And some others if we ever decide to get fancy :)

sudo port install vim +python39 +ruby25 +perl +x11 +xim

Optional

  • rust 1.15+

If you want to use fish shell instead of zsh:

  • fish
  • virtualfish

Installation

Stage 1: Personalize

Edit these files.

  • For git: ~/.gitconfig
  • For irssi: <dotfiles dir>/irssi/config replace samliu with your username.
  • For aliases (bash and zsh use same file): ~/.oh-my-zsh/custom/aliases.zsh
  • For virtualenv in zsh: ~/.oh-my-zsh/custom/virtualenv.zsh

Stage 2: Install

  • Install prereqs listed above.
  • Set zsh to be your default shell: sudo chsh -s /bin/zsh
  • git clone [email protected]:samliu/dotfiles.git ~/.dotfiles
  • cd ~/.dotfiles
  • python install.py -- follow prompts.
  • If you're planning on using python, pip install -r requirements.txt
  • Open vim, run :PluginInstall to install all plugins with Vundle.

The install script symlinks each file in the dotfile folder to your home directory and prompts if an overwrite is going to happen.

Code Formatters for Vim

I use Google's vim-codefmt plugin to format my code automatically in vim. The plugin leverages code formatters, so you have to make sure they are installed.

Python

Make sure your python environment is fully configured, then install autopep8 using pip.

pip install autopep8

C/C++

Install clang-format, which should come with your clang install. Default OS X clang as of this writing does not include clang-format, so you have to get it yourself. Go to http://clang.llvm.org/docs/ClangFormat.html for downloads.

I went to this page, downloaded the darwin prebuilt binaries, unzipped, then used cp bin/clang-format /usr/bin/clang-format to install the binary.

HTML / Javascript / CSS

Get NPM.

npm install js-beautify -g

Rust

Install rustfmt.

cargo install rustfmt

Potential Knots

Vim Python + Virtualenv

Some vim plugins use python but you need to make sure vim is using your python of choice, whether it is through virtualenv or the system.

MacPorts vs Homebrew

I think these dotfiles should be mostly agnostic but I only provide help via comments for MacPorts. I haven't tried installing these with Homebrew, though I think it should work just fine.

Linux vs OSX

In ~/.oh-my-zsh/custom/linux.zsh I add some functionality for Linux users. I actually use these dotfiles on 3 Ubuntu machines and 2 Macbook Pros.

command-t.vim & Ruby Version

If you're using vim on OS X and rvm, you're likely to run into problems because Command-T requires vim to be built with ruby extensions and the ruby it uses needs to match the extension version.

By default, on OS X ruby is located at:

/System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby

You need to run ~/.vim/bundle/command-t/ruby/command-t/extconf.rb using the system ruby (assuming your vim is also system vim), then run make in the ~/.vim/bundle/command-t/ruby/command-t folder.

Virtualenv

I stopped using virtualenv in favor of the python built-in venv.

Basic usage:

# Creates a virtualenv in the `my_virtualenv` directory.
python -m venv my_virtualenv

Then simply run this to use the environment:

source my_virtualenv/bin/activate

I typically keep all my environments in ~/.virtualenvs, and have my .bashrc/.zshrc source my most commonly used environment. For testing a python app, I'll often create a fresh environment with only the bare requirements installed.

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.