Questions tagged [file]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
2 answers
87 views

How to force the Read-only mode?

Greetings Today I was learning the different methods for opening a file in Vim, and I recently learned the view [filename] or [vim_launcher] -R [file_name], while both of these commands are great, ...
KhodeNima's user avatar
  • 131
0 votes
1 answer
39 views

Using CTRL-W_f / gf on `file.name://`

A common action I perform in Vim is to do $ grep or $ git grep (in a vim :terminal), and then open the files discovered. This works great most of the time. However, I noticed that considering the ...
user22476690's user avatar
2 votes
3 answers
98 views

Edit (another) file in the same directory without changing cwd

It needs to support completion. An example use case would be: I'm on a given project (so a certain cwd) but need to update one of my Vim files. If they are already opened so navigate buffers or ...
eyal karni's user avatar
  • 1,096
1 vote
1 answer
961 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
-1 votes
3 answers
45 views

Delete comment operator(#) from beginning of selected lines [duplicate]

I want to remove # from line 79 to 91
Muhammed Iqbal P B's user avatar
2 votes
1 answer
254 views

check if file exists without opening it with gf

gf edits the file whose name is under the cursor. Sometimes I use gf to check if the file exist or not, by just going to the file and coming back. But if the file is large, then it takes time for ...
auditory's user avatar
  • 170
1 vote
2 answers
100 views

How can I quickly get to a set of commonly used files?

I tend to edit particular text files much more often than others. There might be 30 or 40 or so different files I tend to edit most often. Plus there are others that kind of rotate in and out as ...
Tyler Durden's user avatar
  • 2,091
0 votes
0 answers
348 views

Open file from vifm in split view

I use vifm in split mode - it always shows two vertically separated windows each with a directory listing. From there I can open files using the right arrow. However when I open a text file, vifm goes ...
mulllhausen's user avatar
3 votes
2 answers
99 views

Open file under cursor which name starts from slash but force search path to the current directory?

Consider the case of html file that has a form tag with action attribute and value of /login.php: action="/login.php" In which case login.php will be searched in the same directory as a ...
l00p's user avatar
  • 253
0 votes
1 answer
667 views

Select buffer from list of buffers filtered by a partial name match?

Let's say I entered a folder with many files and I opened them with vim *. I know that if I want to list all the files inside the buffer I can use the command :ls, and then I can navigate those files ...
raylight's user avatar
  • 525
4 votes
2 answers
329 views

Is it possible to close all files with content that matches a regular expression on Vim?

Let's say I have opened many files on Vim with vim file1 file2 file3... And their content is like the following: file1: random content random content stringThatMatchesRegex random content file2: ...
raylight's user avatar
  • 525
0 votes
1 answer
27 views

How can I watch a file that isn't currently open?

I want vim to notify me if the contents of a certain file path/to/file changes, but that file won't be open in the vim instance. How can I achieve this?
libby's user avatar
  • 111
1 vote
2 answers
759 views

Pipe file list to vim and browser them like a folder

Is it possible to pipe list of files e.g. from grep and have this file list opened in vim file manager in similar fashion like when you open a folder with vim? Note that I do not want to just write ...
msam's user avatar
  • 113
2 votes
0 answers
57 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
1 vote
0 answers
22 views

How can you isolate the date portion of each request of a IP adress? [closed]

How can you isolate the date portion of each request of a IP address if it's at the first line of each request from a log file using awk, creating a list of distinct dates, and then using grep to ...
vini's user avatar
  • 11
3 votes
1 answer
370 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
5 votes
2 answers
1k views

Write register 0 to file

I am trying to write register 0, into a file. One method that I have found is to use redir: redir! /tmp/3 echo 'hello' redir end which gives me error invalid argument /tmp/3 and I don't know how ...
john-jones's user avatar
6 votes
3 answers
1k 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
3 votes
1 answer
240 views

What is the opposite of set ff command?

I can set a file format to unix or windows by using: :set ff=unix Is there a way to check the file format ?
Pasan W.'s user avatar
  • 133
4 votes
2 answers
786 views

How to auto-complete filenames in sub-directories when opening them for editing using e.g. `:e </path/to/file>`?

How to autocomplete filenames in sub-directories when opening them for editing using e.g. :e </path/to/file>? When opening files in sub-directories for editing using e.g. :e </path/to/file&...
Shuzheng's user avatar
  • 1,215
3 votes
0 answers
97 views

gf with search pattern instead of line number

vim file +80 will open file in vim, with cursor at line 80 vim file +/if/ will open file in vim, with cursor at first line containing if. For vim file +80, inside vim, there is gF. The question: ...
qeatzy's user avatar
  • 960
2 votes
1 answer
172 views

What is the green <92> that's in my file?

I have a file exported from some system, and in vi when I open the file, there's a green <92> in it when I open it up where an ' ought to be. It messed up my bash script and left a line that ...
leeand00's user avatar
  • 3,491