Does anyone have a cheatsheet for LightTable, even better for the paredit plugin, it seems my google-fu is not up to finding one?
I don't think a general cheat sheet for LightTable exists yet!
But for the paredit plugin...I hope the following helps
Paredit Commands
:paredit.unwrap.parent (a b (c | d) e) => (a b c | d e)
:paredit.grow.left (a b (c | d) e) => (a (b c | d))
:paredit.grow.right (a b (c | d) e) => (a b (c | d e))
:paredit.shrink.left (a b (c | d) e) => (a b c | (d) e)
:paredit.shrink.right (a b (c | d) e) => (a b (c) | d e)
:paredit.move.up.forward (a b (c | d) e) => (a b (c d)| e)
:paredit.move.up.backward (a b (c | d) e) => (a b |(c d) e)
:paredit.move.down.forward (a b | (c d) e) => (a b (|c d) e)
:paredit.move.down.backward (a b (c d) | e) => (a b (c d|) e)
Binding the keys
To bind the keys, first open user keymap (Settings: User Keymap), and then add binding entries in for the editors in which you want paredit bindings.
e.g. I have them bound in all editors, so the relevant bit of my keymap is:
{:+ {:app { ...}
:editor { ...
"ctrl-shift-right" [:paredit.grow.right]
"ctrl-shift-left" [:paredit.shrink.right]
"ctrl-right" [:paredit.shrink.left]
"ctrl-left" [:paredit.grow.left]}}
:- {}}
Most of the action happens, when you hit CTRL + Space so you get all commands in there. Just type a keyword and you get all options for it.
I think you want to bind the "usual" keyboard bindings from paredit into lighttable. That's very easy:
Hit CTRL + Space
Type Settings
You get a list of actually 5 items. Choose "Default Keymap" (or "User keymap")
You get a hash-map with the keybindings set up so far
Here you can edit your paredit plugin and bind the commands you would like to use. For paredit I added to my default keymap:
:editor {"ctrl-left" [:paredit.shrink.right]
"ctrl-right" [:paredit.grow.right]
"ctrl-s" [:paredit.unwrap.parent]}
Values like paredit.shrink.right can be found if you hit CTRL + Space and type paredit. As you have 3 examples above, you can just think of how the other commands would look like:
"Paredit: Shrink right" is the keyword :paredit.shrink.right
I am pretty sure that I found a list in the internet where those commands were written down, but I can't find it at this moment. But if you know how to "convert" it to keywords, you can just use CTRL + Space to find all commands you need.
When you correctly bound a keyword on a keybinding you can see this binding in the command list CTRL + Space.
With this in your mind, you actually have something like a Cheatsheet printed as a map of bindings and actions. Hope this helps ;-)
Only because the others have not said it yet. You can bind multiple actions to one shortcut as the actions are stored in a list:
:editor {"ctrl-shift-up" [:paredit.grow.right :paredit.shrink.right]
"ctrl-right-down" [:paredit.shrink.left :paredit.grow.left]}
I found this page while searching for a cheat sheet of the default keybindings, but the existing answers only focused on paredit. I kept searching and eventually discovered the command "Settings: Default keymap" in the command pane. This command shows all the default keybindings for tasks like inline evaluation, navigating through matches during find & replace, and navigating through tabs. Here are the default keybindings as of April 2017:
[:app "pmeta-shift-f" :searcher.show]
[:app "ctrl-space" :show-commandbar-transient]
[:app "pmeta-shift-n" :window.new]
[:app "pmeta-shift-o" :open-file]
[:app "pmeta--" :window.zoom-out]
[:app "pmeta-n" :new-file]
[:app "ctrl-shift-d" :docs.search.show]
[:app "pmeta-o" :navigate-workspace-transient]
[:app "pmeta-shift-=" :window.zoom-in]
[:app "pmeta-=" :window.zoom-in]
[:app "pmeta-0" :window.zoom-reset]
[:app "pmeta-r" :refresh-connected-browser]
[:app "f11" :window.fullscreen]
[:browser "pmeta-l" :browser.url-bar.focus]
[:browser.url-bar "esc" :browser.focus-content]
[:browser.url-bar "enter" :browser.url-bar.navigate!]
[:editor "pmeta-enter" :eval-editor-form]
[:editor "ctrl-d" :editor.doc.toggle]
[:editor "ctrl-," :editor.unjump]
[:editor "ctrl-." :editor.jump-to-definition-at-cursor]
[:editor "pmeta-shift-s" :save-as]
[:editor "pmeta-l" :goto-line]
[:editor "pmeta-shift-enter" :eval-editor]
[:editor "ctrl-=" :editor.fold-code]
[:editor "pmeta-s" :save]
[:editor "pmeta-/" :toggle-comment-selection]
[:editor.keys.hinting.active "enter" :passthrough]
[:editor.keys.normal "pmeta-shift-g" :find.prev]
[:editor.keys.normal "pmeta-f" :find.fill-selection :find.show]
[:editor.keys.normal "pmeta-g" :find.next]
[:editor.keys.normal "tab" :auto-complete]
[:editor.keys.normal "backspace" :passthrough :editor.backspace-indent]
[:filter-list.input "down" (:filter-list.input.move-selection 1)]
[:filter-list.input "esc" (:filter-list.input.escape! :force)]
[:filter-list.input "enter" :filter-list.input.select!]
[:filter-list.input "up" (:filter-list.input.move-selection -1)]
[:find-bar "pmeta-shift-g" :find.prev]
[:find-bar "shift-enter" :find.prev]
[:find-bar "pmeta-g" :find.next]
[:find-bar "esc" :find.clear :find.hide]
[:find-bar "enter" :find.next]
[:find-bar.replace "pmeta-enter" :find.replace-all]
[:find-bar.replace "pmeta-shift-g" :find.prev]
[:find-bar.replace "pmeta-g" :find.next]
[:find-bar.replace "esc" :find.clear :find.hide]
[:find-bar.replace "enter" :find.replace]
[:options-input "esc" :options-input.escape!]
[:options-input "enter" :options-input.select!]
[:plugin-manager.search "enter" :plugin-manager.search]
[:popup "left" (:popup.move-active 1)]
[:popup "shift-tab" (:popup.move-active -1)]
[:popup "esc" (:popup.escape)]
[:popup "tab" (:popup.move-active 1)]
[:popup "enter" (:popup.exec-active)]
[:popup "right" (:popup.move-active -1)]
[:popup.input "left" :passthrough]
[:popup.input "right" :passthrough]
[:searcher.location "enter" :searcher.search]
[:searcher.replace "pmeta-enter" :searcher.replace-all]
[:searcher.search "enter" :searcher.search]
[:sidebar.clients "esc" :show-connect]
[:sidebar.doc.search.input "esc" :docs.search.hide]
[:sidebar.doc.search.input "enter" :docs.search.exec]
[:tabs "pmeta-8" (:tabs.goto 7)]
[:tabs "pmeta-9" (:tabs.goto :last)]
[:tabs "ctrl-shift-tab" :tabs.prev]
[:tabs "ctrl-tab" :tabs.next]
[:tabs "pmeta-shift-[" :tabs.prev]
[:tabs "pmeta-1" (:tabs.goto 0)]
[:tabs "pmeta-shift-]" :tabs.next]
[:tabs "pmeta-2" (:tabs.goto 1)]
[:tabs "pmeta-3" (:tabs.goto 2)]
[:tabs "pmeta-4" (:tabs.goto 3)]
[:tabs "pmeta-5" (:tabs.goto 4)]
[:tabs "pmeta-6" (:tabs.goto 5)]
[:tabs "pmeta-7" (:tabs.goto 6)]
[:tabs "pmeta-w" :tabs.close]
[:tree.rename "esc" :workspace.rename.cancel!]
[:tree.rename "enter" :workspace.rename.submit!]
Hope this helps someone.
Related
it 'computes correctly when on & off have a list at cronRange[4]', ->
#component.set('cronRanges', [Ember.Object.create({
on: "* * * 3 3,1,5"
off: "* * * 3 3,1,5"
})])
#component.set('dayOfWeek', 2)
expect(#component.get('inRange')).to.be.false
#component.set('dayOfWeek', 5)
expect(#component.get('inRange')).to.be.true
#component.set('dayOfWeek', 1)
expect(#component.get('inRange')).to.be.true
#component.set('dayOfWeek', 3)
expect(#component.get('inRange')).to.be.true
this is an ember unit test that fails with the error that is the is the title of this question.
If you're using Ember, try wrapping async calls in Ember.run => read this
What I understood is, if you're setting something #set(..,..) to the #store(), in the unit tests, and get this error, then you should use Ember.run =>
Also, remember the arrow has to be a fat arrow, (i made that mistake once of using -> instead of =>)it's because of javascript scope, read up on it if you are interested.
Solution: observe that I just added line # 2
it 'computes correctly when on & off have a list at cronRange[4]', ->
Ember.run =>
#component.set('cronRanges', [Ember.Object.create({
on: "* * * 3 3,1,5"
off: "* * * 3 3,1,5"
})])
#component.set('dayOfWeek', 2)
expect(#component.get('inRange')).to.be.false
#component.set('dayOfWeek', 5)
expect(#component.get('inRange')).to.be.true
#component.set('dayOfWeek', 1)
expect(#component.get('inRange')).to.be.true
#component.set('dayOfWeek', 3)
expect(#component.get('inRange')).to.be.true
I have this DB2 table
A | B | C
aaaa |123 |
bbbb |1 |
cccc |123456 |
All columns are varchars. I would like to have the column C filled up with the contents of B concatenated with the contents of A.
BUT the max length of C is 8. So if the concatenated string exceeds 8, then i would like to have only 5 characters + "...".
Basically:
if(length(A) + length(B) > maximum(C) {
//display only the first (maximum(C) - 3) characters, then add "..."
} else {
// display B + A
}
How can i do this in DB2?
One good option would be to define column C as generated column so you do not have to handle anything.
create table t3 (A varchar(10),
B varchar(10),
C varchar(8) generated always as (case when length(concat(A, B)) > 8 then substr(concat(A,B),1,5) || '...' else concat(A, B) end)
)
insert into t3 (A,B) values ('This', ' is a test');
insert into t3 (A,B) values ('ABCD', 'EFGH');
select * from t3
will return
A B C
----------------------------------
This is a test This ...
ABCD EFGH ABCDEFGH
Alternatives could be triggers, procedures, explicit code etc.
I like to structure my org-mode projects using the :CATEGORY: property, however categories seem not to be recognised by org-agenda-filter-by-regexp (bound to =). When viewing a rather large list of TODO items, it would be helpful to be able to narrow the list to matching categories.
I know that I can use org-agenda-filter-by-category (<), but this command must be executed on the category entry.
Is there a way to regexp filter the Org Agenda including categories?
The function below performs what I'd like, however I can't get it to work from the org-agenda dispatcher as a custom agenda command.
(defun rnkn/org-category-match (str)
"Org Agenda match TODO headlines matching :CATEGORY: property STR."
(interactive "sCategory: ")
(org-tags-view t (concat "CATEGORY={" str "}")))
Type M-x org-agenda RET m and then enter the regex -- e.g., PropertyDrawerName={regex}
Previous Answer (before the original poster edited the question) -- the current version of org-element-property / org-element-headline-parser uses all UPPERCASE letters for the property drawer arguments:
(defun example-one ()
(interactive)
(require 'org-element)
(let* (
(org-todo-keywords '((sequence "Active(a)" "Next Action(n)" "Reference(r)" "Someday(s)" "Delegated(d)" "|" "None(N)") ))
(sample-todo (concat
"* TASKS\n\n"
"** Active [#A] smith # drawer-one (fishing) | drawer-two (tennis). :lawlist:\n"
" DEADLINE: <2013-12-21 Sat 17:00> SCHEDULED: <2013-12-21 Sat>\n"
" :PROPERTIES:\n"
" :DRAWER-ONE: fishing\n"
" :DRAWER-TWO: tennis\n"
" :END:\n\n"
"** Next Action [#B] doe # drawer-one (football) | drawer-two (bowling). :fred:\n"
" DEADLINE: <2013-12-22 Sun 08:30> SCHEDULED: <2013-12-22 Sun>\n"
" :PROPERTIES:\n"
" :DRAWER-ONE: football\n"
" :DRAWER-TWO: bowling\n"
" :END:\n\n"
"* EVENTS\n\n"
"** Reference [#C] john # drawer-one (fishing) | drawer-two (sky-diving). :george:\n"
" DEADLINE: <2013-12-23 Mon 10:15> SCHEDULED: <2013-12-23 Mon>\n"
" :PROPERTIES:\n"
" :DRAWER-ONE: fishing\n"
" :DRAWER-TWO: sky-diving\n"
" :END:\n\n"
"* UNDATED\n\n"
"** Someday [#D] jane # drawer-one (basket-ball) | drawer-two (bowling). :sam:\n"
" DEADLINE: <2013-12-24 Tues 12:00> SCHEDULED: <2013-12-24 Tues>\n"
" :PROPERTIES:\n"
" :DRAWER-ONE: basket-ball\n"
" :DRAWER-TWO: bowling\n"
" :END:")))
(if (get-buffer "foo.org")
(progn
(switch-to-buffer "foo.org")
(erase-buffer)
(delete-other-windows))
(switch-to-buffer (get-buffer-create "foo.org")))
(org-mode)
(insert sample-todo)
(goto-char (point-min))
(or (y-or-n-p (format "For this example work, you must save this buffer as a file. Proceed with example?"))
(error "Canceled."))
(write-file "~/Desktop/foo.org" t)
(let* (
(filename (buffer-file-name))
(org-agenda-files (list filename))
(org-agenda-only-exact-dates t)
(org-agenda-show-all-dates nil)
(org-deadline-warning-days 0)
(org-agenda-time-grid nil)
(org-agenda-span 'month)
(org-agenda-entry-types '(:deadline))
(month "12")
(year "2013")
(org-agenda-start-day (concat year "-" month "-" "01"))
(drawer-content (read-string "basket-ball | bowling | fishing | football | sky-diving | tennis: " nil))
(org-agenda-skip-function (lambda ()
(org-back-to-heading t)
(let* (
(element (org-element-at-point))
(drawer-one (org-element-property :DRAWER-ONE element))
(drawer-two (org-element-property :DRAWER-TWO element)))
(cond
((not (or
(equal drawer-one drawer-content)
(equal drawer-two drawer-content)))
(org-end-of-subtree t))
(t nil) )) )))
(org-agenda-list))))
(defun example-two ()
(interactive)
(let* (
(drawer (read-string "Select a property drawer (e.g., ToodledoFolder): "))
(drawer-content (read-string (concat "Select the content of the " drawer " property drawer (e.g., EVENTS): "))))
(org-tags-view nil (concat drawer "=\"" drawer-content "\"" ))))
I'm using the following function to filter by category (solves the problem of < ).
(defun stu/org-agenda-filter-by-category ()
"Filter lines in the agenda buffer that have a specific category."
(interactive)
(let ((cat (read-string "Select the category: ")))
;;(stu/show-agenda-and-todo)
(org-agenda-filter-apply
(setq org-agenda-category-filter
(list (concat "+" cat))) 'category)))
I use (stu/show-agenda-and-todo) to make sure it filters every possible task, not only the ones shown in the buffer.
I’m trying to automatically sort the lines in the Quickfix list alphabetically by the contents of the lines themselves (by default, it sorts by the order they appear in the file). I’ve put the below in my .vimrc, but for some reason it sorts according to the line numbers. As far as I can tell, the Quickfix list is a list of dictionaries, so the Sortqfbytext function below should only be sorting by the text content of each list item and ignoring the rest (including the line numbers).
function! s:Sortqfbytext(i1, i2)
let textlist = []
let textlist = [a:i1.text,a:i2.text]
call sort(textlist)
if textlist[0] == textlist[1]
return 0
elseif textlist[0] == a:i1.text
return 1
elseif textlist[0] == a:i2.text
return -1
endif
endfunction
function! s:Makesortedqflist()
let xlist = sort(getqflist(), 's:Sortqfbytext')
call setqflist(xlist)
endfunction
autocmd! QuickfixCmdPost * call s:Makesortedqflist()
I would implement this idea as follows.
autocmd! QuickfixCmdPost * call SortQuickfix('QfStrCmp')
function! SortQuickfix(fn)
call setqflist(sort(getqflist(), a:fn))
endfunction
function! QfStrCmp(e1, e2)
let [t1, t2] = [a:e1.text, a:e2.text]
return t1 <# t2 ? -1 : t1 ==# t2 ? 0 : 1
endfunction
QuickFix list update setqflist() needs the 'r' flag.
Just change call setqflist(xlist) to call setqflist(xlist, 'r')
1) INPUT BOX 1 AMOUNT INPUT BOX2
[Add More .] when click this button should slidedown like below
1) INPUT BOX 1 AMOUNT INPUT BOX2
2) INPUT BOX 3 AMOUNT INPUT BOX4 (x) (close button)
[Add More .] when clicked again slideDown to 3rd row.
1) INPUT BOX 1 AMOUNT INPUT BOX2
2) INPUT BOX 3 AMOUNT INPUT BOX4 (x) (close button)
3) INPUT BOX 5 AMOUNT INPUT BOX6 (x) (close button)
[Add More .] when clicked again slideDown to 4th row.
when click close that row should slideUp.