LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How do you save in "vim"? (https://www.linuxquestions.org/questions/linux-general-1/how-do-you-save-in-vim-32367/)

Mekaziah 10-09-2002 05:35 PM

How do you save in "vim"?
 
How do you save in "vim"? I've tried ":x", ctrl+s, anything I could think of or find online consisting this information? Sorry for asking such a stupid question, but I can't figure it out, heh.

mcleodnine 10-09-2002 05:43 PM

vim 101
<esc>:w<cr> (write the file)
<esc>:wq<cr> (write the file and quit)
<esc>:q!<cr> (force a quit without saving the file)
<esc>/searchphrase<cr> search the file for 'searchprhase'

trickykid 10-09-2002 05:45 PM

Also after making the changes and are in Command mode < esc > you can: <Shift + ZZ>

adam_boz 10-09-2002 06:29 PM

here's a quick reference file that I use:

"i" => insert mode

"Esc" => normal mode

in insert mode, it's just like a normal text-editor.

some basic normal mode commands:

:q! => quit w/out saving
:w <file> => write to <file> (<file> only needed once)
:wq => write and quit
dw => delete word
d$ => delet to end of line
dd => delet whole line
u => undo command
<ctrl>-g => show location & status of file
:<command> => execute <command> (in bash... ex: mkdir)

neo77777 10-09-2002 06:43 PM

I like using vi, and the trick with shift+z+z came in handy when I started to use it, you can see all that vi can offer in a command mode issue
:h
to quit out of it just use
:q


All times are GMT -5. The time now is 09:10 PM.