Saturday, April 6, 2019

Git better - organized my terminal scripts and setups for all my linux installs

Git has become pretty much standard for many developers now. It's still not always liked though. I've do like how well it works with scripting, and implementations like gitlab have decent support for pipelines making it useful as the interface for deployment.

After having to reinstall Linux recently on my main server, I decided to automate the general setup. I had my terminal working so nicely, and painstakingly setup my bash profiles, vim etc. I've had a github account for a while, but had not really been using it for much. Figured it was time I make a general setup for linux, vim and whatever else I needed.

https://github.com/beomagi/general-setup


I'm all in for VIM.

I start by installing all general purpose stuff I'd want, then setup vim. Just the standard vim, but I add plug for managing plugins, and a few plugins like lightline (status line at bottom), nerdtree (file browser) and neocomplete (a general autocomplete plugin). The result is I now spend more time in VIM than I do in VSCode.

I've also edited an existing "molokai" colorscheme. With dim laptop screens, I've found some colors to be a little hard to see (or maybe my eyes are going? :P). Either way, I've edited the colors to be brighter.


When I execute things, it's a terminal case...

On colors, I've edited my terminal to better reflect what I've been working on.
Some fluff like weather, but that's only on startup. The prompt includes time, so I can see what I ran and when. The GIT branch is also displayed.

At the start, several functions are declared as well. 
"displayset" is mostly for my work laptop's linux VM. It takes the IP from "pinky" so that it can export the DISPLAY variable there.

"cd" has been written so it stores the current folder before changing to another folder. "cdr" uses this to go to the previous folder. "cdl" lists the folder history (sorted, uniques). This is just to make like in terminal a little quicker. Note that functions like the original "cd" are easily accessed using "builtin cd".

"gitlog" lets me see for a branch what commits were made, and gives me the hashcode so I can easily cherrypick (git cherry-pick <HASHKEY> ).
e.g.


"yaml2json" converts yaml to json. I've not found anything for yaml that's as good as jq, so dealing with a large yaml file sucks.

"spacechk" is my way of figuring out what is taking up so much space on my drive :P
For each file/folder on the current level, it displays the size, usage of the drive it's on and the mount point.


Why git?
  • Because it's easy for me to setup a new pc and get the terminal and VIM just how I like it.
  • Sharing functions and bits of code is easy
  • I'm constantly making changes to things here, and like that these changes easily propagate to my other machines.

No comments:

Post a Comment