Questions tagged [working-directory]

The tag has no usage guidance.

Filter by
Sorted by
Tagged with
1
vote
2answers
89 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. ...
1
vote
1answer
727 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 ...
2
votes
1answer
33 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 ...
3
votes
2answers
136 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 ...
1
vote
1answer
211 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' ...
1
vote
0answers
18 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 ...
4
votes
3answers
204 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 ...
0
votes
0answers
38 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 ...
3
votes
2answers
2k 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 ...
0
votes
1answer
333 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? ...
0
votes
2answers
313 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" ...
1
vote
1answer
983 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 ...
1
vote
1answer
586 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 ...
1
vote
1answer
204 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 ...
0
votes
2answers
5k 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 ...
1
vote
2answers
35 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 ...
9
votes
2answers
1k 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 ...
5
votes
2answers
551 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 (...
1
vote
2answers
200 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 ...
3
votes
1answer
554 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 ...
-4
votes
4answers
2k 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 ...
4
votes
1answer
1k 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?
1
vote
2answers
465 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) ...
7
votes
4answers
8k 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 ...
4
votes
3answers
1k 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:\...
6
votes
3answers
850 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 ...
8
votes
3answers
1k 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 ...