Getting Started with Dotfile Management with Git on Windows
Sabrina
Posted on January 12, 2020
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:
- Git cloned dotfiles down as per usual.
- I also manually removed the platform specific files in this step as well.
- Installed neovim with 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)
- Moved neovims init.vim to
~\AppData\Local\nvim\init.vim
-
Installed Plug to windows following the documentation, 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!
choco install fzf
this comes with some limitations as outlined in the docschoco install ripgrep
-
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; ie
Set-Alias -Name ed -Value nvim
means I only need to typeed
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
- Opened the profile file for powershell with
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!
Posted on January 12, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.