Nvim/NERDTree creates file instead of directory - neovim

I'm using NerdTree in Neovim. To create a folder, in menu I select the
(a)dd a childnode
option but despite adding a "/" at the end of the foldername a file is being created.

You should not add a "/" at the end of the foldername, rather at the start.

Related

Dired create or rename a file to a filename that is a substring of an existing file

In Dired imagine you have the following directory.
| - src
| - | - text_input.rs
How do you create a file in the src directory named text.rs (in emacs)? How would you rename a file in the same directory to text.rs?
If you try to create a file through 'find file' or rename a file colocated with text_input you can have an issue.
If the file you are trying to create is text.rs, the '.' will be interpreted as a regex "any character" selector. You will not be able to create as find will resolve to text_input. Rename similarly fails, however I don't understand why.
If this is unanswered and you find yourself here I have a gnarly hack. Rename text_input.rs to a placeholder name, rename or create text.rs, then return the name to the text_input.rs.
Edit: Its been brought to my attention this isn't because of vanilla emacs, but because of the combination of tools bundled within doom emacs. Given this I am moving to escalate this within proper channels.

find the path of a file in matlab

Hello I would like to locate the file 'my_file.mat' that should be somewhere inside the folder 'C:\...\mypath\folder1'.
the folder folder1 contains several subfolders and the file my_file could be in any of these subfolders.
I would like to retrieve its full path.
You want to use the which function.
mypath = which('my_file.mat')
As commented below, this assumes that your 'folder1' has been added to your search path. To add (and remove if no longer needed) 'folder1' to your search path:
my_folder_path = 'path/to/folder1'
addpath(genpath(my_folder_path))
mypath = which('my_file.mat')
rmpath(my_folder_path)
I think you are looking for genpath and which combo:
addpath(genpath(folderName));
which test.txt -all
>>
Z:\home\**\Documents\MATLAB\R2010b\bin\test.txt

AHK code to locate the residing folder and highlight the active file

It’s often requires to quick locate the folder location of open active file and highlight or select the active file while working on different software applications. Quick locating the residing folder needed for finding related files in same folder, rename of the opened files or residing folder or move the file to different related folder. Current options require navigating through the loads of folders to find and locate the specific folder where it’s buried with bunch of similar other files (similar to find needle in a haystack). Microsoft Office suite has built-in feature named “document location” which can be added to quick access toolbar. But it only allow to see the folder location or full path but no single click command or key available (AFAIK) to conveniently jump to that locating folder and highlight/identified the opened file so that further operation (e.g. rename, move) could be done on that specific file/folder. This is also the case for other software applications where native program have options to get full path but no way to jump to the specific file/folder. Considering one of Microsoft Office suites application (e.g. word) as test cases the processes I could imagine as follows;
1 Get the full path (D:\Folder\Subfolder\Mywordfile.docx) of currently opened word document
2 Close the file
3 Explorer command to select and highlight the file in folder given full path (process 1)
Operation on file/folder as desire manually and double click to return to file operating applications (e.g. word).
In my assessment for Implementation of above tasks following are possibilities
Task 1 Microsoft Word has a built-in function called "document location" to get the full path of the opened document and its currently possible to copy the file path in the clipboard.
Task 2 Close the file (Ctrl+W or Ctrl+F4)
Task 3 AHK code for Explorer command to select the file for a given full path (available in Task 1)
I am facing difficulties in Task 3 and I tried each of these but so far no luck
Clipboard := “fullpath” ; Full path (D:\Folder\Subfolder\Mywordfile.docx ) copied from Word
Run explorer /e, “Clipboard”
Run %COMSPEC% /c explorer.exe /select`, "%clipboard%"
So far above explorer command only take me to my documents folder not in the specific folder location (path in Task 1). I am curious know what would be the right explorer code to select the file for a given full path in clipboard. Appreciate for supporting AHK code or better way to do this task. Thank in advance.
I'm not clear on why your sample code doesn't work. I suspect it's because of the extra characters.
After running this command Windows Explorer will be open and have the desired file selected (if it exists).
FullPathFilename := "e:\temp\test.csv"
Explorer := "explorer /select," . FullPathFilename
Run, %Explorer%
I don't know if you tried the other approach, but I think this is simpler and shorter:
1) Store the full path of the document in a string: oldfile = ActiveDocument.FullName
2) SaveAs the document with ActiveDocument.SaveAs
3) Delete the old file with Kill oldfile
All this is from VBA directly, no need to use Explorer shell. The same exists for the other applications.
Here is a fully working code for the Word Documents:
Sub RenameActiveDoc()
Dim oldfile As String
Set myDoc = ActiveDocument
'1) store current file
oldfile = myDoc.FullName
'2) save as the active document (prompt user for file name)
myDoc.SaveAs FileName:=InputBox("Enter new name", "Rename current document", myDoc.Name)
'3) Delete the old file with
On Error GoTo FileLocked
Kill oldfile
On Error GoTo 0
Exit Sub
FileLocked:
MsgBox "Could not delete " & oldfile, vbInformation + vbOKOnly, "File is locked"
End Sub
With contribution of Ro Yo Mi I am able to come up with following solution. However I am assuming that there might better solution to this task.
;;; Customize Document Location (Choose form All Commands) in Quick Access Toolbar and get its position (#4 for my case)
#If WinActive("ahk_class OpusApp") || WinActive("ahk_class XLMAIN") || WinActive("PPTFrameClass")
#p:: ;Close Word/Excel/PowerPoint Document and Locate in Explorer Folder Location
clipboard = ;empty the clipboard
Send !4 ; Select full path while document location at #4 position in Quick Access toolbar
Send ^c ; copy the full path
ClipWait ; waits for the clipboard to have content
Send {esc}
Send, ^{f4} ; Close opened document only but keep Word/Excel/PPT program running
Explorer := "explorer /select," . clipboard
Run, %Explorer%\
return

Zookeeper: how to rename, copy or move a path?

I have a Zookeeper path /xxx/yyy/zzz how can I copy/move it to another path without coding a script? Can I do that with some tool like zkCli.sh?
There's no command like rename , you can use delete and create ,maybe together with multi .

how can I rename a folder using Matlab script

I want to rename a folder in a path by using Matlab script:
c:\My Path\New Folder\ --> c:\MyPath\NewFolder\ %remove the spaces in the path name
got what I wanted finally to work:
system('7z e "C:\Public\test\dry?testing41013\Log?#1\max_logs_can_messages.tgz" -o"C:\Public\test\dry testing41013\Log #1\"')
had to use "?" for spaces in the first path but not the second path
You can use MOVEFILE function. It works for folders as well.
movefile('c:\My Path\New Folder\', 'c:\MyPath\NewFolder')