Some more work

This commit is contained in:
baabelfish 2016-01-30 20:10:24 +02:00
commit a63b9b895a
6 changed files with 90 additions and 58 deletions

View file

@ -1,19 +1,30 @@
# nvim-nim # nvim-nim
Attempt at writing an async outline/structure listing/navigator for files/modules. Nim support for Neovim
# TODO # TODO
- [ ] Add global options for user
- [ ] Doc
- [ ] Bindings
- [ ] Options
- [ ] Commands
- [ ] Using with other plugins
- [ ] Syntax - [ ] Syntax
- [ ] Keywords - [x] Keywords
- [ ] Operator precedence different colors - [x] Operator precedence different colors
- [x] Numbers
- [ ] String
- [ ] Multiline comments
- [ ] Highlight variable names semantically
- [ ] Indendation - [ ] Indendation
- [ ] Compiler support - [ ] Compiler support
- [ ] Make for errors - [ ] Make for errors
- [ ] Autocompletion - [ ] Omnicomplete
- [x] Nimsuggest - [x] Nimsuggest
- [x] Usages - [x] Usages
- [x] Jump to definition - [x] Jump to definition
- [x] Show typeinfo - [x] Show typeinfo
- [x] Outline - [x] Outline
- [x] Highlight
- [x] Commands - [x] Commands
- [x] NimDefinition - [x] NimDefinition
- [x] NimOutline - [x] NimOutline
@ -22,15 +33,14 @@ Attempt at writing an async outline/structure listing/navigator for files/module
- [x] NimUsagesProject - [x] NimUsagesProject
- [x] NimRenameSymbol - [x] NimRenameSymbol
- [ ] NimRenameSymbolProject - [ ] NimRenameSymbolProject
- [ ] IDE features
# TODO For advanced - [ ] Auto complete modules
- [ ] Syntax with nim compiler highlight using matchaddpos ??
- [ ] Highlight variable names semantically
- [ ] Outline with unite - [ ] Outline with unite
- [ ] Outline with proper tagbar - [ ] Outline with a proper tagbar
- [ ] Usages with unite - [ ] Usages with unite
- [ ] Autocompletion with ycm - [ ] Autocompletion with ycm
- [ ] Autocompletion with deoplete - [ ] Autocompletion with deoplete
- [ ] REPL interaction
# BUGS # BUGS
- [ ] Not all lines are read from stdin for some reason with job-control - [ ] Not all lines are read from stdin for some reason with job-control

View file

@ -13,11 +13,11 @@ function! s:InfoImpl.run(data)
let [_, ctype, name, type, filename, l, c, doc] = split(a:data.lines[0], " ") let [_, ctype, name, type, filename, l, c, doc] = split(a:data.lines[0], " ")
echohl Function | echon "Type" echohl Function | echon "Type"
echohl Comment | echon ": " echohl Comment | echon ": "
echohl Statement | echon type echohl Typedef | echon type
endif endif
endfunction endfunction
function! feature#info#run() function! features#info#run()
call suggest#New("def", 0, s:InfoImpl) call suggest#New("def", 0, s:InfoImpl)
endfunction endfunction

View file

@ -38,6 +38,3 @@ function! features#usages#run(findInProject)
let s:findInProject = a:findInProject let s:findInProject = a:findInProject
call suggest#New("use", 1, s:UsagesImpl) call suggest#New("use", 1, s:UsagesImpl)
endfunction endfunction

View file

@ -90,7 +90,7 @@ endfunction
function! highlighter#guard() function! highlighter#guard()
" if line("$") + 0 < 500 if line("$") + 0 < 500
" call highlighter#New() call highlighter#New()
" endif endif
endfunction endfunction

View file

@ -27,7 +27,7 @@ function! util#JumpToLocation(file, line, col)
execute ":e " . a:file execute ":e " . a:file
endif endif
execute ":" . a:line execute ":" . a:line
execute ":norm " . a:col . "|" execute ":norm " . (a:col - 1) . "|"
endfunction endfunction

View file

@ -10,24 +10,23 @@ let b:current_syntax = "nim"
" Keywords " Keywords
syntax keyword nimKeyword let const var static syntax keyword nimKeyword let const var static
syntax keyword nimKeyword addr asm atomic bind cast converter syntax keyword nimKeyword addr asm atomic bind cast defer discard
syntax keyword nimKeyword defer discard distinct do end generic iterator syntax keyword nimKeyword do expr stmt end generic mixin iterator
syntax keyword nimKeyword typedesc out ptr raise ref return using with without yield syntax keyword nimKeyword typedesc openarray out ptr ref return using
syntax keyword nimKeyword varargs with without yield
" syntax keyword nimOperator for while " syntax keyword nimOperator for while
syntax keyword nimBoolean true false syntax keyword nimBoolean true false
syntax keyword nimConditional if elif else case continue break syntax keyword nimConditional if elif else case continue break
syntax keyword nimDefine from as syntax keyword nimDefine from as
syntax keyword nimException try except finally syntax keyword nimException try except finally raise
syntax keyword nimInclude import include export syntax keyword nimInclude import include export
syntax keyword nimLabel of syntax keyword nimLabel of
syntax keyword nimMacro macro syntax keyword nimMacro macro
syntax keyword nimPreCondit when block syntax keyword nimPreCondit when block
syntax keyword nimPreProc nil syntax keyword nimStorage tuple enum object interface concept distinct any
syntax keyword nimRepeat for while
syntax keyword nimStorage tuple enum object interface concept mixin
syntax keyword nimStorageClass type syntax keyword nimStorageClass type
syntax keyword nimTypedef func proc method template syntax keyword nimTypedef func proc method template converter
syntax keyword nimTodo TODO FIXME syntax keyword nimTodo TODO FIXME
@ -54,10 +53,34 @@ syntax match nimOP0 "\->"
syntax match nimComment "\v#.*$" contains=nimTodo syntax match nimComment "\v#.*$" contains=nimTodo
" Builtin syntax keyword nimBuiltinFunction assert echo debugEcho GC_addCycleRoot GC_disable
syntax keyword nimBuiltinFunction echo debugEcho syntax keyword nimBuiltinFunction GC_disableMarkAndSweep GC_enable GC_enableMarkAndSweep GC_fullCollect GC_getStatistics
syntax keyword nimBuiltinFunction GC_ref GC_setStrategy GC_unref abs add addAndFetch addQuitProc alloc alloc0 allocCStringArray
syntax keyword nimBuiltinFunction allocShared allocShared0 astToStr atomicDec atomicInc card cas chr clamp close cmp
syntax keyword nimBuiltinFunction compileOption compiles copy copyMem cpuRelax create createShared createSharedU
syntax keyword nimBuiltinFunction createU cstringArrayToSeq dealloc deallocCStringArray deallocShared debugEcho dec
syntax keyword nimBuiltinFunction declared declaredInScope deepCopy defined definedInScope del delete echo endOfFile
syntax keyword nimBuiltinFunction equalMem excl failedAssertImpl find finished flushFile freeShared gcInvariant getCurrentException
syntax keyword nimBuiltinFunction getCurrentExceptionMsg getFileHandle getFilePos getFileSize getFrame getFreeMem
syntax keyword nimBuiltinFunction getOccupiedMem getRefcount getStackTrace getTotalMem getTypeInfo gorge high inc
syntax keyword nimBuiltinFunction incl insert instantiationInfo internalNew isNil iterToProc len likely locals low
syntax keyword nimBuiltinFunction max min moveMem new newSeq newString newStringOfCap newWideCString onRaise open
syntax keyword nimBuiltinFunction ord pop pred procCall quit raiseAssert rawEnv rawProc readAll readBuffer readBytes
syntax keyword nimBuiltinFunction readChar readChars readFile readLine realloc reallocShared reopen repr reset resize
syntax keyword nimBuiltinFunction resizeShared safeAdd setControlCHook setCurrentException setFilePos setFrame setLen
syntax keyword nimBuiltinFunction setupForeignThreadGc shallow shallowCopy sizeof slurp stackTraceAvailable staticExec
syntax keyword nimBuiltinFunction staticRead substr succ swap toBiggestFloat toBiggestInt toFloat toInt toU16 toU32
syntax keyword nimBuiltinFunction toU8 unlikely unsafeAddr unsafeNew write writeBuffer writeBytes writeChars writeFile
syntax keyword nimBuiltinFunction writeLine writeLn writeStackTrace xlen ze ze64 zeroMem accumulateResult currentSourcePath
syntax keyword nimBuiltinFunction doAssert excl incl newException onFailedAssert stdmsg
syntax keyword nimBuiltinType seq
syntax keyword nimBuiltinIterators countdown countup fieldPairs fields items lines mitems mpairs pairs
syntax keyword nimBuiltinType int int8 int16 int32 int64 uint uint8 uint16 uint32 uint64 float float32 float64 bool char string cstring pointer Ordinal ptr ref expr stmt typedesc void auto any untyped typed SomeSignedInt SomeUnsignedInt SomeInteger SomeOrdinal SomeReal SomeNumber range array openArray varargs seq set Slice shared guarded byte Natural Positive RootObj RootRef RootEffect TimeEffect IOEffect ReadIOEffect WriteIOEffect ExecIOEffect Exception SystemError IOError OSError LibraryError ResourceExhaustedError ArithmeticError DivByZeroError OverflowError AccessViolationError AssertionError ValueError KeyError OutOfMemError IndexError FieldError RangeError StackOverflowError ReraiseError ObjectAssignmentError ObjectConversionError FloatingPointError FloatInvalidOpError FloatDivByZeroError FloatOverflowError FloatUnderflowError FloatInexactError DeadThreadError TResult Endianness TaintedString LibHandle ProcAddr ByteAddress BiggestInt BiggestFloat clong culong cchar cschar cshort cint csize clonglong cfloat cdouble clongdouble cuchar cushort cuint culonglong cstringArray PFloat32 PFloat64 PInt64 PInt32 GC_Strategy PFrame TFrame File FileMode FileHandle THINSTANCE AlignType RefCount Utf16Char WideCString NimNode
syntax keyword nimGlobals programResult globalRaiseHook localRaiseHook outOfMemHook stdin stdout stderr errorMessageWriter
syntax keyword nimGlobals nimvm
syntax keyword nimGlobals on off appType NoFakeVars isMainModule CompileDate CompileTime cpuEndian hostOS hostCPU QuitSuccess QuitFailure Inf NegInf NaN NimMajor NimMinor NimPatch NimVersion nativeStackTraceSupported
" Numbers " Numbers
@ -87,6 +110,7 @@ syntax match nimToken "\.)"
" Linking " Linking
highlight link nimBuiltinIterators Typedef
highlight link nimBuiltinFunction Function highlight link nimBuiltinFunction Function
highlight link nimBuiltinType Type highlight link nimBuiltinType Type
highlight link nimComment Comment highlight link nimComment Comment
@ -116,6 +140,7 @@ highlight link nimConditional Conditional
highlight link nimConstant Constant highlight link nimConstant Constant
highlight link nimDefine Define highlight link nimDefine Define
highlight link nimException Exception highlight link nimException Exception
highlight link nimGlobal Constant
highlight link nimInclude Include highlight link nimInclude Include
highlight link nimLabel Label highlight link nimLabel Label
highlight link nimMacro Macro highlight link nimMacro Macro