Skip to main content
Share Your Experience: Take the 2024 Developer Survey

Questions tagged [save]

Writing files to a persistent storage medium (usually a hard drive or SSD). In Vi, this is done with the :write command.

Filter by
Sorted by
Tagged with
1 vote
2 answers
34 views

Neovim doesn't open previously unopen file in horizontal split

In classic Vi/Vim when I opened a previously unopened file with ctrlp, NERDTree, etc. and the current file/buffer was unsaved, it would open the new file in a horizontal split. After switching to ...
webermaster's user avatar
1 vote
2 answers
63 views

Is there a default normal-mode command for `:write`?

I know ZZ will write and quit, and ZQ will quit without saving. Is there another such command to write the buffer without doing anything else, or should I map one myself? I'd like to know if there's ...
wallefan's user avatar
  • 171
3 votes
1 answer
67 views

Can ++enc=utf-8 be made the default action for :w?

After pasting text snippets from web sites into an existing Vim file, I often have to save the file with :w ++enc=utf-8 to avoid a conversion error. Can that be made the default? I have set ...
carolus's user avatar
  • 33
0 votes
1 answer
58 views

How do I create key mappings for Windows and/or nano Shortcuts?

Having used text editors (mainly Notepad/++) and some IDEs on MS Windows, I've become familiar with their Alt and Ctrl shortcuts to the point that I use them automatically. Having used nano on a GNU/...
Agi Hammerthief's user avatar
0 votes
0 answers
157 views

Neovim tries to run vale through a Autocommand

Whenever I save a .txt file it I get the error: Error detected while processing BufWritePost Autocommands for "*": Error running vale: ENOENT: no such file or directory I have tried using :...
Dario Spinnato's user avatar
1 vote
1 answer
131 views

How can I edit a file in real-time?

I would like to edit a file using Neovim and have changes saved in real-time (changes should be written to the file as I am typing), which will be displayed by an OBS plugin. Is this possible?
CoffeeDev's user avatar
0 votes
1 answer
121 views

Can't use `:wqa` with open terminal buffers

I have next problem: When I use :term buffers the :wqa command produces error: Which is quite expected because terminal buffers isn't writable. BUT the :wa and :q separatly work. This is strange. To ...
Vladyslav Rehan's user avatar
0 votes
2 answers
110 views

:updateall command to update all files

There's a :w and a :wall command but there's only an update command, there isn't a :updateall command. Why isn't there one and how would you implement it in vimscript and lua ?
cassepipe's user avatar
  • 385
0 votes
1 answer
71 views

How can I make Vim ssd friendlier?

When I append a line to an existing file with Vim, Vim will unlink that file and create a new one on :w, although that is unnecessary. Vim even does the same with ~/.viminfo every time... I found it ...
RRIDDICC's user avatar
0 votes
1 answer
637 views

Prevent message when writing buffer

Whenever I write a file in Neovim, I get a message like this: "config/nvim/lua/config/keymaps.lua" 55L, 2256B Sometimes, this can cause a press ENTER or type command to continue message to ...
LandonSchropp's user avatar
1 vote
2 answers
49 views

Make ":w" command throw an error on filenames starting with a colon ":"

From time to time I accidentally create files with names like ":w" or ":q". This happens when instead of writing :wq I type :w:q and sometimes, for some reason, even :w:w or :w :w. ...
Karolis Koncevičius's user avatar
1 vote
1 answer
1k views

Lost my small project, can I get it back?

I am a new vim user and currently using neovim on Linux. I my whole project which I had written in one file (only 1 day of work). There are two ways I could've lost it: I saved the file but ...
user43628's user avatar
2 votes
3 answers
390 views

How to save a file for which I have no write permissions on Windows

I would like to edit files like C:\Widows\System32\Drivers\etc\hosts that need administrative privilege to be modified. How can save the file on Windows if Vim has not been starter with administrator ...
Vivian De Smedt's user avatar
4 votes
1 answer
282 views

How to explain ++opt in :[range]w[rite] [++opt] !{cmd}?

Get manual with help: help :w_c: :[range]w[rite] [++opt] !{cmd} Execute {cmd} with [range] lines as standard input (note the space in front of the '!'). {cmd} is ...
showkey's user avatar
  • 1,140
-1 votes
1 answer
65 views

how to disable the new popup file-picker on :w

If I try to write a file under a new name, instead of being able to edit an existing name provided by file-completion, I get a pop-up that only lets me select an existing one. I saw a description of ...
n952162's user avatar
2 votes
2 answers
569 views

"Update" all of the unsaved buffers at vim

Is there a counterpart for the wall command at vim. I currently have an event handler for focus lost, so as whenever i switch to another window, vim would automatically write all of the buffers ...
xquilt's user avatar
  • 81
