Comments (19)
alias _='sudo'
is defined in alias.zsh. Why don't you use that?
from prezto.
I don't think that I have a free and meaningful key for binding this. I will not break C-s
. I could change _
to s
, and you could type C-a
, s
, SPACE
. That's two more keys unfortunately. You don't need sudo that often, do you?
from prezto.
Clobbering C-a
is a bad idea, since it's the default prefix for screen commands.
from prezto.
@gwjo I'm not clobbering C-a. That's the default key binding for moving the cursor to the beginning of the line in the Emacs layout. I'm telling @giddie to go to the begging of the line, type s
, then spacebar, then hit enter. How GNU Screen users deal with Emacs layouts is not my concern.
from prezto.
To be clear: this isn't a quick way of typing "sudo" (although that does work); this prepends "sudo" to the current line. For instance, I'm halfway through typing a command when I realise I need to be root to do it, so I press C-s, and "sudo" is added to the start of the line. That way, I don't have to throw away the line and retype it.
I administer several ArchLinux servers at work and one at home. I need "sudo" pretty frequently. Maybe that's unusual, though.
BTW, can't I scroll through history search using arrow keys?
Anyway, I'm happy with this in my fork, but it took me a while to figure out how to do this, and I wonder how many other people might benefit from stumbling upon this code in OMZ and thinking "Huh, that's a neat idea".
from prezto.
@sorin-ionescu Ah; I see. Yeah, I could use C-a and C-e to achieve the same thing; I didn't honestly know about those bindings. That takes more keystrokes, though. I like my binding :) If you think it's not going to be useful to anyone else, I understand.
from prezto.
Typing C-a
, s
, space
, C-e
is certainly more work than C-s
. But, I still can't see where I can bind it. You can execute bindkey -L
to see the current bindings.
from prezto.
Do you know where C-r
and C-s
came from for history-incremental-pattern-search
? I'm considering switching them with C-n
and C-p
(history-substring-search
), which are already bound to the up and down keys. That would free up my C-s
(and maybe I could use C-r
for my push-line-or-edit
binding).
from prezto.
@giddie They come from Emacs, but all bindings are found in keyboard.zsh
.
from prezto.
I can bind this to C-X C-S
in emacs mode. TBD in Vi mode.
from prezto.
I've chosen Escape-S
in Vi mode. How does that sound to you?
from prezto.
It's probably going to be C-X C-S
for both. It's easier to type than ESC-S
or C-[ C-S
.
from prezto.
Agreed. C-x
is also self-insert
in vi-mode. The idea of having "special" bindings like this tidied under C-x
appeals to me. It gives me scope to add more if I want.
from prezto.
There are quite a few C-X
bindings. Don't go trigger happy now. Check before you bind.
from prezto.
I'm not seeing any bindings under C-x
in vi-mode, which is all I really care about when it comes to my own use. If I were to suggest a new binding for general consumption, I'd be sure to check Emacs-mode doesn't already have that key bound :)
from prezto.
There is a problem with this implementation. It's too dumb. It prepends sudo at the beginning of the line when it should prepend at the beginning of the current command in order to work in multi-command lines or multi-line commands.
from prezto.
True; this is OK for my needs, though Thanks for including this :)
from prezto.
I don't include anything for one man's needs. It has to be useful to many. That said, making this command aware will be a pain. It's probably not worth it.
from prezto.
Absolutely, I would hope not!
from prezto.
Related Issues (20)
- grep warning: obsolescent (g)egrep HOT 1
- macos ventura 13.1 can't do this HOT 1
- Issue with env variables ($path variable)
- Add zstyle to skip aliases in more modules beyond just git
- Command cache malfunctioning HOT 3
- Searching using command prefix on up array HOT 3
- Spelling error in Prezto tag... HOT 1
- history command only shows the last item
- Completion chooses incorrect prefix among filenames
- error when `ls` is aliased to `lsd`.
- Syntax highlighting doesnt update with custom autosuggest-accept (key binding from auto-suggestion)
- Prompt theme `fire` doesn't show git branch prefix
- `unsetopt CASE_GLOB` breaks performance HOT 5
- Using module `syntax-highlighting` show an error "maximum nested function level reached"
- Add zstyle to configure WORDCHARS
- source lines errors in .zprezto/init.zsh cause errors
- prezto fails with errors at line 172 and 199 in zsh.init HOT 2
- BBEdit.app can't start because of prezto on Mac.
- Missing time stamp in powerline theme.
- Add aliases for `git switch` and `git restore` to Git module
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 prezto.