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:
Zahary Karadjov 2016-05-19 19:50:46 +03:00
commit dcf25798f4
5 changed files with 8 additions and 14 deletions

View file

@ -1,5 +1,5 @@
let g:nim_log = []
let s:plugin_path = escape(expand('<sfile>:p:h'), ' \')
let s:plugin_path = escape(expand('<sfile>:p:h'), '\')
if !exists("g:nim_caas_enabled")
let g:nim_caas_enabled = 0
@ -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']

View file

@ -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) + '"')