Replies: 4 comments 5 replies
-
Thank you for the feedback! Q1: May I ask which behavior do you precisely intend?
$ ble-sabbrev l='ls -l'[RET]
$ l[RET]
$ ls -l[RET]
-rw-r--r-- 1 ply ply 51966 Sep 16 16:08 ble.pp
-rw-r--r-- 1 ply ply 29823 Sep 16 16:08 blerc
...
$ ble-sabbrev l='ls -l'[RET]
$ l[RET]
[ble: expand] ls -l
-rw-r--r-- 1 ply ply 51966 Sep 16 16:08 ble.pp
-rw-r--r-- 1 ply ply 29823 Sep 16 16:08 blerc
...
$ ble-sabbrev l='ls -l'[RET]
$ l[RET]
-rw-r--r-- 1 ply ply 51966 Sep 16 16:08 ble.pp
-rw-r--r-- 1 ply ply 29823 Sep 16 16:08 blerc
... Q2: Should it happen also for the words that are not in the position of commands? $ ble-sabbrev '\X'='hello world'[RET]
$ echo \X[RET] Q3: Should the cursor position matter for whether the sabbrev expansion happens? I.e., should it happen also when the cursor isn't in the front of the word to be expanded? # Example 1
$ ble-sabbrev l='ls -l'[RET]
$ l file1[RET]
# Example 2 (going to the beginning of the command line before pressing RET)
$ ble-sabbrev l='ls -l'[RET]
$ [RET]l It seemed like useful in the first thought, and also it's technically possible. But this might not work well because unexpected expansions may happen by the behavior. Also, there is no way to literally run a command that contains words registered in |
Beta Was this translation helpful? Give feedback.
-
I like this one best. I think 1 is usually going to be unexpected or else create an unhealthy habit of hitting enter repeatedly, and 3 seems strange because it defeats part of the purpose of using sabbrev instead of alias or function in the first place, and introduces a difference in operation between magic space and Enter. Also 2 is more consistent with magic space (which both does the expansion and adds the space).
I think it should only fire when the cursor is at the end of the abbreviation when Enter is pressed, both for the reasons you say and also because it's more consistent with how magic space works. |
Beta Was this translation helpful? Give feedback.
-
Regarding Q2 I think probably yes for self-consistency and consistency with magic space, but seems like the hardest question as it could produce unexpected behavior and I haven't yet wanted to use it for this (though I'm new to sabbrev and it seems possible to want it) |
Beta Was this translation helpful? Give feedback.
-
Seems to work great. I have only check sabbrev and sabbrev:verify-syntax though |
Beta Was this translation helpful? Give feedback.
-
Just discover ble.sh and wondered if it would possible have sabbrev expand with the key also.
The current behavior is good with the
I like to have the below rehavior also:
Thank you.
Beta Was this translation helpful? Give feedback.
All reactions