DEV Community

Mark Davies
Mark Davies

Posted on

I'll make my own dev container with nvim and blackjack

Blackjack Hookers GIF - Find & Share on GIPHY

Discover & share this Blackjack GIF with everyone you know. GIPHY is how you search, share, discover, and create GIFs.

favicon giphy.com

Over the last year I have been watching a lot of The primeagen on youtube and he has been saying something that really resonating with me that you should learn your editor and use something that you personally reallly enjoy. I have to admit at the time (being a dotnet developer) I used a lot of JetBrains Rider, but I was what most people would say a "shortcut demon" and one day I saw prime doing stuff with Vim and it blew my mind, the fact that he could do almost any thing he wanted without using the mouse was stunning - I wanted that skill.

I come from a computer games background - back in the early 2000's I loved command and conquer and played the hell out of Starcraft 2, and I loved a good hotkey. I thought I had reached the peak of my hotkey usage in software development, but I was so wrong. Little did I know that you could spend 90% of your day without even thinking about the mouse. And now I have a crazy stupid idea that I want to share - and I have no idea what this is going to be like.

But first of all

What is vim

vim is a terminal based text editor - it has three modes - insert, visual and command mode, when you first "enter" vim you might be confused as none of the keys actually type letters, this is because you are in visual mode - this is the mode you use to navigate the file, it is actually called normal mode because this is the mode it expects you'll be in most of the time and can do very quick edits. insert mode it where you actually edit and add text and visual mode is a selection mode.

vim is installed on almost every version of unix, I am but a simple windows user so I had to actually install it. I will add the caveat that I actually use neovim just because I prefer the lua interface and only used vim when I was starting out.

 How did you get started

One of the things that primeagen (and yes sorry seeing as he is the driving force behind this I will be mentioning him a bit) mentioned is that before you go "full vim" you should learn the keybindings as those alone will make you more productive. and here I have to admit I had my first slip up - I have never learned how to type on a computer keyboard properly, meaning that at the most I was using two or three fingers to actually type anything when it came to computers.

I had seen the ways in which people used vim so I actually dedicated myself to learn how to type properly on a keybaord for months - if you ever find yourself in a similar situation here are my suggestions:

typing.com - good for leaning finger placement and starting out
keybr.com - amazing for learning how to type properly and picking up some speed
https://monkeytype.com/ - amazing when you are feeling more comfortable with the touch typing and feel you can do it without guardrails

It took months to get back to where I was speed wise when typing and I have to admit it was agonizing - I would be typign messages out to people at half even quarter of the speed I was used to but I stuck at it. If I was under a lot of time pressure only then would I revert back to using my way of typing, jsut to crack out what I need to crack out and then I immediately went back to typing at 20 words per minute (probably not that bad but you get my meaning).

I have been working at it for around 9 months now and I touch type at twice the speed i used to be able to type - I would highly sugges this for any programmer out there that might be putting it off like I did.

With that under way I moved to vim key motions in Rider - here is where the struggles really began because it tooks another couple of months to get used to moving around with my keyboard, I gave up at this more than the typing because I just felt it was horrible. But I persisted.

Downloading neovim

The first time I downloaded nvim I was dissapointed because I couldn't even do anything with code I had no highlighting and I couldn't go to definition on anything.

I heard of some ways that you can configure nvim I initially went with NVChad: https://nvchad.com/

This was more like it! I had syntax highlighting and could move around my code, again it took MONTHS to learn the hotkeys I eventually prefered lunar vim https://www.lunarvim.org/ but these days use lazyvim https://www.lazyvim.org/ as the hotkeys click a little easier and I find lazy a little "closer to the metal" than the other two - I think if I was to start again I would go for kickstart - https://github.com/nvim-lua/kickstart.nvim which is just one file that is heavily commented with what is going on, the less the distro is doing the better I feel now that I am more comfortable with neovim.

 Embracing the terminal

The terminal is a super power - I have been developing for almost 10 years and I think this has been the best shift I have made - I have such better understanding of my tools and how to use them than I did at the start of this journey. I truely believe that ALL developers should go through this journey it is very much worth while - running terminal commands to start, build,test your program, learn how to grep how to curl, I swear the terminal is absolute magical.

I said that I had windows I will say one of the big shifts that I did that was a little crazy (or felt it at the time) was that I was slowly wanting to try a linux distro, I turned to WSL as a toe in the water.

I will say I had a rocky relationship with linux I installed it on some old computers when I was younger and the amount of terminal usage put me off. and the amount of commands or having to just copy and paste from the internet to get things running.

I WAS SO WRONG

Once you learn some simple commands a whole new world in opened to you it felt amazing. I was looking up just ways I could use the terminal more I bumped into tmux - which yes now I use it is amazing.

Dev Containers

This came as one of those quirky ideas that occurred to me now that I am more comfortable with linux - what if you could encapsulate your dev environment into a docker container that you could clone and run - everything would be there and you could seperate one project from another. Wouldn't you know it docker were thinking something very similar - the only thing wrong with their thinking was that they seem to be centering it around vs code 🥲

This is where I have to say it - I hate vscode

not because it's owned by microsoft or that it's slow and eats all my ram (even though those are contributing factors) but I genuinley think that as a text editor it sucks. The hotkeys are horrible and I could never find a workflow that stuck with me - when using vscode I felt like I was dragging my feet through wet mud.

seeing as I am loving the new neovim workflow I was thinking to myself that you could have a docker container that downloaded and installed neovim and git and boom your dev environment - what else do you need.

This is what I am trying out and I think I will try and update in a month to say either this was the worst idea ever or that actually this is legit. I'll let you know, look out for the github updates here:

GitHub logo joro550 / docker-dev

some images to dev with

Top comments (0)