achengs / subpar Goto Github PK
View Code? Open in Web Editor NEWsubset of ParEdit for CodeMirror
License: MIT License
subset of ParEdit for CodeMirror
License: MIT License
https://github.com/laurentpetit/paredit.clj ... Would a cljs version be trivial? If so, subpar could use it instead.
But if it uses a lot of things unsupported in cljs (that is, if creating a cljs version would be nontrivial), subpar could still be improved by having a similar consistent return value from paredit. A lot of hard coded stuff in core would be obviated.
The return value should probably be [1] a list of replacements to make if any, [2] a new cursor position, [3] a range of lines to re-indent if any. Cursor position should be set before re-indentation so we don't have to figure out the change due to it.
Both files are generated by Google's Closure compiler but the debug version can do multiple splices successfully. The core/minified/optimized version can only manage one splice before throwing an exception on all subsequent attempts.
Here's a page that reproduces the issue You might have to refresh the page to get the clojure code inside the code mirror to show up. Not sure why.
Compare that behavior to the official SubPar demo page
If so can you mark it such in the readme? Thanks
would appreciate a keybinding file and a user behaviour file.
when using this plugin it acts almost nothing like the demo you have on this github page.
when i forward delete parens, matching doesn't matter... i can just delete them like normal characters.
when i look up subpar via ctrl + space
they keybindings look ok...
user.keymap
;; Your file has been converted to the new flat format.
;; Conversion does not preserve comments or indentation.
;; File is backed up at /home/paul/.config/LightTable/User/user.keymap.bak
[
[:app "shift-up" :tabs.prev]
[:app "ctrl-x 3" :tabset.new]
[:app "shift-down" :tabs.next]
[:app "shift-right" :tabset.next]
[:app "ctrl-t" :new-file]
[:app "shift-left" :tabset.prev]
[:app "alt-x" :show-commandbar-transient]
[:editor "alt-shift-w" :editor.watch.unwatch]
[:editor "alt-w" :editor.watch.watch-selection]
[:editor.clj "\"" :subpar.insert-double-quote]
[:editor.clj "ctrl-shift-0" :subpar.grow.right]
[:editor.clj "ctrl-down" :subpar.move.forward-down]
[:editor.clj "alt-down" :subpar.splice.delete-forward]
[:editor.clj "(" (:subpar.open-pair "()")]
[:editor.clj ")" (:subpar.close-pair ")")]
[:editor.clj "ctrl-left" :subpar.move.backward]
[:editor.clj "alt-shift-9" (:subpar.open-pair "()") :subpar.grow.right]
[:editor.clj "delete" :subpar.delete.right]
[:editor.clj "ctrl-shift-9" :subpar.barf.right]
[:editor.clj "ctrl-shift-[" :subpar.grow.left]
[:editor.clj "alt-s" :subpar.splice]
[:editor.clj "ctrl-shift-]" :subpar.barf.left]
[:editor.clj "ctrl-right" :subpar.move.forward]
[:editor.clj "[" (:subpar.open-pair "[]")]
[:editor.clj "{" (:subpar.open-pair "{}")]
[:editor.clj "]" (:subpar.close-pair "]")]
[:editor.clj "}" (:subpar.close-pair "}")]
[:editor.clj "ctrl-up" :subpar.move.backward-up]
[:editor.clj "backspace" :subpar.delete.left]
[:editor.clj "delete" :subpar.delete.left]
[:editor.clj "alt-up" :subpar.splice.delete-backward]
[:editor.keys.emacs "alt-left" (:emacs.keymap-cmd "Alt-B")]
[:editor.keys.emacs "alt-x" :show-commandbar-transient]
[:editor.keys.emacs "alt-right" (:emacs.keymap-cmd "Alt-F")]
[:editor.keys.emacs "-ctrl-down" (:emacs.keymap-cmd "Ctrl-Down")]
[:editor.keys.emacs "-delete" (:emacs.keymap-cmd "Delete")]
[:editor.keys.emacs "-ctrl-n" (:emacs.keymap-cmd "Ctrl-N")]
[:editor.keys.emacs "-ctrl-t" (:emacs.keymap-cmd "Ctrl-T")]
[:editor.keys.emacs "-ctrl-up" (:emacs.keymap-cmd "Ctrl-Up")]
[:editor.keys.emacs "-backspace" (:emacs.keymap-cmd "Backspace")]
[:editor.keys.normal "-\"" (:editor.repeat-pair "\"")]
[:editor.keys.normal "-(" (:editor.open-pair "(")]
[:editor.keys.normal "-)" (:editor.close-pair ")")]
[:editor.keys.normal "-[" (:editor.open-pair "[")]
[:editor.keys.normal "-{" (:editor.open-pair "{")]
[:editor.keys.normal "-]" (:editor.close-pair "]")]
[:editor.keys.normal "-}" (:editor.close-pair "}")]
[:editor.keys.normal "-backspace" :editor.backspace-pair]
]
user.behaviours
;; User behaviors
;; -----------------------------
;; Behaviors are stored as a set of diffs that are merged together
;; to create the final set of functionality that makes up Light Table. You can
;; modify these diffs to either add or subtract functionality.
;;
;; Behaviors are added to tags, objects with those tags then automatically gain
;; whatever logic the behavior imparts. To see a list of user-level behaviors,
;; start typing a word related to the functionality you want in between the square
;; brackets (e.g. "theme").
[
;; The app tag is kind of like global scope. You assign behaviors that affect
;; all of Light Table to it.
[:app :lt.objs.style/set-skin "dark"]
[:app :lt.objs.plugins/load-js "user_compiled.js"]
;; The editor tag is applied to all editors
[:editor :lt.objs.editor/no-wrap]
[:editor :lt.objs.style/set-theme "default"]
[:editor (:lt.plugins.emacs/activate-emacs)]
[:editor.clj (:lt.object/add-tag :editor.keys.normal.clojure)]
;; Here we can add behaviors to just clojure editors
[:editor.clojure :lt.plugins.clojure/print-length 1000]
;; Behaviors specific to a user-defined object
[:user.hello :lt.plugins.user/on-close-destroy]
[:app :lt.objs.settings/pair-keymap-diffs]
;; To subtract a behavior, prefix the name with '-' e.g.
;; [:app :-lt.objs.intro/show-intro]
]
Good, but unfortunately the response to keypresses is much too slow to be usable on large file sizes; approx 700 lines.
Chrome on OSX.
Try a larger operation such as a forward killing splice and then undo. Does the cursor placement work out as expected? Compare with emacs w paredit22
Error: No matching clause: 0
at forward_delete (/home/paul/.config/LightTable/plugins/Subpar/subpar_compiled.js:1069:9)
at Function.eval (/home/paul/.config/LightTable/plugins/Subpar/subpar_compiled.js:1360:70)
at b (file:///opt/LightTable/core/node_modules/lighttable/bootstrap.js:6188:14)
at a (file:///opt/LightTable/core/node_modules/lighttable/bootstrap.js:6234:18)
at a (file:///opt/LightTable/core/node_modules/lighttable/bootstrap.js:21134:29)
at b (file:///opt/LightTable/core/node_modules/lighttable/bootstrap.js:21138:14)
at cljs.core.apply_to (file:///opt/LightTable/core/node_modules/lighttable/bootstrap.js:6097:85)
at c (file:///opt/LightTable/core/node_modules/lighttable/bootstrap.js:6194:66)
at a (file:///opt/LightTable/core/node_modules/lighttable/bootstrap.js:6236:18)
at a (file:///opt/LightTable/core/node_modules/lighttable/bootstrap.js:25603:153)
Subpar is very cool!
I've integrated subpar
into klipse: take a look at http://app.klipse.tech/
Click on the icon on the top-left box to switch editing mode.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.