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
1 vote
3 answers
76 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/...
user avatar
  • 121
1 vote
1 answer
100 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-...
user avatar
1 vote
1 answer
38 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 ...
user avatar
  • 31
1 vote
0 answers
30 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?
user avatar
0 votes
1 answer
188 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&...
user avatar
  • 23
3 votes
2 answers
49 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 ...
user avatar
  • 241
0 votes
1 answer
843 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 [ ...
user avatar
0 votes
0 answers
75 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 ...
user avatar
  • 173
3 votes
1 answer
302 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/...
user avatar
0 votes
1 answer
73 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'] ...
user avatar
0 votes
1 answer
107 views

Includeexpr + substitute not behaving as I would expect

I am using includeexpr and substitute() in a ftplugin to remove a portion of an include string for gf functionality (in twig template files, for the curious), but I get an error instead. Twig ...
user avatar
1 vote
1 answer
229 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:...
user avatar
3 votes
0 answers
114 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 ...
user avatar
  • 259
1 vote
0 answers
35 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, ...
user avatar
  • 411
2 votes
1 answer
89 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 ...
user avatar
  • 175
3 votes
1 answer
50 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 ...
user avatar
  • 133
0 votes
1 answer
112 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/...
user avatar
  • 354
0 votes
1 answer
179 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 ...
user avatar
  • 566
0 votes
1 answer
180 views

Expanding variables in path

Background I work a lot in the twig template language, and make use of path variables. For example, an include might look like {% include "@my_path_var/my_folder/my-template.twig" %} The @...
user avatar
0 votes
1 answer
419 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....
user avatar
  • 129
1 vote
1 answer
280 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 ...
user avatar
0 votes
1 answer
402 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/...
user avatar
1 vote
2 answers
1k 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 ...
user avatar
  • 191
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?
user avatar
  • 3,091
1 vote
2 answers
454 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 ...
user avatar
  • 1,180
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 . '/...
user avatar
  • 387
1 vote
0 answers
100 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 ...
user avatar
  • 197
1 vote
1 answer
43 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 <...
user avatar
2 votes
1 answer
846 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 " ...
user avatar
15 votes
1 answer
4k 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 ...
user avatar
  • 1,554
4 votes
2 answers
970 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 ...
user avatar
  • 141
2 votes
0 answers
263 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 !...
user avatar
  • 283
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 ...
user avatar
  • 3,413
4 votes
1 answer
1k 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 ...
user avatar
2 votes
0 answers
131 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 ...
user avatar
1 vote
2 answers
10k 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 ...
user avatar
  • 3,012
4 votes
1 answer
776 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 ...
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 ...
user avatar
  • 1,144
12 votes
2 answers
3k 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 ...
user avatar
  • 659
5 votes
1 answer
228 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 ...
user avatar
13 votes
3 answers
4k 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 ...
user avatar
  • 1,311
3 votes
1 answer
202 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 ...
user avatar
  • 141
6 votes
1 answer
5k 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 ...
user avatar
  • 163
13 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
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 ...
user avatar
  • 2,278