├── README.md ├── autoload └── unite │ └── sources │ └── quicklearn.vim └── doc └── quicklearn.txt /README.md: -------------------------------------------------------------------------------- 1 | # quicklearn 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 |
Video streaming by Ustream 11 | 12 | Quicklearn is a quickrun plugin and is a Unite plugin at the same time. 13 | 14 | Quicklearn compiles the code you are writing, opens another window, and shows the intermediate code of the language. 15 | 16 | * C 17 | * Assembly language (gcc) 18 | * LLVM IR (clang) 19 | * Haskell 20 | * Core (ghc) 21 | * CoffeeScript 22 | * JavaScript 23 | * Ruby 24 | * YARV Instructions (CRuby) 25 | 26 | ## Usage 27 | 28 | :Unite quicklearn -immediately 29 | 30 | Sample configulation for `~/.vimrc`: 31 | 32 | nnoremap R :Unite quicklearn -immediately 33 | 34 | Don't forget the `-immediately` option. 35 | 36 | ## Development TODOs 37 | 38 | * Document 39 | * It's missing doc/quicklearn.txt 40 | 41 | ## Author 42 | 43 | Tatsuhiro Ujihisa 44 | 45 | # License 46 | 47 | GPLv3 or any later versions 48 | -------------------------------------------------------------------------------- /autoload/unite/sources/quicklearn.vim: -------------------------------------------------------------------------------- 1 | let s:save_cpo = &cpo 2 | set cpo&vim 3 | 4 | " fmap([a, b, c], f) => [f(a), f(b), f(c)] 5 | " fmap(a, f) => [f(a)] 6 | function! s:fmap(xs, f) abort 7 | if type(a:xs) == type([]) 8 | return map(a:xs, a:f) 9 | else 10 | return map([a:xs], a:f) 11 | endif 12 | endfunction 13 | 14 | let g:quicklearn_gcc_remote_url = get(g:, 'quicklearn_gcc_remote_url', 'localhost') 15 | 16 | let s:quicklearn = {} 17 | let s:source = { 18 | \ 'name': 'quicklearn', 19 | \ } 20 | let s:quicklearn['c/clang/intermediate'] = { 21 | \ 'meta': { 22 | \ 'parent': 'c/clang'}, 23 | \ 'exec': '%c %o %s -S -emit-llvm -o -'} 24 | let s:quicklearn['c/clang-O3/intermediate'] = { 25 | \ 'meta': { 26 | \ 'parent': 'c/clang'}, 27 | \ 'cmdopt': '-O3', 28 | \ 'exec': '%c %o %s -S -emit-llvm -o -'} 29 | let s:quicklearn['cpp/clang/intermediate'] = { 30 | \ 'meta': { 31 | \ 'parent': 'cpp/clang++'}, 32 | \ 'exec': '%c %o %s -S -emit-llvm -o -'} 33 | let s:quicklearn['cpp/clang-O3/intermediate'] = { 34 | \ 'meta': { 35 | \ 'parent': 'cpp/clang++'}, 36 | \ 'cmdopt': '-O3', 37 | \ 'exec': '%c %o %s -S -emit-llvm -o -'} 38 | let s:quicklearn['c/gcc/intermediate'] = { 39 | \ 'meta': { 40 | \ 'parent': 'c/gcc'}, 41 | \ 'exec': '%c %o %s -S -o -'} 42 | let s:quicklearn['c/gcc-O1/intermediate'] = { 43 | \ 'meta': { 44 | \ 'parent': 'c/gcc'}, 45 | \ 'cmdopt': '-O1', 46 | \ 'exec': '%c %o %s -S -o -'} 47 | let s:quicklearn['c/gcc-O2/intermediate'] = { 48 | \ 'meta': { 49 | \ 'parent': 'c/gcc'}, 50 | \ 'cmdopt': '-O2', 51 | \ 'exec': '%c %o %s -S -o -'} 52 | let s:quicklearn['c/gcc-O3/intermediate'] = { 53 | \ 'meta': { 54 | \ 'parent': 'c/gcc'}, 55 | \ 'cmdopt': '-O3', 56 | \ 'exec': '%c %o %s -S -o -'} 57 | let s:quicklearn['c/gcc-32/intermediate'] = { 58 | \ 'meta': { 59 | \ 'parent': 'c/gcc'}, 60 | \ 'cmdopt': '-m32', 61 | \ 'exec': '%c %o %s -S -o -'} 62 | let s:quicklearn['c/gcc-remote/intermediate'] = { 63 | \ 'meta': { 64 | \ 'parent': 'c/gcc'}, 65 | \ 'exec': 'ssh ' . g:quicklearn_gcc_remote_url . ' %c %o %s -S -o -'} 66 | let s:quicklearn['haskell/ghc/intermediate'] = { 67 | \ 'meta': { 68 | \ 'parent': 'haskell/ghc'}, 69 | \ 'exec': [ 70 | \ '%c %o -ddump-simpl -dsuppress-coercions %s', 71 | \ 'rm %s:p:r %s:p:r.o %s:p:r.hi'], 72 | \ 'cmdopt': '-v0 --make'} 73 | let s:quicklearn['coffee/intermediate'] = { 74 | \ 'meta': { 75 | \ 'parent': '_'}, 76 | \ 'exec': ['%c %o -cbp %s %a']} 77 | let s:quicklearn['ruby/intermediate'] = { 78 | \ 'meta': { 79 | \ 'parent': 'ruby'}, 80 | \ 'cmdopt': '--dump=insns'} 81 | 82 | " inheritance 83 | for s:k in keys(s:quicklearn) 84 | let s:v = s:quicklearn[s:k] 85 | for s:item in ['command', 'exec', 'cmdopt', 'tempfile', 'eval_template'] 86 | let ofParent = get(g:quickrun#default_config[s:v.meta.parent], s:item) 87 | if type(ofParent) != type(0) || ofParent != 0 88 | let s:quicklearn[s:k][s:item] = get(s:v, s:item, ofParent) 89 | endif 90 | unlet ofParent 91 | endfor 92 | unlet! s:v s:item 93 | endfor 94 | unlet! s:k 95 | 96 | " build quickrun command 97 | for s:k in keys(s:quicklearn) 98 | let s:v = s:quicklearn[s:k] 99 | let s:quicklearn[s:k].quickrun_command = printf( 100 | \ 'QuickRun %s %s %s -cmdopt %s', 101 | \ s:v.meta.parent == '_' ? '' : '-type ' . s:v.meta.parent, 102 | \ get(s:v, 'command') ? '-command ' . string(s:v.command) : '', 103 | \ join(s:fmap(get(s:v, 'exec', []), '"-exec " . string(v:val)'), ' '), 104 | \ string(get(s:v, 'cmdopt', ''))) 105 | unlet! s:v 106 | endfor 107 | unlet! s:k 108 | lockvar s:quicklearn 109 | 110 | function! unite#sources#quicklearn#define() abort 111 | return s:source 112 | endfunction 113 | 114 | function! s:source.gather_candidates(args, context) abort 115 | let configs = filter(copy(s:quicklearn), 'v:key =~ "^" . &filetype . "/"') 116 | 117 | return values(map(configs, '{ 118 | \ "word": substitute(v:key, "/intermediate$", "", ""), 119 | \ "source": s:source.name, 120 | \ "kind": ["command"], 121 | \ "action__command": v:val.quickrun_command, 122 | \ }')) 123 | "\ "action__type": ": ", 124 | endfunction 125 | 126 | let &cpo = s:save_cpo 127 | -------------------------------------------------------------------------------- /doc/quicklearn.txt: -------------------------------------------------------------------------------- 1 | *quicklearn.txt* a quickrun plugin also as a Unite plugin 2 | 3 | TODO 4 | --------------------------------------------------------------------------------