Here are a few VIM commands to type within the editor to check the current settings and enable what is missing to make VIM auto-indent your file.
If disabled, the output will be :
filetype detection:ON plugin:ON indent:OFF
To enable it :
:filetype indent on
To list all the indentations file available (for any programming language for instance)
If you find one that matches the programming language that you are typing in your editor, to indent your code :
To make it permanent, add the following line in your .vimrc file :
filetype indent on
Quick tip for swapping two characters in Vim. Type the following commands starting on the first character to swap :
python-jedi is a plugin available for Vim that features auto-completion for the Python programming language.
It is available as an Ubuntu package :
apt install vim-python-jedi
To enable it as a user :
vim-addons install python-jedi
vam install python-jedi
To start using it in Vim, the keyboard shortcut CTRL+Space is a good start for auto-completing.
Further readings :
jedi autocompletion library for VIM
VIM for development on Stackabuse
Windows PowerShell Syntax Plugin provides Syntax coloring, indenting and filetype detection for Windows PowerShell.
It is available at :
If you use Pathogen, just extract into your bundle folder.
If not, just set up Pathogen as follows below :
Additional actions to make it work on Windows 7 :
cd C:\Program Files (x86)\Vim\vimfiles
Install pathogen.vim in C:\Program Files (x86)\Vim\vimfiles\autoload
To enable Pathogen, add this to your gvimrc :
filetype plugin indent on
On Windows 7/10, the gvimrc file must be named as _gvimrc and located in one of the folders :
$HOME points to your home directory in Windows 7 and $VIM points to your directory where Vim/gVim have been installed.
The personal initialization files are searched in the order specified above
and only the first one that is found is read.
This plugin is now enabled. Enjoy !
Debian provides deb packages for Vim and Vim scripts. Vim scripts are a set of addons to vim to automate repetitive tasks or adding new functionalities to the Vim editor.
This addon, closetag.vim, will be installed and enabled and ready for use when editing an HTML file.
Debian provide a central way to manage Vim addons, vim-addons-manager, system-wide or a per-user configuration.
To install it :
apt install vim-addon-manager vim-scripts
To enable it just for you :
vim-addons install closetag
A local copy of closetag.vim is created in ~/.vim/macros
To enable it in your Vim editor :
The auto-closing function is available in insert mode by typing Ctrl-_
More infos :
Debian Packaging Policy for Vim
Just a quick tip to avoid using the Esc key while leaving the insert mode in Vim.
This can be replaced with your own shortcut.
Put this within your own Vim configuration file vimrc :
inoremap jj <ESC>
To avoid typing the same lines each time you open up a new file in vim, here is a little trick to do it. Let’s have a try with a simple perl template.
fool@localhost:~$ mkdir .vim
fool@localhost:.vim$cat > perl.template <<EOF
Now, in your vim’s configuration file :
fool@localhost:~$ cat >> .vimrc <<EOF
au BufNewFile *.pl 0r ~/.vim/perl.template
Anytime you create a new perl script with vim, you will find a few lines already it. Hope it helps !