This presentation was prepared by me (Giacomo Mantani) in his personal capacity. The opinions expressed are the author’s own and do not reflect the view of the CeSeNA Security Team.
We focus on Vim, not Vi.
$ vim FILENAME
$ gvim FILENAME
+---------------------------------------+ |# | |~ | |~ | |~ | |~ | |"file.txt" [New file] | +---------------------------------------+ ('#" is the cursor position.)
The editor behaves differently, depending on which mode you are in.
Do not ever touch your mouse or arrow keys!
In NORMAL mode we can switch to:
quit without save
write and quit
write and quit
Goto last inserted text
Goto older position in change list
Edit the file under or after the cursor
Goto definition of word under the cursor
$ vim phrack49.tar.gz # ;)
:set noundofile viminfo= :noswapfile edit secrets.txt
:x. It prompts a password for write the current file encrypted.
keyoption will be set with
:X. Never set it manually, it will be into viminfo*!
blowfish2is the best choice.
* The viminfo file is designed to store status information.
GnuPG, free implementation of the OpenPGP, allow you to encrypt and sign your data.
Arguing that you don’t care about the right to privacy because you have nothing to hide is no different from saying you don’t care about free speech because you have nothing to say. - Edward Snowden
Rot13 on the fly!
Ebg13 ba gur syl!
CTRL-N (next) match.
dictionary’ option (
thesaurus’ option (
complete’ option (
Do you prefer using
function! CleverTab() if strpart( getline('.'), 0, col('.')-1 ) =~ '^\s*$' return "\<Tab>" else return "\<C-N>" endif endfunction inoremap <Tab> <C-R>=CleverTab()<CR>
:set background=dark or
It is also possible to write your own syntax highlighted.
K run a program to lookup the keyword under the cursor. The name of the program is given with the ‘keywordprg’ option (default is “man”).
Contains information about the file list, window layout, global variables, options and more. Exactly what is remembered is controlled by the ‘sessionoptions’ option.
Vim has a set of so called “quickfix” commands. They enable you to compile a program from within Vim and then go through the errors generated and fix them (hopefully).
If errors were generated, they are captured and the editor positions you where the first error occurred.
:set makeprg=gcc\ -Wall\ -ggdb3\ -o\ %<\ %
Netrw makes reading files, writing files, browsing over a network or locally easy!
I really enjoy spread knowledge and being helpful and I love to talk with smart people about everything.
Try to practice whenever it is possible!