Contact Us

Vim on Windows: Resolve Python dependency without a system wide installation

Since many Vim plugins depend on Python; updating Vim often requires a Python update. We will see how to resolve such plugin dependencies using an embeddable Python distribution. Does Python already work? Before starting, check whether you happen to have the correct version of Python installed. :echo has('python3') If this prints 1 then you are good; no need to embed Python. Was Vim compiled with Python support? Check whether your Vim was compiled with Python support.

Read More ...

Using the Vi mode in Bash command line

Bash uses the Readline library for handling command-line input. One of the editing modes supported by the Readline library is the vi mode; the other one being emacs mode. To enable vi mode use the following command. $ set -o vi To verify that you are in vi mode, use the command. $ shopt -o vi Unlike in Vim, insert mode is the default in bash. Press escape to enter command mode.

Read More ...

Learning Vim script: How to execute scripts

A Vim script file consists of a series of colon commands, also known as Ex commands or command-line commands. Even language constructs like loops, functions, etc are also colon commands; more on that later. Use the source command to execute a script file. :source script.vim It is not compulsory to use .vim as the extension for Vim script files, but it is the custom and is recommended. The source command executes each statement in the script.

Read More ...

Vim script: Functions

Functions in Vim script starts with the function keyword and ends with the endfunction keyword. 1:function PrintMessage() 2 :echo "Hello World" 3:endfunction To run this function use the call command: 1:call PrintMessage() Function names User-defined functions in Vim script must start with a capital letter unless they are explicitly scoped. This is to prevent name conflicts with Vim’s internal functions. Functions without an explicit scope like the one in the previous example, have global scope.

Read More ...

Vim script : How to use an expression in a Vim command

Many Vim commands do not support variables or expressions. cd ProjectRootGet() A command like the above one will not work in Vim, you have to supply literal values as parameters. But Vim provides ways of working around this limitation. Backtick Equals If the Vim command expects a filename or directory as a parameter, as in the above example, you can use the backtick equals option to supply an expression as parameter.

Read More ...

Vim Abbreviations

Vim abbreviations can be used to automatically expand words or phrases which you commonly use. It can also be used to correct common spelling mistakes. Use the abbreviate command to define abbreviations, the command can be shortened as ab. Abbreviations work in the insert and command-line modes. Define the following abbreviations. 1:ab teh the 2:ab jdm [email protected] Now type “teh” followed by a space, it will autocorrect to “the”. Similarly, “jdm” will expand to “john_doe@gmail.

Read More ...

Gvim on windows: solving Tagbar’s “window flashing” problem using Vim-Shell

One of the annoying things about using Gvim on windows is that every time a plugin calls Vim’s system command, the DOS command window will flash. Tagbar is one of the many plugins which have this problem. Here is a solution for this in Tagbar using Xolox’s Vim-Shell plugin. Please note that I am not referring to Shougo’s plugin with the same name.

Read More ...