Getting Started with Dotfile Management with Git on Windows
Tags: productivity, workflow, git
Published: 2020-01-12 20:07:14

---
series: How I Manage My Dotfiles Cross Platform
title: Getting Started with Dotfile Management with Git on Windows
published: true
description: Part 3 of this series outlines how I got to a working state with my Dotfiles on Windows
tags: productivity, workflow, git
cover_image: https://thepracticaldev.s3.amazonaws.com/i/rk5nnpz79exzvdyodfx9.jpg
---

Finally we've gotten to Windows, easily the platform I'm least comfortable with working in when it comes to the file system! This post is mostly notes on how I went about bringing my dotfiles onto my Windows machine and get my editor running with its configuration. Here be dragons and very untested methodologies! You've been warned!

Here are the steps I've taken:
1. Git cloned dotfiles down as per usual.
2. I also manually removed the platform specific files in this step as well.
3. Installed neovim with [https://github.com/neovim/neovim/wiki/Installing-Neovim#windows](https://github.com/neovim/neovim/wiki/Installing-Neovim#windows) (I used chocolatey, make sure to run it as an admin with elevated commands when installing and upgrading)
4. Moved neovims init.vim to `~\AppData\Local\nvim\init.vim`
5. Installed Plug to windows following [the documentation](https://github.com/junegunn/vim-plug#windows-powershell), which at the time of writing this meant running the following in powershell:```
        md ~\AppData\Local\nvim\autoload
        $uri = 'https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
        (New-Object Net.WebClient).DownloadFile(
          $uri,
          $ExecutionContext.SessionState.Path.GetUnresolvedProviderPathFromPSPath(
            "~\AppData\Local\nvim\autoload\plug.vim"
          )
        ) 
```
    After that: yay, neovim works!
6. `choco install fzf` this comes with some limitations as outlined in [the docs](https://github.com/junegunn/fzf/wiki/Windows)
7. `choco install ripgrep`
8. The next thing I needed to learn is how to define aliases. I'm using windows powershell, so this is an example of how I went about that:
    - Opened the profile file for powershell with `nvim $profile`
    - Added my aliases to that file according to [the docs](https://docs.microsoft.com/en-us/powershell/module/microsoft.powershell.utility/new-alias?view=powershell-7); ie `Set-Alias -Name ed -Value nvim` means I only need to type `ed` to open neovim. Saved and closed this file.
    - I restarted my shell and got complaints about the file not being digitally signed, so I ran powershell as an administrator and ran `Set-ExecutionPolicy RemoteSigned -Scope CurrentUser`
- The git aliases I had defined in unix were not as easy to set up in Windows, so I'm trying out posh-git instead, which I installed with `choco install poshgit` and so far it's been useful for providing git status information in the command line and tab completion on git commands to save a bit more time.

So far this does not have me completely on par across all platforms (for example I need to run `git --git-dir=$HOME/.cfg/ --work-tree=$HOME pull` to pull down all of my fresh dotfiles manually), but it did get me into a comfortable working state for each and taught me a fair bit about the differences between them. It also made me realize an important lesson about recognizing when the best tool for the job is not necessarily the one I'm most comfortable with. 

On Windows I'm far more likely to use Vscode with its built in git support than anything else, but it's nice to know what is possible. Unix systems will more likely than not have me back to using the settings I've moved about in this series. I think this was a good exercise, but it was challenging and frustrating and almost made me feel burnt out on managing dotfiles (my former comfort zone!)

I hope this was an interesting albeit quick overview of what goes into cross platform dotfile management. Thanks for reading!