0 votes
1 answer
93 views

Are there quicker methods for Closing Files?

In nano, I like that I can just hit ctrl x to exit a file I'm editing without saving it. I also like that I can type ctrl o to save a file. I've completed the vim trainer and am trying to like vim. ...
Lonnie Best's user avatar
0 votes
1 answer
151 views

Auto update a buffer opend in a split when it changed?

I'm writing TypeScript and there is a command npx tsc --watch that will (over)write to an output file every time the source file is changed. I open one split for each of these files. But when I save ...
NeoZoom.lua's user avatar
  • 1,500
0 votes
0 answers
38 views

Cursor get stuck at the statusline bar when saving a .tex file (probably due to vimtex)

To preface this, I'm relatively new to vim, and I'm using Windows Subsytsem for Linux, and the Windows Terminal if this makes any difference. So whenever I'm editing a .tex file and want to save, ...
MoonlessNightss's user avatar
0 votes
2 answers
157 views

Running shell command (Rmarkdown::render) every save

I am trying to autogenerate an output every time I save the file with :update or with :w. This is what I got so far: augroup renderRmd | au! autocmd BufWritePost *.rmd !'Rscript -e "rmarkdown:...
lf_araujo's user avatar
  • 113
5 votes
2 answers
1k views

Is there a way to write a file and skip the autocmd on write?

My .vimrc has, autocmd FileType rust autocmd BufWritePre <buffer> call LanguageClient#textDocument_formatting_sync() This works great, unless my LanguageClient crashes. Then I can't write the ...
Evan Carroll's user avatar
  • 1,384
0 votes
0 answers
101 views

Why isn't vim recovering the most recent save

I'm having some graphical issues with my setup that means I sometimes need to restart my machine having not saved a file which is currently being edited in vim. However, the saved file which vim ...
algae's user avatar
  • 121
0 votes
0 answers
181 views

Auto-save file on keypress

How can I automatically :w save a file after each keypress? Devs who have used editors like PHPStorm know this is particularly handy so I was looking for a way to achieve the same with vim.
adelriosantiago's user avatar
0 votes
0 answers
60 views

nvi: how to define a new command to write using sudo

In Vim, I can define the following command for writing a file using sudo: command! W :execute ':silent w !sudo tee % > /dev/null' | :edit! How do I define a similar command in nvi for saving using ...
Flux's user avatar
  • 1,041
2 votes
1 answer
157 views

Options readonly vs nowrite

Apologies if this is duplicate. I have searched and haven't found any related questions. What is the difference between the options readonly and nowrite? The reference manual says: readonly: If on, ...
mgarort's user avatar
  • 275
1 vote
1 answer
785 views

Automatically load & save folds of files - except for help files

My current solution to automatically load & save views of a file is the following: " automatically saves & loads folds when closing or opening a file set viewoptions-=options augroup ...
m_squared's user avatar
  • 121
2 votes
1 answer
1k views

Save all changed and unchanged buffers then exit

The command :wqa does not work with new files. For example, if you create some empty files and save them with :wqa, you will not find these files after you quit vim. They are not saved at all. The ...
Cyker's user avatar
  • 187
2 votes
0 answers
58 views

Why does Vim create ~ files? [duplicate]

Whenever I create a file, Vim also creates a .extension~ file. For example, when I create a main.cpp file, another one appears with main.cpp~. Is the .cpp~ file an older version of my .cpp file? Is ...
dinosauce33's user avatar
0 votes
1 answer
1k views

How do I change the place where my vim files are stored?

Right now, all my vim files that I create are stored in C:\Users\dinosauce33 (My user). How do I change it so that all of my files that I create are stored in documents?
dinosauce33's user avatar
3 votes
1 answer
232 views

Why is oldfiles not listing last edited file

I use vim in the following way: I open vim. Then I press i to start writing. Then I save the buffer and give the file a name by issuing the command :w some-file-name.txt Then I quit vim by :x Then ...
L Kiil's user avatar
  • 33
6 votes
2 answers
2k views

Why can't I write to a file in the home directory?

I want to write to a file in the home directory, so I tried the following command: :call writefile(["foo"], "~/event.log", "a") But I got an error: E482: Can't create ...
naive231's user avatar
  • 183
5 votes
1 answer
608 views

How can I write all named buffers?

I would like a command that saves every buffer that has a filename. :h :wall gives this: *:wa* *:wall* :wa[ll] Write all changed buffers. Buffers without a file ...
DJMcMayhem's user avatar
  • 17.6k
1 vote
0 answers
81 views

Run `checktime` only if buffer contents are different to the file contents

