Skip to main content

Questions tagged [path]

Questions about the usage of the Vim's path variable. this variable lists the directories which will be searched with commands like `gf`, [f, ]f, ^Wf, `:find`, `:sfind`, `:tabfind`

Filter by
Sorted by
Tagged with
22 votes
3 answers
8k views

How to return to netrw from a file

Suppose that I'm editing a file, then I press :w to store it. And then I use :e. to navigate its containing folder in the netrw. Suppose its containing folder is ./A/B/. In netrw, I open a file with ...
user3813057's user avatar
  • 1,481
17 votes
1 answer
5k views

Ignore folders when performing :find command

I'm using the :find command as my "fuzzy file searcher" in Vim. My setup: set path=,,** nnoremap <leader>f :find * However, I'm having trouble ignoring folders. Huge folders that contain ...
Niko Bellic's user avatar
  • 1,824
14 votes
3 answers
2k views

Efficient way to find & open files deep in a project tree?

Without plugins like ctrlp and NERDTree, what would be the most efficient way to find and open files deep in a project tree? Setting the path to **/* results in useless files in .git and other ...
user avatar
12 votes
2 answers
4k views

Is Vim's default 'path' option redundant?

From Vim's help document (see: :help 'path'): 'path' String(default on Unix: ".,/usr/include,,") -To search relative to the directory of the current file, use: :set path=. -To search in ...
Feng Yu's user avatar
  • 659
6 votes
1 answer
6k views

Set path to location of tags file

I think this is not quite a duplicate, although it's close. I often work with multiple, slightly different, checkouts of the same multi-directory project. I'd like to be able to jump around using ...
AGML's user avatar
  • 163
5 votes
2 answers
2k views

Quickfix with makeprg running in a different directory

How can I start a build with my makeprg running in a different directory than the working directory of vim and still catch errors in quickfix so that I can jump between them? The problem is that ...
Praxeolitic's user avatar
  • 2,478
5 votes
3 answers
2k views

Vim sometimes displays full path of file instead of just the filename?

This may seem a little nit-picky, but I like using the wildmenu to switch between buffers: I do :b and then hit tab until I get to the file I want. The problem is that sometimes, vim shows the entire ...
Fake Jake's user avatar
  • 151
5 votes
1 answer
283 views

Prevent ^X^F from expanding $HOME

For example, I want to write $HOME/.vim/ and complete the path with i_CTRL-X_CTRL-F so that it becomes: $HOME/.vim/syntax/ But what I get is: /home/username/.vim/syntax/ One workaround I've ...
Nathaniel M. Beaver's user avatar
4 votes
1 answer
915 views

Current VimL script path from inside a function

How do I get the path to the currently executing VimL script from inside a function? I know from outside a function, you can use expand('<sfile>'), but if you call that inside a function, you ...
still_dreaming_1's user avatar
4 votes
2 answers
1k views

How do I get "~" (tilde) to expand when using File Name Completion in Insert Mode?

I often complete file paths in Vim using Ctrl-x Ctrl-f in insert mode, but there is one annoyance: the tilde character does not expand. This is fine for things like bash, but for Python (which does ...
Alex's user avatar
  • 1,323
4 votes
1 answer
2k views

directory path search for :read

When I use :read <filename> in Vim, does it only look in the current working directory? Is there a way to set up vim to have the :read read reference multiple directories when attempting to ...
BentChainRing's user avatar
3 votes
1 answer
689 views

Unable to find files after setting path in vim

I open vim with vim -u NONE <filename>, so this ensures that the error is not due to vimrc or plugins. I use checkpath! to dump all files which are present in the path. :set path? path=.,/usr/...
subtleseeker's user avatar
3 votes
2 answers
2k views

path seperator in vim

I have a vim script, which uses Unix type path separator as: "Prg: Expand snippets {{{! let s:plugin_dir=filter(split(&rtp, ','), 'v:val =~ "/vimf90"')[0] let s:templatedir=s:plugin_dir . '/...
BaRud's user avatar
  • 491
3 votes
1 answer
363 views

How to show the path to the current opened file?

If I open a file in vi like: vi /etc/httpd/conf/httpd.conf Then vi shows in the bottom left corner of the window: "/etc/httpd/conf/httpd.conf" 1009L, 34418C But when I edit the file with a or i ...
Andie2302's user avatar
  • 141
3 votes
2 answers
104 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
  • 263
3 votes
1 answer
118 views

file search with :e

When open a file with :e, it have to be tell the exact path of the file, and even the temporary file will be listed, is there anyway to do Open a file with only name, and let it automatically search ...
fluter's user avatar
  • 133
3 votes
1 answer
660 views

How do I get vim to read syntax files from `/usr/share/vim/addons/syntax`?

According to the Debian documentation about vim, a Debian package (Ubuntu, really, in my case) is expected to place <name>.vim files under: /usr/share/vim/addons/... Syntax files go under a sub-...
Alexis Wilke's user avatar
3 votes
0 answers
143 views

How to keep lcd from affecting other windows?

I usually have one tab containing the code I am working on, and another containing vimwiki. I mostly use neovim. For the code I prefer the working directory sticking to the project root. For vimwiki ...
bdecaf's user avatar
  • 279
2 votes
2 answers
12k views

Access a file under subdirectories of a path through gf command

I am using perl. When I press gf while having the cursor on Testcase, it shows E447: Can't find file "Testcase.pm" in path. So I added that path. It works for files under particular path which ...
SibiCoder's user avatar
  • 3,422
2 votes
2 answers
2k views

shortcut of the current directory path when vsplit/split

I very often need to open files through vsplit/split. Very often I want to open files in the same directory. Still, I must pass their paths to vsplit/split. :vsplit @/siblingfile.txt @ is an alias ...
smarber's user avatar
  • 221
2 votes
1 answer
2k views

How to set the vim path to your bash PATH?

I'd like my $PATH to be available to vim when running commands with !. How do I set vim's set path= to my environment variable $PATH?
leeand00's user avatar
  • 3,601
2 votes
1 answer
947 views

vim cannot access variable in autocmd

I am trying to configure prettier-eslint and prettier-standard as the js formatter with neoformat: " neoformat should try formatprg where available let g:neoformat_try_formatprg = 1 augroup vimrc " ...
vamsiampolu's user avatar
2 votes
1 answer
151 views

Using :Rename from vim-eunuch with the current file name

The vim-eunuch plugin has a handy function :Rename which renames the current file without needing to pay attention to paths. This also means that if there ARE paths in the argument you are passing to ...
fbence's user avatar
  • 677
2 votes
1 answer
142 views

How do I configure the path to match Python's site-package location?

I can get the site package location here: https://stackoverflow.com/questions/122327/how-do-i-find-the-location-of-my-python-site-packages-directory Has anyone written a script that copies the ...
Neil G's user avatar
  • 193
2 votes
1 answer
463 views

Automatically update import path if file is moved in Vim

Is there a way in which if you move file A to another location and there are other files that have imported file A, the import path will change accordingly in Vim? PyCharm has this and I was ...
AlphaFoxtrot's user avatar
2 votes
0 answers
131 views

Why is filetype not set after :find from autocmd?

Objective I want vi file to act like :find file if file doesn't exist. That is, I want to be able to edit a file by name, without giving a path to the file, from the command line: mkdir -p a/b/c ...
aghast's user avatar
  • 239
2 votes
0 answers
281 views

syntastic not working on macvim, but works perfectly fine on the terminal

I have an issue where in MacVim, I don't get any syntastic/eslint related functionality. When I run !which eslint in macvim, I get "eslint not found" - eslint is definitely installed. If I run !...
filype's user avatar
  • 283
2 votes
0 answers
133 views

The $path used by ":!start cmd" is different from my system $path in windows

So I do a lot of python work in GVim on Windows 7, and I'm running into an annoying roadblock. This might be more of a Windows question, but it's happening in Vim, so ... I have this in my python.vim ...
Tyler Fox's user avatar
1 vote
3 answers
282 views

How can I set path of vim from the shell command result

I'd like to set c++ header file path automatically from .vimrc. So I tried to write .vimrc file as shown below: let g:gcpp_headers_path=system("g++ --version | grep g++ | awk '{print \"/usr/...
Jumogehn's user avatar
  • 165
1 vote
1 answer
2k views

Enabling rubocop linter the right way

I've got a vim VIM - Vi IMproved 8.2 (2019 Dec 12, compiled Sep 17 2020 21:54:53) on ManjaroLinux (Arch + kde) and I'm using rvm to run my rubies. The ruby I am using now is: => ruby-2.7.2 [ ...
kaczor1984's user avatar
1 vote
2 answers
548 views

User command with modified 'path' completion?

I'm trying to write a wrapper command around :edit or :find specifically to open either my vimrc or a subpath of ~/.vim/ (e.g. ~.vim/autoloads/foo.vim). If I run the command with no arguments, it ...
ivan's user avatar
  • 1,470
1 vote
1 answer
67 views

Is it possible to define the pwd for an external command runs in without changing VIM's pwd?

Im experiencing some problems running a command that reports paths based on the $PWD. To correctly parse its output I need it to run from a different directory, however, I would rather not have to cd ...
ideasman42's user avatar
  • 3,753
1 vote
2 answers
175 views

Detect Editing of Directory

How do you detect if a directory is opened(with :edit) in Vimscript? I am lazy loading a file explorer and need it to load it before I open a directory. One approach I tried using an autocommand that ...
unrealapex's user avatar
1 vote
1 answer
44 views

Getting the path with a function key

I need to get the path and file name out of the open file. Wrinkle .. The file is FTP'd to my Desktop and I need the Linux path. I found this on the web that prints the path file name noremap <...
Christopher Collins's user avatar
1 vote
1 answer
127 views

Simple way to go to definitions

I use this simple approach to jump to definitions in C++, which works fine for me. In my vimrc: autocmd BufRead,BufNewFile *.c,*.cpp,*.cc set path+=/Library/Developer/CommandLineTools/usr/include/c++/...
ranemirusG's user avatar
1 vote
1 answer
110 views

Conflict between autocompletion (via ctags) and the `find` command?

I am using Vim 8.2 on Windows 10. Autocompletion (using CTRL+N or CTRL+P) upon creating the tags file using ctags.exe works fine for me. Now I want to use the find command in vim to quickly opening ...
Jorge D's user avatar
  • 41
1 vote
1 answer
604 views

Vim's "path" variable isn't changing or updating with modeline setting (finding header file in different directory)

I'm trying to do something relatively simple: Editing a file in src and pointing Vim to the header file located in include. My .vimrc file has set modeline on, and the first line in my file is: // vim:...
AmagicalFishy's user avatar
1 vote
0 answers
39 views

Open file with path over 260 signs length in WIndows

Is there any way to open file with Gvim under Windows 10 from path over 260 signs length with out mapping the path to network drive?
gradzikb's user avatar
1 vote
0 answers
184 views

How to autocomplete path using alias root?

I'm working on frontend project, we're using root alias, like: import from '~/src/components/button'; instead of: import from '../../../../../components/button'; But when I try to import from ~/, my ...
Lai32290's user avatar
  • 275
1 vote
0 answers
36 views

Ins-completion C-X C-F and the path variable [duplicate]

Can the insert-completion of file names CTRL+XCTRL+F can be used to complete filenames that are not in the current working directory ? But rather in any in the path variable ? Can we, for example, ...
perelo's user avatar
  • 471
0 votes
1 answer
408 views

how to deduplicate packpath / runtimepath?

Problem: I noticed that my "&packpath" has some duplicates, I want to remove them. What I have tried: My viml knowledge is not very strong but I did manage to create a unique "List&...
5c0tt's user avatar
  • 23
0 votes
1 answer
647 views

How to compile vim for user only and use git to track it?

How can I compile vim for my user only so set source path to /home/user/ ? And how can I track changes with git. Basically I want to build and compile vim from source, and store it on my github repo....
An0n's user avatar
  • 129
0 votes
1 answer
293 views

Adding directory (header and source) to autocompletition search

I use Ctrl+P and Ctrl-N for autocompletition, and since I have library sources in another directory, like /opt/ST/STM32F4xx_DSP_StdPeriph_Lib_V1.8.0/Libraries/STM32F4xx_StdPeriph_Driver/inc /opt/ST/...
xyx's user avatar
  • 464
0 votes
1 answer
206 views

How to use variables in a user defined command? [duplicate]

I have this user defined command: command! PS silent! w | PlugSnapshot! ~/.vim/plugins/plugins.lock How could I change it to take the filepath from a variable, something like this: let ...
ruohola's user avatar
  • 666
0 votes
1 answer
447 views

Error occurs while echoing system('echo %PATH%')

I'm currently using gvim 8.0 on Windows 10. When I try to do the following command, :echo system('echo %PATH%') I get the following error. E484: Can't open file C:/Users/BITS_A~1/AppData/Local/Temp/...
bits_and_scraps's user avatar
0 votes
1 answer
118 views

Neovim nvim-cmp don't work autocompletion for path?

Plugins for cmp use("hrsh7th/nvim-cmp") -- completion plugin use("hrsh7th/cmp-buffer") -- source for text in buffer use("hrsh7th/cmp-path") -- source for file ...
serii 's user avatar
  • 91
0 votes
1 answer
22 views

How to remove paths starting with a certain pattern from a list of paths?

Say that I have the following list: vim9script g:my_paths = ['C:\Users\myname\Miniconda3\envs\myenv', 'C:\Users\myname\Miniconda3\envs\myenv\python310.zip', 'C\Mypath', 'C\Anotherpath', 'C:\Users\...
Barzi2001's user avatar
  • 630
0 votes
1 answer
2k views

Setting path in init.lua

One of my packages needs me to set up the PATH and one variable. In my vimscript code I had: let $PATH.=':/usr/lib64/openjdk-11/bin/' let $MYVIMRC='/home/luis/.config/nvim/init.vim' But I can't ...
lf_araujo's user avatar
  • 113
0 votes
1 answer
649 views

How do I add spaces to a file path in vimrc?

I am trying to set the shell to git bash in my vimrc. I have this: The code says: set shell=C:\Program Files\Git\git-bash.exe But because there's a whitespace in Program Files, it acts as a separate ...
GoodBoyNeon's user avatar
0 votes
1 answer
1k views

How to split a string that is a full path, into its directories?

Say I have a string for the full path of a directory let myPath = '/go/src/github.com/MyDomain/MyProject' I would like to have an array like ['go', 'src', 'github.com', 'MyDomain', 'MyProject'] ...
Hakan Baba's user avatar