0

In Ivy, it can not to create directly a new file in a new folder (as type C-x C-f, then write a file path /current_path/new_fold/new_file). If there is a better way to do it, how to use the key binding along with a suitable Elisp?

  • 1
    Sorry, your question is not very clear. Can you please list in further detail the steps you would like to take, and what you would like to happen at each step? Have you tried setting the user option ivy-magic-slash-non-match-action to 'ivy-magic-slash-non-match-create? – Basil Jun 19 '18 at 5:42
  • It is also prompt the nonexistent file path. – cc d Jun 19 '18 at 6:09
  • The error report: Debugger entered--Lisp error: (error ":working-directory /Users/sb/Github/believingdying/react-app/src/components/yes/ of syntax checker javascript-jshint does not exist") signal(error (":working-directory /Users/sb/Github/believingdying/react-app/src/components/yes/ of syntax checker javascript-jshint does not exist")) error(":working-directory %s of syntax checker %S does not exist" "/Users/sb/Github/believingdying/react-app/src/components/yes/" javascript-jshint) flycheck-compute-working-directory(javascript-jshint) – cc d Jun 19 '18 at 6:16
  • 1
    Please update your question with error details, instead of posting them in comments. Please also list in detail which keys/commands cause the error. In brief, please try to make the recipe as reproducible as possible. Does the error still occur if you enable ivy-mode after emacs -Q? – Basil Jun 19 '18 at 6:25
3

In ivy, it can not to create directly a new file in a new folder

Emacs can do this regardless of whether ivy-mode is enabled, or whether you are using counsel-find-file. You will be prompted to create any non-existent parent directories when you try to write the buffer contents to a file (e.g. C-xC-s), or you can create them yourself via M-xmake-directoryRETRET.

See also the following blog post for how to configure Emacs to automatically create non-existent parent directories: http://iqbalansari.me/blog/2014/12/07/automatically-create-parent-directories-on-visiting-a-new-file-in-emacs/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.