Sometimes a checktime causes a prompt to reload, even if the reloading would not change the buffer. This can be demonstrated (neovim 0.5): Open file in vim1 (terminal 1) Open the same file in vim2 (...
Tom Hale's user avatar
  • 2,691
1 vote
2 answers
72 views

Print message if file is not written on :update

When I do :update, I'd like to print a message if the buffer was not written (because it wasn't changed). I get a message upon save, but would like a message if save didn't occur, also.
Tom Hale's user avatar
  • 2,691
3 votes
1 answer
105 views

0-length file from new :term buffer: vim -c "w! file"

I have a file mk.out that contains ANSI codes, which can be cleaned up by opening it in Vim and issuing: :term cat % " Interpret codes in new buffer :only " Close source buffer `mk.out`...
user2153235's user avatar
1 vote
1 answer
420 views

Autosave and Nerdtree conflicts

I was trying to setup NeoVim to autosave each time a change is made. I used this command, which I wrote in ~/.config/nvim/init.vim: autocmd TextChanged, TextChangedI * silent write It works perfectly ...
deomanu01's user avatar
  • 119
2 votes
2 answers
509 views

How to save current new buffer (opened with :new) to other location, outside of current working location?

How to save current new buffer (opened with :new) to other location, outside of vim_data (which is default vim working location)? My default Vim working location in vimrc is set to ~/Desktop/vim_data ...
andrew_ysk's user avatar
3 votes
1 answer
395 views

Slow write/save speed for files on network

I noticed my VIM write/save file for a network path is quite slow. I found out VIM saves files with approximated speed of 20mbps (2.5MB/s). Network is 1Gb/s local area network so I believe the ...
gradzikb's user avatar
1 vote
1 answer
246 views

hex mode crashes after saving file

I have a a.out file from "hello world" in c: #include <stdio.h> #include <stdlib.h> int main(){ printf("hello world\n"); } Which I can see in hexdump (file a.out) ...
milanHrabos's user avatar
1 vote
1 answer
250 views

How to make autowrite apply to :make but not to :buffer?

I have set autowrite so that :make automatically saved the file before running the build command. But now I'm increasingly using :buffer to switch between buffers, and have now noticed that it ...
Ruslan's user avatar
  • 475
4 votes
1 answer
349 views

'endofline' option stays false after write operation

When one opens a file with an incomplete last line (File does not end with 0x0A / a new line character), the endofline option is set to false (:echo &endofline will print 0) and the [NOEOL] ...
dirdi's user avatar
  • 141
7 votes
2 answers
609 views

Possible to rename file and maintain undo?

Is there a way to rename/copy/move a file and maintain the vim persistent undo information? If I do :w new-file-name and then :e new-file-name I can't hit u to undo. Already at oldest change :-(
Alec Jacobson's user avatar
1 vote
1 answer
3k views

How to properly hook an action on save in vim

I have a code linter (https://github.com/symplify/easy-coding-standard) that I can run manually from the command line, but which I'd like to run automatically in vim whenever I save a file that I've ...
Codemonkey's user avatar
6 votes
3 answers
2k views

Vim not firing inotify events when writing file

Mentioned here as well: https://stackoverflow.com/questions/13312794/inotify-dont-treat-vim-editting-as-a-modification-event Really frustrating issue, how can I force vim to write the file? It ...
Chris Stryczynski's user avatar
1 vote
1 answer
252 views

BufLeave: Auto save split file not working

I usually keep *.in files open in split and edit them. I would like vim to autosave the *.in files whenever I switch between splits. Searching other answers I found BufLeave that suits my case. I ...
mtk's user avatar
  • 243
3 votes
2 answers
1k views

How to save file with today's date?

I am trying to save a file with today's date as part of name. To save file, we can just do :w myFile. To get today's date, we can use strftime. Ex: :echo strftime("%F") " returns 2020-03-27. Now I ...
Iggy's user avatar
  • 175
6 votes
1 answer
2k views

Saving file from INSERT mode

I would like to save files without exiting the INSERT mode. Is it possible? How?
Luís de Sousa's user avatar
2 votes
1 answer
209 views

Is there an autosave option for vi/nvi

My version is the following: :ve Version nvi-1.81.6nb5 (2009-08-11) The CSRG, University of California, Berkeley. Is it possible to save a file at regular intervals in vi/nvi? I know there is an "...
Ottavio Caruso's user avatar
2 votes
0 answers
230 views

How to profile save time

Sometimes it takes a really long time to save a file out. Saving the same file after various changes takes various amounts of time. It does not seem to be related to file size. I've disabled any ...
embedded.kyle's user avatar
0 votes
1 answer
162 views

Permit closing window with unsaved changes using vim setting

I wrote a plugin that executes a slow shell script and asynchronously shows the stdout in a popup (split) window. When I try to close my session while the popup is open, I get the message Save ...
Luke Davis's user avatar
  • 1,397