"hello world"
article in Tech linux-unix-and-friends

ViM - IMproved "visual editor"

welcome home : vim online

There are many kinds of text editors out there. Few are as good as vi. I know, I know, it isn't like your normal editor. There is this concept of command mode vs. insert mode....a lot more work than most other editors to master, and many times not so user friendly. However, learn to love it, and you'll be rewarded. :)

One reason I love VIM is because it is available on most every OS. You can also gaurantee that it is going to be on every UNIX/Linux/Mac/Cygwin/etc system you touch.


cloudhead.io:Staying the hell out of insert mode - exiting insert mode? press Esc, is not the answer, not in a browser(cloud9 vim) try: Ctrl-[ and Ctrl-C.
Insert Mode hotkeys:
Ctrl-Y: insert the character right above the cursor.
Ctrl-U: delete the current line from the cursor position.
Ctrl-A: re-insert the text inserted in the previous insert session.
YouCompleteMe by Valloric - YouCompleteMe is a fast, as-you-type, fuzzy-search code completion engine for Vim.

Here are some cool things I love about VIM.
Vimbits

Here is why vim uses the hjkl keys as arrow keys - good coders code, great reuse - ADM-3A keyboard had the arrow keys on hjkl. hardware precedence.

refresh vim screen

Ctrl-L to refresh the display
:e to reload the file from disk and refresh display.

Go to the beginning and end of line

0 goes to beginning and $ goes to end in command mode.

Column mode vim | vertical selection with vim

Ctrl + V to go into column mode
Shift + i to go into insert mode in column mode
Esc to leave insert mode, applying your changes.

Selecting columns with visual block mode - vimcasts.org on column commands and using visual block mode.
editor - How to do column editing in vim? - Stack Overflow

gmarik/Vundle.vim - Vundle, the plug-in manager for Vim. git clone https://github.com/gmarik/vundle.git ~/.vim/bundle/vundle

help and useful commands in vim

Type ":help" in Vim to get started. Type ":help subject" to get help on a specific subject.

Some useful vim commands follow:

:set paste              - Turn on pasting mode.
:set nopaste            - Turn off pasting mode.
:set ai                 - Turn on autoindenting.
:set noai               - Turn off autoindenting.
:set textwidth=0        - Disable maximum text width.
:set textwidth=78       - Set max width that text can be insterted to 78.
:set list               - Show tabs as '^I' and end of line characters as '$'.
:set nolist             - Turn off list mode.
:syntax on              - Turn on syntax highlighting.
:set ruler              - should show a column ruler in vim..if you have a new enough version.
:set number             - shows line numbers, set nonumber to turn line numbers off.
:syntax off             - Turn off syntax highlighting.

Web Resources

The VIM (Vi IMproved) Home Page
The Vi Lovers Home Page
Extending Vim with Python - Program - Python - Builder AU
Vi Cheat Sheet
How I boosted my Vim » nvie.com
macvim - Project Hosting on Google Code - MacVim is a port of the text editor Vim to Mac OS X.
VimGolf - real Vim ninjas count every keystroke!
How I boosted my Vim » nvie.com
vi Editor Commands
Vim tricks from OSCON 2007 and beyond « Adam Monsen
mklabs/vim-backbone - Lightweight bag of Vim utilities for Backbone - snipmate snippets, templates and omnicompletion


su write vim

There are times when you vi a file that you don't have perms to write to.... instead of saving it to an alternate file and moving it over top of the orginal, you can simply do the following...
:w !sudo tee % > /dev/null 


search and replace in vi

If you want to search an entire file, you can use % to indicate whole document as the range:
:%s/search/replace/g
The range is optional; if you just run :s/search/replace/, it will search only the current line and match only the first occurrence of a term.
Linux.com :: Vim tips: The basics of search and replace


Insert command output into document within vim

In the normal mode
!! date
(!! will replace the current line with the output of the command).


external applications and vi

Running make (Compiling) From Vim | Core Dump
Display output of shell commands in new window - Vim Tips Wiki - :Shell
Conque Shell - Run interactive commands inside a Vim buffer : vim online - works on both linux and windows
VIM CASTS Episodes
Vim: revisited
Vim: Seven habits of effective text editing


status/tabline enhancements for vim

vim-airline
bling/vim-airline · GitHub - lean & mean status/tabline for vim that's light as air
Lokaltog/powerline · GitHub - The ultimate statusline/prompt utility. (written in Python)


.files || dotfiles || vimfiles

hoelzro/vimfiles · GitHub
GitHub does dotfiles - dotfiles.github.io
Tyblog | Yet Another Vim Setup



rc3.org - The grammar of Vim
Andrei Zmievski’s Vim for Programmers
Learn to speak vim - verbs, nouns, and modifiers!


vi convert tab to space

:set expandtab tabstop=4 shiftwidth=4

Switch to HEX edit mode using VIM

Enter hex edit mode:%!xxd
Exit hex edit mode:%!xxd -r


LogBook » How to Change Linux Ubuntu’s default editor from Nano to Vim? - sudo update-alternatives --config editor


Stealing from Padre for Vim part 3 - using App::EditorTools from vim mappings.
Recovering After Vim Terminates - find . -name "*.swp"...


check for shebang and bind execution to F5

~/.vimrc
function! RunShebang()
  if (match(getline(1), '^\#!') == 0)
    :!./%
  else
    echo "No shebang in this file."
  endif
endfunction
map <F5> :call RunShebang()<CR>
Execute current file in Vim | powdahound.com
Daily Vim: Text Editor Tips, Tricks, Tutorials, and HOWTOs: Vim Sugar

Vim Tips Wiki


unicode characters paste as . || paste unicode putty to vim

I've had trouble in the past, and it ended up being my terminal putty not having character set as UTF-8. ?Unicode: Unicode and Putty (Windows) -> "Change settings",select the session you wish to check from the "Saved Sessions" field,selet "Window / Translation",set "Received data assumed to be in which character set:" to UTF-8 click [Apply]


Vim Clutch

alevchuk/vim-clutch -
Shared State - Using a Vim Clutch - mentions that most of the time we aren't simply going into insert mode..
Horners HIDHelve - Dave Horner's Website...


vim reopen last file alias

alias vl='vim -c "normal '\''0"'

Vim - reopen last opened file - YouTube


vimdiff || vi diff

vimcasts.org - Comparing buffers with vimdiff
vimdiff - the cool way to diff for vim users | Dreams of Thought
linux - Vimdiff: What are the most frequently used commands/shortcuts that could get a newbie started? - Stack Overflow
tpope/vim-fugitive - fugitive.vim: a Git wrapper so awesome, it should be illegal. @tpope, would not lie to you.


Vim::Debug::Manual - Integrate the Perl debugger with Vim - metacpan.org

ctrlp.vim ÷ home - Full path fuzzy file, buffer, mru, tag, ... finder for Vim.


macros

Macros - Vim Tips Wiki


Created: 2005-05-10 00:10:06 Modified: 2014-05-19 13:15:44
/root sections/
>peach custard pie
>linux
>windows
>programming
>random tech
>science
>research


moon and stars



My brain

Visible Dave Project


0, 1, 1, 2, 3, 5, 8, 13, 21, 34,...
xn = xn-1 + xn-2