Facebook Twitter

Start - Make Vim as Your Bash-IDE Using bash-support Plugin - Pentadactyl. This post is written by SathiyaMoorthy.

Start - Make Vim as Your Bash-IDE Using bash-support Plugin - Pentadactyl

This article is part of the ongoing Vi / Vim Tips and Tricks Series. As a Linux sysadmin or programmer, you may do following repetitive tasks while coding bash shell script: Adding file header Adding function/frame comment Including default code snippet Performing syntax check Reading documentation about a function Converting a code block to comment, and vice versa The bash-Support Vim plugin offers easiest way to do all of the above, saving lot of time and keystrokes. The plugin was written by Fritz Mehner, who explains the purpose of the plugin as: “Write and run BASH-scripts using menus and hotkeys.” 3 Steps to Install the bash-support plugin Step 1: Download the bash-support plugin Download the plugin from website. $ cd /usr/src $ wget -O Step 2: Install the bash-support Vim Plugin $ mkdir ~/.vim # if the directory does not exist already $ cd ~/.vim $ unzip /usr/src/ Step 3: Enable the plugin in the ~/.vimrc.

Start - Have Intellisense search current directory - Vim Tips Wiki - Pentadactyl. This tip is relevant to those who use the "Intellisense" functionality for vim ( for C++.

Start - Have Intellisense search current directory - Vim Tips Wiki - Pentadactyl

This requires, as a part of its setup, that the paths for all the included header files in a C++ file be present in the $INCLUDE variable. This is fine so long as all your header files are in one (invariant) location (say the MSVC's include directory). However, if your C++ file includes header files in locations relative to the current file, updating the INCLUDE environment variable is not an option. For example, if your header files are in the same directory as your source file, simply add the following line to the cpp_vis.vim file that is delivered to the vimfiles\ftplugin location: let $INCLUDE = expand("%:p:h") . ";" . To include other relative paths, simply tweak the argument to expand(). Start - Omni completion - Vim Tips Wiki - Pentadactyl. Omni completion provides smart autocompletion for programs.

Start - Omni completion - Vim Tips Wiki - Pentadactyl

When invoked, the text before the cursor is inspected to guess what might follow. A popup menu offers word completion choices that may include struct and class members, system functions, and more. A similar feature in Microsoft Visual Studio is known as IntelliSense. Overview Edit Omni completion is not usually enabled by default. Filetype plugin on set omnifunc=syntaxcomplete#Complete Various programming languages are supported in Vim 7. When generating a tags file, Exuberant Ctags should be used. Using omni completion To use omni completion, type <C-X><C-O> while open in Insert mode. Related tips This is to be an overview of omnicompletion, with links to more detailed tips as required. Popup menu and mappings Random thoughts on IDE 1439 Using vim as an IDE all in one Usage with C++ See C++ code completion for omni completion in C++ programs. Usage with Python Insenvim 835 Have Intellisense search current directory.

Start - Su-write - Vim Tips Wiki - Pentadactyl. Sometimes you modify a file, for example from the /etc directory, then when you try to save the file, you get a permission-denied error.

Start - Su-write - Vim Tips Wiki - Pentadactyl

This tip presents some suggestions for using sudo from with Vim, so you can successfullly write the file with temporary privileges. Of course, this tip has to be used with caution, as it gets you more power. Suggestion 1 Edit If you find you do not have permission to perform :w, use the following: :w ! You can make a command so :W invokes sudo: command W w ! Or, if you know about the problem beforehand: sudoedit path_to_file sudo -e path_to_file Suggestion 2 The following function saves the current file to a temporary file, then copies the new file to replace the original. Function Suedit() let fname=tempname() exe 'w '.fname let owner=system('stat -c%U:%G '.expand("%")) let modes=system('stat -c%a '.expand("%")) exec '! Warning There is no check for symlinks.

Suggestion 3 Here is a mapping to save to a /tmp file, then overwrite the working file.