Browse Source

Added support to nim

fmind 1 year ago
parent
commit
19e91c6cca
4 changed files with 119 additions and 43 deletions
  1. 1
    0
      .gitignore
  2. 67
    38
      editors/vim/vimrc
  3. 35
    0
      languages/nim/user.yml
  4. 16
    5
      tools/aliases/aliases

+ 1
- 0
.gitignore View File

@@ -1 +1,2 @@
1 1
 *.retry
2
+languages/nim/nim-*

+ 67
- 38
editors/vim/vimrc View File

@@ -169,13 +169,17 @@ let g:ycm_key_list_select_completion = ['<C-n>', '<Down>']
169 169
 let g:ycm_key_list_previous_completion = ['<C-p>', '<Up>']
170 170
 "}}}
171 171
 """ GO LANG {{{
172
-Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
173
-let g:go_metalinter_autosave = 1
174
-let g:go_def_mapping_enabled = 0
175
-let g:go_gocode_unimported_packages = 1
172
+" Plug 'fatih/vim-go', { 'do': ':GoInstallBinaries' }
173
+" let g:go_metalinter_autosave = 1
174
+" let g:go_def_mapping_enabled = 0
175
+" let g:go_gocode_unimported_packages = 1
176 176
 "}}}
177 177
 """ JULIA LANG {{{
178
-Plug 'JuliaEditorSupport/julia-vim'
178
+" Plug 'JuliaEditorSupport/julia-vim'
179
+"}}}
180
+""" NIM LANG {{{
181
+Plug 'baabelfish/nvim-nim'
182
+let g:nvim_nim_enable_default_binds = 0
179 183
 "}}}
180 184
 """ PYTHON LANG {{{
181 185
 Plug 'fisadev/vim-isort'
@@ -438,40 +442,65 @@ nnoremap <silent> <leader>I :UltiSnipsEdit<CR>
438 442
 """""" uml language {{{
439 443
 autocmd BufWritePost *.uml :silent !plantuml <afile>
440 444
 "}}}
445
+"""""" nim language {{{
446
+autocmd FileType nim nmap <localleader>i :NimInfo<CR>
447
+autocmd FileType nim nmap <localleader>I :NimDebug<CR>
448
+autocmd FileType nim nmap <localleader>B :NimEdb<CR>
449
+autocmd FileType nim nmap <localleader>bs :NimEdbStop<CR>
450
+autocmd FileType nim nmap <localleader>bg :NimEdbIgnore<CR>
451
+autocmd FileType nim nmap <localleader>bc :NimEdbContinue<CR>
452
+autocmd FileType nim nmap <localleader>bk :NimSkipCurrent<CR>
453
+autocmd FileType nim nmap <localleader>bi :NimEdbStepInto<CR>
454
+autocmd FileType nim nmap <localleader>bo :NimEdbStepOver<CR>
455
+autocmd FileType nim nmap <localleader>bb :NimEdbToggleBP<CR>
456
+autocmd FileType nim nmap <localleader>b :NimEdb<CR>
457
+autocmd FileType nim nmap <localleader>b :NimEdb<CR>
458
+autocmd FileType nim nmap <localleader>d :NimDefition<CR>
459
+autocmd FileType nim nmap <localleader>D :NimWeb<CR>
460
+autocmd FileType nim nmap <localleader>o :NimOutline<CR>
461
+autocmd FileType nim nmap <localleader>O :NimOutlineUpdate<CR>
462
+autocmd FileType nim nmap <localleader>u :NimUsage<CR>
463
+autocmd FileType nim nmap <localleader>U :NimUsageProject<CR>
464
+autocmd FileType nim nmap <localleader>r :NimRenameSymbol<CR>
465
+autocmd FileType nim nmap <localleader>R :NimRenameSymbolProject<CR>
466
+autocmd FileType nim nmap <localleader>` :NimREPL<CR>
467
+autocmd FileType nim nmap <localleader>e :NimREPLEval<CR>
468
+autocmd FileType nim nmap <localleader>, :NimREPLEvalFile<CR>
469
+"}}}
441 470
 """""" golang language {{{
442
-autocmd BufWritePost *.go :GoImports
443
-autocmd FileType go nmap <localleader>a <Plug>(go-alternate-edit)
444
-autocmd FileType go nmap <localleader>A <Plug>(go-alternate-vertical)
445
-autocmd FileType go nmap <localleader>b <Plug>(go-build)
446
-autocmd FileType go nmap <localleader>c <Plug>(go-callers)
447
-autocmd FileType go nmap <localleader>d <Plug>(go-def-split)
448
-autocmd FileType go nmap <localleader>D <Plug>(go-def-pop)
449
-autocmd FileType go nmap <localleader>e <Plug>(go-callees)
450
-autocmd FileType go nmap <localleader>f <Plug>(go-files)
451
-autocmd FileType go nmap <localleader>g <Plug>(go-generate)
452
-autocmd FileType go nmap <localleader>h <Plug>(go-doc-split)
453
-autocmd FileType go nmap <localleader>H <Plug>(go-doc-browser)
454
-autocmd FileType go nmap <localleader>i <Plug>(go-info)
455
-autocmd FileType go nmap <localleader>I <Plug>(go-implements)
456
-autocmd FileType go nmap <localleader>j <Plug>(go-describe)
457
-autocmd FileType go nmap <localleader>k <Plug>(go-referrers)
458
-autocmd FileType go nmap <localleader>l <Plug>(go-lint)
459
-autocmd FileType go nmap <localleader>m <Plug>(go-metalinter)
460
-autocmd FileType go nmap <localleader>n <Plug>(go-install)
461
-autocmd FileType go nmap <localleader>o <Plug>(go-rename)
462
-autocmd FileType go nmap <localleader>p <Plug>(go-import)
463
-autocmd FileType go nmap <localleader>P <Plug>(go-deps)
464
-autocmd FileType go nmap <localleader>r <Plug>(go-run-split)
465
-autocmd FileType go nmap <localleader>R <Plug>(go-run)
466
-autocmd FileType go nmap <localleader>s <Plug>(go-def-stack)
467
-autocmd FileType go nmap <localleader>S <Plug>(go-def-clear)
468
-autocmd FileType go nmap <localleader>t <Plug>(go-test-func)
469
-autocmd FileType go nmap <localleader>T <Plug>(go-test)
470
-autocmd FileType go nmap <localleader>v <Plug>(go-vet)
471
-autocmd FileType go nmap <localleader>V <Plug>(go-freevars)
472
-autocmd FileType go nmap <localleader>y <Plug>(go-coverage)
473
-autocmd FileType go nmap <localleader>Y <Plug>(go-coverage-clear)
474
-autocmd FileType go nmap <localleader>z <Plug>(go-callstack)
471
+" autocmd BufWritePost *.go :GoImports
472
+" autocmd FileType go nmap <localleader>a <Plug>(go-alternate-edit)
473
+" autocmd FileType go nmap <localleader>A <Plug>(go-alternate-vertical)
474
+" autocmd FileType go nmap <localleader>b <Plug>(go-build)
475
+" autocmd FileType go nmap <localleader>c <Plug>(go-callers)
476
+" autocmd FileType go nmap <localleader>d <Plug>(go-def-split)
477
+" autocmd FileType go nmap <localleader>D <Plug>(go-def-pop)
478
+" autocmd FileType go nmap <localleader>e <Plug>(go-callees)
479
+" autocmd FileType go nmap <localleader>f <Plug>(go-files)
480
+" autocmd FileType go nmap <localleader>g <Plug>(go-generate)
481
+" autocmd FileType go nmap <localleader>h <Plug>(go-doc-split)
482
+" autocmd FileType go nmap <localleader>H <Plug>(go-doc-browser)
483
+" autocmd FileType go nmap <localleader>i <Plug>(go-info)
484
+" autocmd FileType go nmap <localleader>I <Plug>(go-implements)
485
+" autocmd FileType go nmap <localleader>j <Plug>(go-describe)
486
+" autocmd FileType go nmap <localleader>k <Plug>(go-referrers)
487
+" autocmd FileType go nmap <localleader>l <Plug>(go-lint)
488
+" autocmd FileType go nmap <localleader>m <Plug>(go-metalinter)
489
+" autocmd FileType go nmap <localleader>n <Plug>(go-install)
490
+" autocmd FileType go nmap <localleader>o <Plug>(go-rename)
491
+" autocmd FileType go nmap <localleader>p <Plug>(go-import)
492
+" autocmd FileType go nmap <localleader>P <Plug>(go-deps)
493
+" autocmd FileType go nmap <localleader>r <Plug>(go-run-split)
494
+" autocmd FileType go nmap <localleader>R <Plug>(go-run)
495
+" autocmd FileType go nmap <localleader>s <Plug>(go-def-stack)
496
+" autocmd FileType go nmap <localleader>S <Plug>(go-def-clear)
497
+" autocmd FileType go nmap <localleader>t <Plug>(go-test-func)
498
+" autocmd FileType go nmap <localleader>T <Plug>(go-test)
499
+" autocmd FileType go nmap <localleader>v <Plug>(go-vet)
500
+" autocmd FileType go nmap <localleader>V <Plug>(go-freevars)
501
+" autocmd FileType go nmap <localleader>y <Plug>(go-coverage)
502
+" autocmd FileType go nmap <localleader>Y <Plug>(go-coverage-clear)
503
+" autocmd FileType go nmap <localleader>z <Plug>(go-callstack)
475 504
 "}}}
476 505
 """""" python language {{{
477 506
 autocmd BufWritePost *.py :Isort

+ 35
- 0
languages/nim/user.yml View File

@@ -0,0 +1,35 @@
1
+---
2
+
3
+- hosts: localhost
4
+  connection: local
5
+  become: false
6
+
7
+  vars:
8
+    version: "0.17.0"
9
+
10
+  tasks:
11
+
12
+  - shell: test -f ~/bin/nim
13
+    register: nim_exists
14
+    ignore_errors: True
15
+
16
+  - name: Downloading nim
17
+    get_url: url="https://nim-lang.org/download/nim-{{version}}.tar.xz" dest="{{playbook_dir}}/nim-{{version}}.tar.xz"
18
+    when: (nim_exists|failed)
19
+
20
+  - name: Extracting nim
21
+    unarchive: src="{{playbook_dir}}/nim-{{version}}.tar.xz" dest="{{playbook_dir}}/"
22
+    when: (nim_exists|failed)
23
+
24
+  - name: Compiling nim
25
+    shell: "cd nim-{{version}}; sh build.sh; bin/nim c koch; ./koch tools"
26
+    when: (nim_exists|failed)
27
+
28
+  - name: Installing nim
29
+    file: src="{{playbook_dir}}/nim-{{version}}/bin/{{item}}" dest="~/bin/{{item}}" state="link"
30
+    with_items:
31
+      - nim
32
+      - nimble
33
+      - nimgrep
34
+      - nimsuggest
35
+

+ 16
- 5
tools/aliases/aliases View File

@@ -191,7 +191,7 @@ alias wrest="watchmedo auto-restart"
191 191
 alias ja="java"
192 192
 alias jac="javac"
193 193
 alias jaj="java -jar"
194
-## Groovy
194
+# ## Groovy
195 195
 # alias gro="groovy"
196 196
 # alias gron="groovy -n"
197 197
 # alias grop="groovy -p"
@@ -238,7 +238,21 @@ alias hp="stack repl --test --bench"
238 238
 alias hj="stack ghci --ghci-options -XOverloadedStrings"
239 239
 alias hrc="$EDITOR ~/.stack/config.yaml"
240 240
 ## Go
241
-alias mygo="cd $GOREPO"
241
+# alias mygo="cd $GOREPO"
242
+## Nim
243
+alias n="nim"
244
+alias nb="nimble"
245
+alias nbt="nimble init"
246
+alias nbt="nimble tasks"
247
+alias nbs="nimble search"
248
+alias nbp="nimble publish"
249
+alias nbi="nimble install"
250
+alias nbu="nimble uninstall"
251
+alias nd="nim doc2"
252
+alias nk="nim check"
253
+alias nc="nim compile -w:on"
254
+alias nr="nim compile --run -w:on"
255
+alias no="nim --compileOnly -w:on"
242 256
 ## Pip
243 257
 alias pp="pip"
244 258
 alias ppl="pip list"
@@ -263,9 +277,6 @@ alias pi="ptpython"
263 277
 alias pss="python setup.py"
264 278
 alias ptd="python -m doctest"
265 279
 alias ptu="python -m unittest"
266
-## Julia
267
-alias j="julia"
268
-alias je="julia -E"
269 280
 ## Jupyter
270 281
 alias pnp="ipcluster start -n $(nproc)"
271 282
 alias pn="jupyter-notebook --profile=fmind --NotebookApp.token="