Comments (4)
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.
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
-
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.
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.
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)
- error (use-package) - symbol's fuction definition is void HOT 9
- Error (use-package) : org-projectile/:init: -- no such file or directory : org-projecticle HOT 4
- How to install source code pro? HOT 1
- "dotspacemacs-auto-save-file-location" not triggering "after-save-hook"? HOT 2
- helm-spacemacs-help-faq (M-m h f) fails with "if: Wrong type argument: stringp, helm"
- Cannot create new file if similar name exists HOT 7
- Need a Brawlstar plugin
- Compleseus and ripgrep filter ? HOT 1
- (error "Key sequence m - m starts with non-prefix key m") HOT 6
- built-in org package used. why? HOT 4
- GPU layer: opencl-mode not found
- Unable to read help `C-h` minibuffer bottom text line HOT 1
- Saving files of any size is annoyingly slow HOT 10
- Erc layer: Wrong type arguement: commandp, spacemacs/erc-find-channel-log
- Error when starting spacemacs HOT 11
- `#include <fstream>` deleted by `c-c+-organize-includes` HOT 1
- Unable to Plot Graphs in R HOT 2
- [c-c++] There is no command under 'compile' leader key. HOT 2
- Spacemacs Loads .Rprofile when LSP is ON HOT 1
- display-buffer-alist not respecting window settings HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from spacemacs.