Questions tagged [working-directory]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
0 votes
0 answers
49 views

Wrong working directory after opening file

I currently have the problem that when I open a file, I always have a certain working directory. This is a problem, because Vim doesn't find tags files anymore. I have not set anything like this in ....
neolith's user avatar
  • 123
2 votes
1 answer
4k views

Set current working directory when opening vim

When opening neovim via nvim /path/to/directory I want the current working directory of vim to be set to the given path instead of the current path of my terminal. When opening a file instead it would ...
dehlen's user avatar
  • 123
2 votes
1 answer
218 views

How to make vim recognize variables from files in the current directory or sub directories?

I have recently been working on a web project and I would like my css files to recognize the classes and ids from the html files. Is there any way to make this work? Edit: So I use coc.nvim. By ...
Zawedcvg's user avatar
0 votes
2 answers
273 views

Is there a way to quickly navigate to previously visited directories

I quickly want to switch between directories I previously visited without typing :cd and then the full pathname again and again. Is there a plugin or a way that can keep an account of the directories ...
sussy_baka's user avatar
2 votes
1 answer
188 views

Why is current working directory in vim different from where vim was started?

vim is showing a different current working directory than the one I started vim with from the command-line. The problem goes away if I run without my .vimrc (vim -u NONE). How can I debug this to ...
Rob Bednark's user avatar
2 votes
0 answers
844 views

How to change the root directory of vim?

My vim is installed in D:\Vim\vim82, but somehow $VIM points to the directory D:\Vim\vim82\vim.exe\vim82. Therefore when I startup vim all the features that need to access folders in the root ...
Taoyota's user avatar
  • 21
0 votes
1 answer
2k views

VimWiki linking to files in other directories with special characters

With vimwiki we can create a link to another file, [[DelmeDirectory/delme.md|File]]. I have some directories which have the form Notes_0-0-0 and aren't recognized. i.e. pressing Enter with the cursor ...
algae's user avatar
  • 121
1 vote
1 answer
59 views

Is there a way to revert :lcd to the "global" path?

For most my projects I prefer my directory to be at a particular project root. However for some (mostly vimwiki) it's easier to have vim change the folder to the file location. This is easily done ...
bdecaf's user avatar
  • 279
1 vote
2 answers
199 views

switch current directory between a base directory and current file directory

Goal: To achieve filename/path completion relative to current file directory using file name completion CTRL-X CTRL-F. I open all my files contained in a base directory such that :pwd in some_file ...
Haslo Vardos's user avatar
1 vote
1 answer
198 views

Vundle keeps installing plugins to C:\Users\<user name> despite being told not to in .vimrc

I am using Vim on Windows. My installation directory is C:\Program Files\Vim\vim82. As I am trying to use Vundle, I installed it in .\plugin\Vundle.vim. Then, I added these to .vimrc: set ...
Yukai Qian's user avatar
3 votes
2 answers
5k views

How to use FZF to search directories and open new file in directory

Here's what I'd like to do, and I'm open to using any tool (not just fzf): I want to be able to open a new file quickly (with a horizontal split :sp) in a specific directory that I find using fzf. Say ...
Davis Owen's user avatar
4 votes
1 answer
9k 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
2 votes
1 answer
198 views

How to have getcwd() give path with ~ in place of home folder?

I have the following (simplified) statusline config in my vimrc: set laststatus=2 set statusline= set statusline+=%{getcwd()} When I'm somewhere in my home directory on macOS, my statusline looks ...
ruohola's user avatar
  • 626
4 votes
2 answers
1k views

How to handle multiple directories in vim?

I always have at least two directories in my projects: One with information about the projects: info.txt, log.txt One with code And every project has a name. How to group and jump efficiently ...
lalo's user avatar
  • 151
5 votes
1 answer
2k views

Exclude folder when searching files in working directory

I'm working in a react project and opened vim from the root folder. When I'm using :vimgrep /pattern/ ** I just can search everywhere, but I want to search everywhere except the 'node_modules' ...
ChrKahl's user avatar
  • 165
1 vote
0 answers
22 views

`:bro w` initially opens wrong directory in 8.1.1

I just upgraded Vim to 8.1.1, and the behavior of :bro w seems changed: it occasionally (!?) does not open the pwd for browsing. (I checked :pwd.) This in on Win 10. Does something other than the ...
Alan's user avatar
  • 111
0 votes
1 answer
591 views

How to tell command-t to ignore a specific directory

I have a very large number of files under a specific directory. If I start vim from the wrong place, command-t tries to index the whole thing, which results in vim hanging for a long time before ...
glS's user avatar
  • 3,699
7 votes
3 answers
725 views

How do you go back to your to global current directory after inheriting an lcd

I frequently have one root project open which I've :cd'd to. I also have other tabs with :lcd's set. This is great and works really nicely, but occasionally I end up looking at something in the main ...
JonnyRaa's user avatar
  • 1,131
1 vote
0 answers
80 views

Difference between 1 CTRL-G and :pwd, quotation marks?

The commands 1 CTRL-G and :pwd return related but different results: 1 CTRL-G "~/dev/src/tiff.c" 170 lines --15%-- :pwd /home/user/src Of course, CTRL-G returns the file, not the working ...
Tyler Durden's user avatar
  • 2,041
