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)
- Custom option `desktop-save-mode t` now loads `desktop` automatically upon launch (new behavior) HOT 1
- Cannot load applications from eaf layer: "ModuleNotFoundError: No module named 'PyQt6'" HOT 1
- Company fails to install after upgrading emacs to 29.2 HOT 1
- Python configuration in Spacemacs HOT 5
- Feature Request: Add option for recentf buffers for compleseus layer HOT 2
- Don't use orderless with company-capf as a default
- Pressing TAB to autocomplete on java makes the whole editor freeze (company capf timeout) HOT 2
- Spacemacs is unusable, reporting `Symbol's function definition is void: function-alias-p` HOT 7
- Typescript layer: No ESLint configuration found in project after explicitly setting `exec-path` with project path to ESLint HOT 2
- ESS layer does not bind keys for inferior-ess-mode HOT 1
- a strange space on the number line gutter HOT 7
- mini buffer is hiding other windows HOT 4
- auto-completion is broken if dotspacemacs-scratch-mode enables company
- Building documentation locally HOT 2
- Php Mode keep show this error. HOT 2
- configuration-layer/package-used-p is inconsistent with cfgl-package-used-p HOT 1
- Ruby debugger highlighting false-positives
- `git grep` is preferred over `rg` but is massively deficient HOT 2
- Slow opening of tex files HOT 6
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.