:vertical diffsplitopens a file and shows differences to the current opened buffer
Cscope -R -bScript for vim is
cscope_maps.vimOpen vim with main function as target:
vim -t mainSet cursor on a keyword:
CTRL-\ s-> searches for the keyword under cursor
CTRL-\ c-> lists the calls of the underlying function
CTRL-\ f-> opens the file under the cursor.
CTRL-spacebar *-> choose instead of the backslash spacebar then the functionality is the same but opening the target file opens it in a new window instead of opening the file in the same buffer. Open this site for more details.
:%!xxdto switch editor view to hex editor, and
:%!xxd -rto switch back.
You can use the "gu" command with a motion such as
ggguG
(gg = go to the top of the file, gu = make lowercase, G = until the end of the file)
Or you can visually select the block and press "u".
Or if there are no paragraph breaks in the desired text, you can use a text object:
guip
ctrl-w +, ctrl-w - : horicontal change of size ctrl-w <, ctrl-w > : vertical change of size ctrl-w = : all windows get the same size ctrl-w _ : current window is maximized (in horicontal view) ctrl-w | : current window is maximized (in vertical view)
The default colorsceme was not the best as preprocessor statments were shown in purple and this hurts quite much. Better results can be obtained with: :colorscheme murphy
For example you want to replace all
fds[fds_c]=name; fds_c=fds_c+1;
with
PUSH(name);
then use this:
s#fds\[fds_c\]=\(.*\); fds_c=fds_c+1;#PUSH(\1);#g
set foldenable set foldmethod=marker set foldmarker={,}
:set tabline=text title for tab
:set spell :set spelling=de,en,fr
You can find language packages for a lot of languages at the Vim FTP site.
Ask vim to suggest better ways to spell the word:
:set spellsuggest=23
z=
]s
[s
]S
[S
To add words to your own word list:
zg
zG
zw
zW
The commands bufdo, windo and tabdo are great for operating on all buffers or windows or tabs. However, the commands finish in a different place from where you started.
Mark a word or text part you want to search after. Copy it into register s. Then map the following and you can search the word with ctrl-s.
map <C-S> let @/=@s<CR>/<CR>
:set wrapmargin=20
:mksession <file> :mkview <file> :set viewdir=$HOME/.vim/views
use session:
vim -S Session.vim
or
:source Session.vim
use view:
:loadview View.vim
Make view if you leave Buffer:
autocmd BufWinLeave * mkview autocmd BufWinEnter * silent loadview
With sessionoptions you can adjust the settings which are going to store into the session file:
:set sessionoption=OPTIONS :set sessionoption=blank, buffers, curdir, folds, globals, help, localoptions, options, resize, sesdir, slash, tabpages, unix, winpos, winsize :set sessionoptions+=winpos
Options which are bold are default values. To show the options use:
:echo &sessionoptions
:mksession!
and add in your .vimrc:
silent source! Session.vim
Hint was found here.
set encoding=utf-8
Then you can use <crtl>+k and afterward [u] [:] to get a ü on a keyboard without this pad.
* searchs the word under cursor forward # same backwards
Mark a section in visual mode and press "=" to format this section.
The graphical pendant to vim is gvim. Config file is .gvimrc where you can place properties like "set guifont=...".
command mode:
ex commands: (these commands can be placed into .vimrc (_vimrc under windows) file in your home directory