merge various improvements from https://github.com/Angluca
* recognize NimScript files * automatically set up tab width in Nim buffers * remove the NimLog in the python module, which is just a debugging aid
This commit is contained in:
parent
7adbb71442
commit
dcf25798f4
5 changed files with 8 additions and 14 deletions
|
|
@ -14,7 +14,7 @@ exe 'pyfile ' . fnameescape(s:plugin_path) . '/nim_vim.py'
|
|||
fun! nim#init()
|
||||
let cmd = printf("nim --dump.format:json --verbosity:0 dump %s", s:CurrentNimFile())
|
||||
let raw_dumpdata = system(cmd)
|
||||
if !v:shell_error
|
||||
if !v:shell_error && expand("%:e") == "nim"
|
||||
let dumpdata = eval(substitute(raw_dumpdata, "\n", "", "g"))
|
||||
|
||||
let b:nim_project_root = dumpdata['project_path']
|
||||
|
|
|
|||
|
|
@ -75,13 +75,6 @@ def nimRestartService(project):
|
|||
nimTerminateService(project)
|
||||
nimStartService(project)
|
||||
|
||||
NimLog = None
|
||||
if platform.system() == 'Windows':
|
||||
user = getpass.getuser()
|
||||
NimLog = open("C:\\Users\\%s\\AppData\\Local\\Temp\\nim-log.txt" % (user,), "w")
|
||||
else:
|
||||
NimLog = open("/tmp/nim-log.txt", "w")
|
||||
|
||||
def nimExecCmd(project, cmd, async = True):
|
||||
target = None
|
||||
if NimProjects.has_key(project):
|
||||
|
|
@ -90,9 +83,6 @@ def nimExecCmd(project, cmd, async = True):
|
|||
target = nimStartService(project)
|
||||
|
||||
result = target.postNimCmd(cmd, async)
|
||||
if result != None:
|
||||
NimLog.write(result)
|
||||
NimLog.flush()
|
||||
|
||||
if not async:
|
||||
vim.command('let l:py_res = "' + nimVimEscape(result) + '"')
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ endif
|
|||
let s:cpo_save = &cpo
|
||||
set cpo-=C
|
||||
|
||||
CompilerSet makeprg=nim\ c\ $*
|
||||
CompilerSet makeprg=nim\ c\ --verbosity:0\ $*\ %:p
|
||||
|
||||
CompilerSet errorformat=
|
||||
\%-GHint:\ %m,
|
||||
|
|
|
|||
|
|
@ -1,2 +1,2 @@
|
|||
au BufNewFile,BufRead *.nim set filetype=nim
|
||||
au BufNewFile,BufRead *.nim,*.nims set filetype=nim
|
||||
|
||||
|
|
|
|||
|
|
@ -16,6 +16,10 @@ setlocal omnifunc=NimComplete
|
|||
setlocal suffixesadd=.nim
|
||||
setlocal expandtab "Make sure that only spaces are used
|
||||
|
||||
setl tabstop=2
|
||||
setl softtabstop=2
|
||||
setl shiftwidth=2
|
||||
|
||||
compiler nim
|
||||
|
||||
let &cpo = s:cpo_save
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue