WIP
This commit is contained in:
parent
d66e56ed45
commit
c3f6a03349
9 changed files with 123 additions and 35 deletions
|
|
@ -49,7 +49,12 @@ endfunction
|
||||||
|
|
||||||
|
|
||||||
function! features#info#web()
|
function! features#info#web()
|
||||||
|
let current_word = expand("<cword>")
|
||||||
|
if modules#isGlobalImport(current_word)
|
||||||
|
call util#open_module_doc(current_word, "")
|
||||||
|
else
|
||||||
call suggest#New("def", 0, 0, s:New(1))
|
call suggest#New("def", 0, 0, s:New(1))
|
||||||
|
endif
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,5 +83,17 @@ function! modules#FindGlobalImports()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! modules#moduleLocation(str)
|
||||||
|
if has_key(modules#FindGlobalImports(), a:str)
|
||||||
|
return modules#FindGlobalImports()[a:str]
|
||||||
|
endif
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! modules#isGlobalImport(str)
|
||||||
|
return has_key(modules#FindGlobalImports(), a:str)
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
let &cpo = s:save_cpo
|
let &cpo = s:save_cpo
|
||||||
unlet s:save_cpo
|
unlet s:save_cpo
|
||||||
|
|
|
||||||
|
|
@ -285,6 +285,11 @@ function! util#SelectNimProc(inner)
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
|
function! util#goto_file()
|
||||||
|
let module_loc = modules#moduleLocation(expand("<cword>"))
|
||||||
|
endfunction
|
||||||
|
|
||||||
|
|
||||||
call operator#user#define('nimrepl_send', 'NimReplSend')
|
call operator#user#define('nimrepl_send', 'NimReplSend')
|
||||||
function! NimReplSend(motion_wiseness)
|
function! NimReplSend(motion_wiseness)
|
||||||
let start = getpos("'[")
|
let start = getpos("'[")
|
||||||
|
|
|
||||||
62
doc/nim.txt
62
doc/nim.txt
|
|
@ -4,7 +4,7 @@
|
||||||
==============================================================================
|
==============================================================================
|
||||||
CONTENTS *nim-contents*
|
CONTENTS *nim-contents*
|
||||||
|
|
||||||
1.Intro.................................................|NimIntro|
|
1.Introduction..........................................|NimIntro|
|
||||||
2.Features..............................................|NimFeatures|
|
2.Features..............................................|NimFeatures|
|
||||||
2.1.Syntax highlighting.............................|NimSyntaxHL|
|
2.1.Syntax highlighting.............................|NimSyntaxHL|
|
||||||
2.2.Nimsuggest interaction..........................|NimSuggest|
|
2.2.Nimsuggest interaction..........................|NimSuggest|
|
||||||
|
|
@ -21,20 +21,78 @@ CONTENTS *nim-contents*
|
||||||
6.License...............................................|NimLicense|
|
6.License...............................................|NimLicense|
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
1.Intro *NimIntro*
|
1.Introduction *NimIntro*
|
||||||
|
|
||||||
==============================================================================
|
==============================================================================
|
||||||
2.Features *NimFeatures*
|
2.Features *NimFeatures*
|
||||||
|
- It's... Asynchronous!
|
||||||
|
- Syntax highlighting
|
||||||
|
- Normal vim highlight
|
||||||
|
- More intelligent highlight with nimsuggest
|
||||||
|
- Semantic highlighting for specified nim symbol kinds
|
||||||
|
- Indentation
|
||||||
|
- Error checking
|
||||||
|
- Using ``:make``
|
||||||
|
- Neomake
|
||||||
|
- Project navigation with nimsuggest
|
||||||
|
- Jump to definition
|
||||||
|
- Get symbol information (type, module, file, signature, etc...)
|
||||||
|
- Find usages (file and/or project)
|
||||||
|
- Autocompletion
|
||||||
|
- Nimsuggest omnicompletion
|
||||||
|
- Autocomplete module names
|
||||||
|
- IDE like stuff
|
||||||
|
- Outline listing all symbols in the module (like tagbar)
|
||||||
|
- Jump to documentation in web
|
||||||
|
- Refactoring
|
||||||
|
- Rename symbol in file or project
|
||||||
|
- REPL
|
||||||
|
- Open repl
|
||||||
|
- Send current buffer
|
||||||
|
- Send selection
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
2.1.Syntax highlighting *NimSyntaxHL*
|
2.1.Syntax highlighting *NimSyntaxHL*
|
||||||
|
|
||||||
|
2.1.1Intelligent with nimsuggest *NimSyntaxHLI*
|
||||||
|
|
||||||
|
Nimsuggest has the ability to highlight symbols in a buffer intelligently.
|
||||||
|
When you declare your on proc it gives you the highlight information for
|
||||||
|
every usage of that proc. When your routine call fails, your syntax
|
||||||
|
highlighting will fail too.
|
||||||
|
|
||||||
|
2.1.2Semantic highlighting *NimSyntaxHLI*
|
||||||
|
|
||||||
|
With the nimsuggest highlihgting it is possible to distinguish between
|
||||||
|
different symbol types. You can specify which symbol kinds you want to
|
||||||
|
be highlighted by hash made from their name.
|
||||||
|
|
||||||
|
In case of
|
||||||
|
|
||||||
|
for idx 1..10:
|
||||||
|
for jdx 1..0:
|
||||||
|
(idx * jdx).echo
|
||||||
|
|
||||||
|
all cases of idx will be highlighted with their own random color and jdx
|
||||||
|
with their own.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
2.2.Nimsuggest interaction *NimSuggest*
|
2.2.Nimsuggest interaction *NimSuggest*
|
||||||
|
|
||||||
|
Nimsuggest is a tool replacing the original nim idetools. This plugin
|
||||||
|
aims to use information given from nimsuggest to the fullest.
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
2.1.Get symbol information *NimSInfo*
|
2.1.Get symbol information *NimSInfo*
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
2.2.Goto symbol *NimSGoto*
|
2.2.Goto symbol *NimSGoto*
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,2 +1,3 @@
|
||||||
scriptencoding utf-8
|
scriptencoding utf-8
|
||||||
au BufNewFile,BufRead *.nims,*.nim setlocal filetype=nim
|
au BufNewFile,BufRead *.nim setlocal filetype=nim
|
||||||
|
au BufNewFile,BufRead *.nims setlocal filetype=nims
|
||||||
|
|
|
||||||
|
|
@ -40,16 +40,19 @@ command! -buffer -nargs=* -complete=buffer -range NimREPLEval :call features
|
||||||
|
|
||||||
if exists('g:nvim_nim_enable_default_binds')
|
if exists('g:nvim_nim_enable_default_binds')
|
||||||
nnoremap <buffer> <c-]> :NimDefinition<cr>
|
nnoremap <buffer> <c-]> :NimDefinition<cr>
|
||||||
|
nnoremap <buffer> gf :call util#goto_file()<cr>
|
||||||
nnoremap <buffer> gd :NimDefinition<cr>
|
nnoremap <buffer> gd :NimDefinition<cr>
|
||||||
nnoremap <buffer> gt :NimInfo<cr>
|
nnoremap <buffer> gt :NimInfo<cr>
|
||||||
nnoremap <buffer> gT :NimWeb<cr>
|
nnoremap <buffer> gT :NimWeb<cr>
|
||||||
|
nnoremap <buffer> cr :NimRenameSymbol<cr>
|
||||||
|
nnoremap <buffer> cR :NimRenameSymbolProject<cr>
|
||||||
endif
|
endif
|
||||||
|
|
||||||
if exists('g:nvim_nim_enable_custom_textobjects')
|
if exists('g:nvim_nim_enable_custom_textobjects')
|
||||||
onoremap <buffer> <silent>af :<C-U>call util#SelectNimProc(0)<CR>
|
onoremap <buffer> <silent>af :<C-U>call util#SelectNimProc(0)<cr>
|
||||||
onoremap <buffer> <silent>if :<C-U>call util#SelectNimProc(1)<CR>
|
onoremap <buffer> <silent>if :<C-U>call util#SelectNimProc(1)<cr>
|
||||||
vnoremap <buffer> <silent>af :<C-U>call util#SelectNimProc(0)<CR><Esc>gv
|
vnoremap <buffer> <silent>af :<C-U>call util#SelectNimProc(0)<cr><Esc>gv
|
||||||
vnoremap <buffer> <silent>if :<C-U>call util#SelectNimProc(1)<CR><Esc>gv
|
vnoremap <buffer> <silent>if :<C-U>call util#SelectNimProc(1)<cr><Esc>gv
|
||||||
endif
|
endif
|
||||||
|
|
||||||
augroup nvim_nim_highlighter
|
augroup nvim_nim_highlighter
|
||||||
|
|
|
||||||
|
|
@ -30,7 +30,7 @@ function! FindNimModulesPath()
|
||||||
endfunction
|
endfunction
|
||||||
|
|
||||||
if exists("g:ycm_semantic_triggers")
|
if exists("g:ycm_semantic_triggers")
|
||||||
let g:ycm_semantic_triggers["nim"] = ['.', '(']
|
let g:ycm_semantic_triggers["nim"] = ['.']
|
||||||
endif
|
endif
|
||||||
|
|
||||||
let g:nvim_nim_enable_async = has("nvim")
|
let g:nvim_nim_enable_async = has("nvim")
|
||||||
|
|
|
||||||
|
|
@ -36,7 +36,7 @@ syntax keyword nimTodo TODO FIXME
|
||||||
|
|
||||||
" Operators
|
" Operators
|
||||||
syntax match nimOperatorAll "[&:?!@<>\|\~\.\^\=\/\+\-\*\$%]\+"
|
syntax match nimOperatorAll "[&:?!@<>\|\~\.\^\=\/\+\-\*\$%]\+"
|
||||||
syntax keyword nimOperator and or not xor shl shr div mod notin is isnot .
|
syntax keyword nimOperator not xor shl shr div mod notin is isnot .
|
||||||
syntax keyword nimOP9 div mod shl shr
|
syntax keyword nimOP9 div mod shl shr
|
||||||
syntax keyword nimOP5 notin is isnot not
|
syntax keyword nimOP5 notin is isnot not
|
||||||
syntax keyword nimOP4 and
|
syntax keyword nimOP4 and
|
||||||
|
|
@ -148,17 +148,6 @@ highlight link nimFunction Function
|
||||||
highlight link nimIdentifier Identifier
|
highlight link nimIdentifier Identifier
|
||||||
highlight link nimKeyword Keyword
|
highlight link nimKeyword Keyword
|
||||||
highlight link nimNumber Number
|
highlight link nimNumber Number
|
||||||
highlight link nimOP0 Operator0
|
|
||||||
highlight link nimOP1 Operator1
|
|
||||||
highlight link nimOP10 Operator10
|
|
||||||
highlight link nimOP2 Operator2
|
|
||||||
highlight link nimOP3 Operator3
|
|
||||||
highlight link nimOP3 Operator4
|
|
||||||
highlight link nimOP5 Operator5
|
|
||||||
highlight link nimOP6 Operator6
|
|
||||||
highlight link nimOP7 Operator7
|
|
||||||
highlight link nimOP8 Operator8
|
|
||||||
highlight link nimOP9 Operator9
|
|
||||||
highlight link nimOperatorAll Operator
|
highlight link nimOperatorAll Operator
|
||||||
highlight link nimString String
|
highlight link nimString String
|
||||||
highlight link nimStringLiterals Character
|
highlight link nimStringLiterals Character
|
||||||
|
|
|
||||||
15
syntax/nims.vim
Normal file
15
syntax/nims.vim
Normal file
|
|
@ -0,0 +1,15 @@
|
||||||
|
scriptencoding utf-8
|
||||||
|
|
||||||
|
if version < 600
|
||||||
|
syntax clear
|
||||||
|
elseif exists("b:current_syntax")
|
||||||
|
finish
|
||||||
|
endif
|
||||||
|
|
||||||
|
syntax keyword nimTypedef task
|
||||||
|
syntax keyword nimBuiltinFunction exec
|
||||||
|
syntax keyword nimStorage build tests bench
|
||||||
|
|
||||||
|
so <sfile>:p:h/nim.vim
|
||||||
|
|
||||||
|
let b:current_syntax = "nims"
|
||||||
Loading…
Add table
Add a link
Reference in a new issue