Pages

Showing posts with label vim. Show all posts
Showing posts with label vim. Show all posts

Thursday, 17 July 2014

Learning Git basics


I spent some time on the basics of Git today with Pro Git till chapter 3 (excluding Rebase). I feel like I am good to go.

Also, a few days ago, I had spent some time with git on try.github.io and a short random Youtube tutorial. I wanted to start with Pro Git even then but I was a bit tired and thought of doing walkthroughs to get accustomed to the Git environment instead. 

But the book is the best resource I have found till now and the workflow is pretty good too which makes it good even for beginners like me. 

Even then, I don't think I'll be studying the next chapters for some time now except for troubleshooting. This is because my purpose for leaning git for now was to have my projects in remote servers for better access, do a bit of branching for experimentation and, of course, as a hedge against disaster. (Like the time when while testing a new mapping in vim, I deleted most of my settings.py file in the djano app and realized it quite late.) In hindsight, it would also be cool to have a commit streak longer than 1 day on github.

Also I made an account on Bitbucket today, in addition to the one on Github, after realizing that it allows free private repositories. Maybe I could use it to hide some embarrassing noob projects. (Not that they aren't already there on Github.)


Friday, 11 July 2014

Opening a new file in Vim


I remember observing a few days ago that all the commands in my terminal were about opening various files of the project in vim. So I spent some time on finding a command which would, in vim itself, save the current file and open a new file.

I found out that you can give commands to shell using :! command, for example :! python manage.py syncdb. That seemed to be pretty cool.

But then I discovered a godsend, :tabe {file}. (Short for :tabedit, I also learnt that vim takes up the least possible characters which can be used to uniquely identify a command. Neat.) It opens up the file in new tab for editing. I didn't even know tabs existed in vim! And as I was working on django, being able to have multiple files open in the same window surely boosted efficiency by a few notches. There are always a few tabs open for me now and I dread remembering the closing and opening of files that I needed to do.

But today I again felt a need of a command to save the current file and open a new one. I remember not getting anything the last time I searched for it. I hope I get some time in the next few days to find it. Or better still, hopefully, I'll stumble upon it.


Auto-completion in VIM


I got to know about Ctrl-N in Vim a few days ago which autocompletes the words already in the file. But I still feel that I may be able to save a lot more on typing if I spend some time looking for new commands and ways to improve my vimrc.