Comments (7)
I see that it's not working correctly right now. I'll rename the issue and let you know when fixed
from evil-lion.
Until now evil-lion has been designed to not handle tabs. Supporting tabs would be a nice feature but the hard part would be to figure out what's the best behavior from the user's standpoint.
This particular example has intermixed tabs (lines 2, 3, 4) and spaces (lines 1, 5, 6). Let me know if you have any suggestions for an algorithm for this case, the best thing which comes to my mind is A) bail out with an error when the given region has both spaces and tabs, and B) turn tabs into spaces (but how many?) and then align
from evil-lion.
I see. but suppose it was all spaces. would it be possible?
from evil-lion.
I have a version which works, but it only works when evil-lion-squeeze-spaces
is t
(it is t
by default):
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
# 127.0.0.1 thinkpad.localdomain thinkpad
192.168.0.4 julicloud.local julicloud
127.0.1.1 thinkpad.localdomain thinkpad
Do you happen to know if align.el is capable of aligning on spaces so I can re-use its functionality?
from evil-lion.
Hum. I use an align function from spacemacs which I think uses align-regexp. Will that test later.
from evil-lion.
@edkolev, I've just used a function (from spacemacs) to align the block with success.
All I did was vip
, then invoking the function, then insert a space at the prompt and hit enter.
As this function uses align-regexp
from align.el
I believe this is what you are looking for.
interesting to note, it leaved 2 spaces between the columns.
- before:
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
# 127.0.0.1 thinkpad.localdomain thinkpad
192.168.0.4 julicloud.local julicloud
127.0.1.1 thinkpad.localdomain thinkpad
- after:
#<ip-address> <hostname.domain.org> <hostname>
127.0.0.1 localhost.localdomain localhost
::1 localhost.localdomain localhost
# 127.0.0.1 thinkpad.localdomain thinkpad
192.168.0.4 julicloud.local julicloud
127.0.1.1 thinkpad.localdomain thinkpad
- the function:
;; function copied from spacemacs source code
;; modified function from http://emacswiki.org/emacs/AlignCommands
(defun spacemacs/align-repeat (start end regexp &optional justify-right after)
"Repeat alignment with respect to the given regular expression.
If JUSTIFY-RIGHT is non nil justify to the right instead of the
left. If AFTER is non-nil, add whitespace to the left instead of
the right."
(interactive "r\nsAlign repeat regexp: ")
(let* ((ws-regexp (if (string-empty-p regexp)
"\\(\\s-+\\)"
"\\(\\s-*\\)"))
(complete-regexp (if after
(concat regexp ws-regexp)
(concat ws-regexp regexp)))
(group (if justify-right -1 1)))
(message "complete-regexp: %S" complete-regexp)
(align-regexp start end complete-regexp group 1 t)))
from evil-lion.
I see... so align.el also squeezes (removes) the whitespace.
Thanks for looking into this, I'll try to reuse align.el's functionality but also try to avoid the double-space after aligning.
from evil-lion.
Related Issues (11)
- Different behavior in built-in Emacs alignment and evil-lion HOT 4
- no operator-state cursor when waiting for alignment character HOT 1
- no minibuffer history for / HOT 3
- Incorrect indentation HOT 1
- The second example in README not working HOT 2
- Incorrect Autoload Cookies
- provide a way to customize the keybinds HOT 6
- consider incorporating some ideas from spacemacs alignment functions HOT 6
- Mode? How to best integrate evil-lion with evil and not lose flexibility HOT 5
- allow controlling repeatability like vim-easy-align HOT 3
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 evil-lion.