Tip – Vim Indent Solution

vim indentation

Some time back we wrote about a tip to fix vim indentation getting problematic when copy-pasting. That works great – but only if the original code that you are copying is indented properly. It may be indented properly but with different indentation settings (tabs instead of spaces, indent of 2 or 8 spaces instead of your favourite of 4 spaces). When added to the your code, it stands out awkwardly from the rest of the code. Here’s another use case – as programmers, we often encounter badly indented code and….. Read More

Tip – Vim Indent Paste Solution

vim indentation problem

If you have faced problem with indentation getting problematic whenever you copy paste to vim, here is a simple tip. Before we go there – simple illustration of the problem. Lets say the following text is something you are pasting to vim in the insert mode int main(void) { int i, j; for(i=0; i<10; i++){ j = i*2 ; printf(“\n j %d”,j) ; } return 0 ; } When you paste in vim, the same code appears something like the following As you can notice, the indentation totally gets haywire….. Read More

Linux – Search Text In Files And Open Result In VIM

Directory Structure

If you are working on a project which has a lot of source files, there is always a need of searching for a given text or string in all the files of your work area and possibly opening all those files one by one either to check for the usage of that text or for general viewing. In this post, I will explain how you can search for a given string or a piece of text in all the files of your project and be able to open each of….. Read More

A Useful VIMRC That You Can Use

Whenever you migrate to new unix environment and have to setup all your preferences from scratch, one of the most important settings is that of your vimrc file. For starters, .vimrc file is a file in a user’s home directory which is used by vim to load preferences for any vim session that the given user opens. Recently I migrated to a new environment and I solely missed my old vimrc settings. This resulted in me recollecting the old settings as well as googling my way through to find the….. Read More