T
T
Tolik2014-12-01 23:03:24
vim
Tolik, 2014-12-01 23:03:24

How to make "quick access" to a function in Vim?

Let's say every time I want to save a session I write:
:!rm .session.vim
:mksession .session.vim
But I'm sure that you can write a simple function that you put in .vimrc and when I enter for example :savesession then these two commands will be executed at once. How to do it?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
K
Konkase, 2014-12-01
@Diel

An example of setting up hotkeys, put in .vimrc:

" F2 - сохранить файл
nmap <F2> :w<cr>
vmap <F2> <esc>:w<cr>i
imap <F2> <esc>:w<cr>i

T
tsarevfs, 2014-12-01
@tsarevfs

Somehow so .

S
Sergey Krasnodemsky, 2014-12-27
@Prognosticator

https://github.com/xolox/vim-session
Able to save the session on exit, there is also an autosave with a given frequency.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question