10 votes
3 answers
9k views

How to run internal vim terminal at current file's dir?

I edit file /home/me/projects/myproj/src/util.c And want to start terminal at /home/me/projects/myproj/src. Vim version > 8 so I can run :terminal but it always starts at folder in which I've opened ...
ephemerr's user avatar
  • 773
2 votes
2 answers
1k views

Working directory different than current file directory?

I saw something strange happen today. I was in directory /some/path/ and opened a file with vim file.html. I then did :pwd in vim and it gave me /some/other/path. What could cause this to happen? ...
pocpoc47's user avatar
0 votes
2 answers
574 views

chdir doesn't work

I'm in the browsing directory mode how can I change the current directory to that one I'm browsing? At least manually. But ":chdir ." doesn't work Moreover, in the config file I have "set autochdir" ...
Kolayn's user avatar
  • 123
1 vote
1 answer
4k views

VimScript - How do you get file/directory vim was called on from the command line?

I am writing a little hack for vim session that will save and load sessions more conveniently - I am aiming for more project-style sessions. When you are in directory my-proj and call vim, it should ...
Dylanthepiguy's user avatar
3 votes
1 answer
1k views

Do not change current directory

I want to have fixed current directory equals to the directory where vim was opened. Note I am using tabs and splits, so I want to have the same current directory in all tabs and splits. How can I do ...
Edvard's user avatar
  • 31
1 vote
1 answer
276 views

How can I set the working directory for only the job_start() process?

I would like to set the working directory for the process started with job_start(). The only way I know how to do this is to change Vim's current working directory before calling job_start(), and ...
still_dreaming_1's user avatar
7 votes
2 answers
14k views

opening another file with path relative to current directory

I want to open another file in the same directory or any file with its path relative to the current directory in command line. My path is /home/sibich/ /home/sibich> vim a.pl In vim, I want ...
SibiCoder's user avatar
  • 3,212
1 vote
2 answers
38 views

Highlight current line, but not for files inside certain dirs

I'd like to be able to highlight the current line the cursor is at, but not for files from certain directories. That's because I noticed the rendering becomes slow if I highlight the lines within a ...
orion3's user avatar
  • 111
11 votes
2 answers
3k views

Edit a directory inside Vim

Is it possible to edit a directory inside Vim? (Some commands are working for directories). I want to know what kind of operations can be done in a directory inside Vim. Vim can open the directories ...
SibiCoder's user avatar
  • 3,212
5 votes
2 answers
879 views

autochdir working with :sp but not :e?

I'm on Ubuntu 16.04 (x86_64) and vim 7.4. In my config file, I have: set autochdir And this was working for as long as I remember. Just after upgrading to Ubuntu 16.04, I see the following behavior (...
Shahbaz's user avatar
  • 549
1 vote
2 answers
330 views

After changing lcd get parent directory of original file

Is is possible to get the original working directory of vim after changing the local working directory? Let's say I open vim with parent directory: ~/projects/myproject and then I open a file and ...
Jon49's user avatar
  • 111
4 votes
1 answer
677 views

CtrlP should never index particular directories

My projects are in: /home/user/projectA /home/user/projectB However, at times I hit CtrlP and I haven't opened a file in a particular project, so my working directory is /home/user. CtrlP starts ...
user's user avatar
  • 143
-4 votes
4 answers
4k views

How to change the directory to save a file

Currently all I have to do is type vim file_name and it will make that file in the current directory (usually user because that is where the command line start at if you don't use the cd command). It ...
Jason Basanese's user avatar
7 votes
1 answer
5k views

change working directory to current opened file [duplicate]

Sometimes I use Command-T to browse files. When I find the file I needed, I would like to switch the current working directory to the opened file's directory. How can I do this?
jligeza's user avatar
  • 527
1 vote
2 answers
754 views

Execute current file outside of working directory

I know I can execute the current file, lets say a bash file, with :! bash %. But what can I do if I want to execute the current file in a different directory (such as the location of the current file) ...
DUWUDA's user avatar
  • 113
9 votes
5 answers
16k views

How to set up NERDTree to CD to current folder when opening it for the first time via :NERDTreeFind

Given: $ cd ~/Sites/project project $ vim :NERDTreeFind I would like to see NERDTree opening with ~/Sites/project as a root folder. Instead I see ~/Sites with project folder selected. So I have to ...
firedev's user avatar
  • 2,312
5 votes
3 answers
2k views

Can't change directory to network drive

Our company has recently changed to networked home directories. This includes setting enviroment variables. This has created the odd situation that gvim thinks my home directory is : :echo $HOME H:\...
Chester the Rooster's user avatar
6 votes
3 answers
1k views

Switching to the local directory after loading a file?

When running gvim by double clicking with a file in a graphical file manager, like nautilus, the vim instance is called with a strange current directory (seems root sometime, but I am not sure). This ...
Rmano's user avatar
  • 748
8 votes
3 answers
2k views

Make :edit {file} use current directory during :Explore

I often use :Ex or :Sex to explore the filesystem from an opened file directory, or just invoke vim passing a directory to start exploring the filesystem and then opening a file. In any case, while ...
guido's user avatar
  • 1,737