Giter VIP home page Giter VIP logo

Comments (4)

bcc32 avatar bcc32 commented on July 26, 2024 1

default binding for creating a new buffer and saving it as a new file.

You can just use SPC f f to specify a file you want to create, write some contents, and then save as SPC f s (you'll have to press that at some point eventually to save whatever you write, so there's no way to do it in just one key binding).

from spacemacs.

fnussbaum avatar fnussbaum commented on July 26, 2024 1

I would not object to adding a user option. In any case, one could of course change the behaviour locally with something like:

(defun my/spacemacs/save-as (filename)
    (interactive (list (expand-file-name (read-file-name "Save buffer as: " nil nil nil
                                                         (when current-prefix-arg (buffer-name))))))
    (spacemacs/save-as filename :current))

(spacemacs/set-leader-keys "fc" 'my/spacemacs/save-as)

This is slightly inconvenient as there does not seem to be an idiomatic way to call a function using its interactive specification for some of its arguments, and using fixed values for the remaining ones. Hence I just copied the interactive specification1 of the first argument from spacemacs/save-as.

Footnotes

  1. As a side note, as an alternative to using a prefix argument, inserting the current file name can be done using the future history, i. e. by pressing M-n in the minibuffer prompt. Of course this uses the file name instead of the buffer name, which only makes sense for file-backed buffers. In the latter case, however, the behaviour might be preferable, for example when buffer names have been uniquified.

from spacemacs.

rommeswi avatar rommeswi commented on July 26, 2024

Well, and something related that would be very intuitive to have is a default binding for creating a new buffer and saving it as a new file. SPC b n n and SPC f s should somehow be combined into SPC f n or something similar. Or is there a reason why this binding does not exist? For new users it would definitely be very natural.

from spacemacs.

rommeswi avatar rommeswi commented on July 26, 2024

Indeed, I totally missed that possibility. Thank you for improving my workflow! Regarding the SPC f c option of not querying for whether to open the file, it would still be a nice to have.

from spacemacs.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.