Skip to main content
New
Stack Overflow Jobs powered by Indeed: A job site that puts thousands of tech jobs at your fingertips (U.S. only). Search jobs

Questions tagged [filesystem]

For questions regarding searching and navigating the filesystem.

Filter by
Sorted by
Tagged with
0 votes
1 answer
34 views

Saving Vim files to certain pathways

My question is regarding how to save files to certain folders, or locations For example I want to save a file called c++ learning to a folder on my desktop called c++ So after typing :w what do I ...
nevann copeland's user avatar
1 vote
1 answer
352 views

Vim file explorer - jump to file by letter

In windows file explorer, if you hit a letter like R, you get to a file/folder beginning with R. Especially in directories with many files this is super convenient. Does one of the Vim file explorers ...
weberjn's user avatar
  • 111
3 votes
0 answers
1k views

What is the file structure of Neovim?

It seems like Neovim has files in many places. The binary is in /usr/bin/nvim. Inside ~/.config/nvim is init.vim, for declaring plugins, and also directories in ~/.config for storing Neovim plugins, ...
Julius Hamilton's user avatar
0 votes
1 answer
67 views

mkview file code meaning

I use :mkview %.vimview to create a view file under current directory, and in the file created there is a line of code like this: if bufexists(fnamemodify("~/PycharmProjects/rl/report/...
Yuanhao JIANG's user avatar
1 vote
3 answers
1k views

Netrw-R Renaming multiple Files with vim

After going through the renaming guides from the doc folder in vim I found a way to replace text with the input :%s/frompattern/topattern/g. Reaching the renaming files with the file browser tutorial/...
ThunderDream's user avatar
1 vote
1 answer
127 views

How to expand <cfile> if it has an @ in the path?

I'm using arch linux and nvim. Everything is up to date. I have a dir path /home/user/name@web_address.com/144_p/data-dir-2/data_structure_here gf does not open the dir structure becasue @ is present. ...
Kes's user avatar
  • 663
-1 votes
1 answer
108 views

vimrc, like exec but replaces current process (fork?)

Such as in the following code: let cpath = getcwd() let cfile = expand('%') function Run_file_hopper(cpath, cfile) silent exec "! . ~/path/somescript.sh" a:cpath a:cfile ...
john-jones's user avatar
3 votes
0 answers
234 views

While copying a file in netrw, why should I be in the directory where the file is located?

In netrw, I want to copy a file /dir/subdir1/file.txt to /dir/subdir2. For that, I do the following: I mark the file /dir/subdir1/file.txt I navigate up directory and mark /dir/subdir2/ as target ...
E. Anikin's user avatar
  • 131
7 votes
2 answers
1k views

Convert absolute path to one relative to another absolute one

Context I’m working on an 'omnifunc' function for Markdown editing. It’s supposed to help me link to other Markdown files while I’m typing a link – based on file content though, not file name. Suppose ...
scy won't contribute anymore's user avatar
0 votes
1 answer
112 views

Is there a way to prevent Neovim from editing another file?

When I'm using Neovim in conjunction to firenvim to edit a text box in the browser, I typically have the need to open another file. I'd like to disable Neovim's ability to read from and write to other ...
ChocolateOverflow's user avatar
3 votes
3 answers
2k views

How to `cd` / explore the directory containing the current file?

Sometimes I gf to a file in a totally different directory and want to check out that new directory. Is there a way to quickly exit vim and cd into the directory containing the current buffer?
ChocolateOverflow's user avatar
1 vote
2 answers
238 views

Allowing file bookmarks

I work with vim netranger for file management. The version I use doesn't have a bookmark feature for files. That means to be able to quickly navigate to a common files by a defined keyboard shortcut. ...
eyal karni's user avatar
  • 1,136
4 votes
0 answers
537 views

vimscript - copy a file from one path to another

How do I rewrite this line of code call system("cp /tmp/foo.txt /tmp/bar.txt") into a vim command which is more portable and OS-independent? I've been looking around but checking for "...
ColinKennedy's user avatar
2 votes
0 answers
61 views

Closing the file handle while keeping buffer open

I have a workflow where I edit a .org file using jceb/vim-orgmode which is located in my iCloud directory. I then have an app on my phone which also syncs and uses the same .org file. The problem is ...
Gérard Depardieu's user avatar
0 votes
1 answer
3k views

how to use variables in vimscript shell commands

I have this code intended to: read current line extract variable from end of line, looking for text like #ad04e482 search for filename that begins with the string ad04e482 open that file to edit in ...
alec's user avatar
  • 805
3 votes
1 answer
673 views

Vim undofile does not work when file is too long

I use a vim persistent undo setup as follows, which have worked all that way here. set undofile set undodir=~/.vim/undodir However now I'm facing a problem when the undofile became too long, notice ...
intmarinoreturn0's user avatar
0 votes
1 answer
77 views

Put a tab autocompleted path into current buffer

I use autocompletion a lot, especially for long path names: e.g. $ /home/au/Doc<tab> <tab>uments/A<tab> <tab>\ file\ with\ a\ very\ long\ name This can be performed within ...
moo's user avatar
  • 155
0 votes
1 answer
32 views

How can I modify OpenMultipleTabs so that I can open buffers for new files?

When searching for a command to enable me to open multiple tabs in normal mode, I found a custom command to do this: " Open multiple tabs at once fun! OpenMultipleTabs(pattern_list) for p in a:...
bitmask's user avatar
  • 143
3 votes
0 answers
339 views

Netrw problem - 'mt' open new tab instead of marking as target folder

I was playing with netrw and was amazed by the possibility. I'd like to mark some files with 'mf' and move it to a folder using 'mt'. However, when I press 't', vim seems to interprets it as "open a ...
raoul59's user avatar
  • 31
2 votes
2 answers
3k views

Creating and destroying temporary files by vim

I integrated luacheck in vim with the following simple function: function! LuaCheck() let errors=system("luacheck " . expand("%")) cexpr errors cwindow 5 endfunction autocmd FileType lua ...
user20084's user avatar
  • 179
3 votes
3 answers
1k views

Easily add/open a file in the same folder as the current file/buffer

I feel my current VIM setup is pretty sweet, but there is one thing that annoys me time and time again: how can I open a file or add a file to the same directory as the current file I am editing? If ...
oligofren's user avatar
  • 1,103
4 votes
1 answer
10k views

How to do :Sex but with a vertical split?

When viewing a file /tmp/vim_split_demo/test.txt, the parent directory can be opened in a horizontal split screen using the command :Sex, as shown in these screenshots: What command gives same ...
user1717828's user avatar
1 vote
1 answer
279 views

How to show only a specific file format in ctrlp results?

I am fairly new to Vim. I keep my notes in .md files and would like to access them with CtrlP from several different directories. I would like to set a specific filter on them, because now loading all ...
nocibambi's user avatar
  • 133
4 votes
1 answer
3k views

Find project root relative to the active buffer

I can use the finddir function to find a parent folder that contains a .git folder (project root), like this: let dir = finddir('.git/..', ';') However, this only finds project roots that are parent ...
Foobar's user avatar
  • 273
2 votes
1 answer
447 views

How to find a executable file inside a folder?

I have the path of a folder in a variable, and for a custom debugging script I am making, i need to find an executable file inside that folder (the executable find is guaranteed to exist, but not to ...
Pedro Palacios's user avatar
1 vote
0 answers
26 views

Different versions of vimrc being read [duplicate]

I have an absurd problem. Honestly, I have a hard time figuring out whether this belongs here or a Windows forum. Using Vim on Win10, I've changed my C:\Program Files (x86)\Vim\_vimrc from the awful ...
Gustaphe's user avatar
  • 111
3 votes
1 answer
68 views

Ask if file extension is missing when opening new file

I use auto completion in my shell (zsh) and I'm often a bit sloppy. Scenario: Imagine I have the files sourcecode.c and sourcecode.h in the current directory. I type vim sour<TAB><ENTER> ...
Jounathaen's user avatar
3 votes
0 answers
705 views

How to escape paths for findfile() and finddir()?

I have run into an escaping problem with the path argument to findfile({name}, {path}) / finddir({name}, {path}). In my code path is a directory, obtained via fnamemodify(<file>, ':h'). Until ...
Andy Stewart's user avatar
  • 1,359
2 votes
0 answers
69 views

How long can a file be non-existent when I'm saving it in vim

When I'm using vim to edit files in a django application that is running in developer mode I sometimes encounter this crash coming from the auto-reload utility: File "/home/zefciu/.virtualenvs/15five/...
zefciu's user avatar
  • 121
1 vote
1 answer
278 views

Saving .swp/.un~ files to subdirectories

Is there any way to save these files to automatically created subdirs? Google gave me no answers. The reason is simple- I work on several computers which I keep synced via git, so having these files ...
Dude For realsies's user avatar
1 vote
1 answer
1k views

How can I pass extra flags to FZF/ripgrep commands with the leader key?

Current functionality When I use <C-P> and <C-Å> I can respectively search file names and contents. Everything works great. Target functionality When prepending either with <leader>, ...
b00t's user avatar
  • 119
5 votes
1 answer
3k views

How to write a value or variable into a file using only vimscript?

This question is very basic, but somehow absurdly difficult to find an answer for, because everything you find explains how to save the buffer, and I'm not interested in making new buffers or saving ...
Steven Lu's user avatar
  • 2,271
3 votes
2 answers
1k views

How to setup vim for working in a very large directory?

I am trying to setup my development environment using vim and some plugins. My workspace root is a directory with very large number of sub-directories and files. I am going to be working on files ...
Punit Soni's user avatar
1 vote
2 answers
118 views

How to print the filename with parent directory in insert mode?

I know that I can print whole path by Ctrlr = expand('%:p') in insert mode. I can also print head/tail with expand('%:h'), expand('%:t'). I want to print the filename with it's parent directory. ...
desertSniper87's user avatar
1 vote
2 answers
403 views

How to enable disabled movement keys in netrw?

Recently I started using and learning Vim. I turned off movement keys in my .vimrc file like this: noremap <Up> <NOP> noremap <Down> <NOP> noremap <Left> <NOP> ...
Igor R.'s user avatar
  • 113
3 votes
1 answer
8k views

What is the correct way to escape UNC paths?

Let's say there is a file \\server-42\tmp\dir\test.txt. When my plugin tries to execute this command via system() it triggers an error: cd "\\server-42\tmp\dir" && git ls-files --error-...
Andy Stewart's user avatar
  • 1,359
2 votes
0 answers
78 views

Alter how oldfiles are displayed

Is it possible to "preprocess" the oldfiles list so that it's easier to navigate visually? As far as I can tell, the contents of the oldfiles list are presented as ordinary absolute paths, but with ...
Greg Nisbet's user avatar
  • 1,849
3 votes
1 answer
687 views

How to refresh the oldfiles list without restarting Vim?

:browse oldfiles<cr> is useful for quickly navigating to a file I've worked on recently. Sometimes though, I want to suspend vim and do some grep or ack search and find a new file that I'm ...
Greg Nisbet's user avatar
  • 1,849
2 votes
2 answers
284 views

Is there a quick way to open a file anywhere within a directory hierarchy?

I am working with a new old code base where virtually all the interesting source files are three levels deep in the directory hierarchy. It's about 1.3M lines of code in more than 2000 .cpp files. The ...
Greg Hewgill's user avatar
1 vote
1 answer
703 views

Checking if Makefile exists before executing autocmd

I want Vim to execute build the project automatically after I write the buffer to a *.c or *.cpp file. Here is what I've done: autocmd BufWritePost *.c,*.cpp make This one works as expected (but the ...
nalzok's user avatar
  • 195
1 vote
1 answer
661 views

Opening recent files issue

TLDR: How can I open a file from the list of recent files without going to the end of the list to get to the prompt for file number? In order to open recent files, I do :bro ol and then when I see ...
Ali's user avatar
  • 177
7 votes
4 answers
1k views

What workflow to use when editing large multifile projects

Lately I've been shifting more nad more of my work from IntelliJ to vim. With a handful of plugins and setting tweaks, I don't miss the IDE much. One thing I do miss is the ease of navigating a large ...
Jones's user avatar
  • 171
2 votes
1 answer
307 views

Multiple buffers of the same file

I ran into a problem when using the quickfix feature of vim. When I open up my source file in vim, a buffer of that file is created, and its name is shown on the status bar, let's say main.cpp. Then ...
ForeignDevil's user avatar
3 votes
1 answer
136 views

How do I open the last n files I was working on in vim?

I know that the :oldfiles command will show you a history of the files you last had open; but how do I open the last n files in one command...for instance, say I want to open files 0-n in the :...
leeand00's user avatar
  • 3,589
3 votes
1 answer
316 views

gf: can I get next file that matches?

I use gf to open "filename.h" from line like: #include "filename.h" in some C\C++ file. Sometimes there is more than one "filename.h" that gf command can find in path. But gf gets me to the first ...
Neaţu Ovidiu Gabriel's user avatar
2 votes
1 answer
723 views

Is it possible to clone a directory with netrw?

When I mark a directory with mf, then use mc to copy into the target directory, it copies the contents only rather than the directory itself. I know I could make a new directory with d, then copy the ...
Jason's user avatar
  • 21
14 votes
2 answers
953 views

Can I search through 'oldfiles' with a specific name or extension?

I use the oldfiles and browse oldfiles commands all the time. I find them extremely useful, because it's easier to hit my leader mapping, scan through the files really quickly, and hit q<number>...
DJMcMayhem's user avatar
  • 17.6k
4 votes
1 answer
4k views

Is there an elegant way to determine if a file exists in/under runtimepath?

I wonder if there is an elegant way to determine if a specific file exists in/under one of the entries of &rtp. Currently, I use the following construct: let s:found_ = 0 for s:dir_ in split(&...
René Nyffenegger's user avatar
2 votes
1 answer
321 views

Can I iterate through files with a certain extension from the vim command line?

Pretty frequently while I'm using vim, I'll run into something like this. I want to edit a specific .txt file, that is under ~/Documents/myProj, but I don't remember the name of the file. So I will do ...
DJMcMayhem's user avatar
  • 17.6k
3 votes
1 answer
1k views

How can I get vim to include suffixes in <cfile>?

In part of a plugin I'm slowly building, I use <cfile> to get the file pointed by the word under the cursor and then do something if it points to a directory, or open the file pointed to ...
Dalker's user avatar
  • 455