zah / nim.vim Goto Github PK
View Code? Open in Web Editor NEWThis project forked from vim-scripts/nimrod.vim
Nim language plugin for vim
License: MIT License
This project forked from vim-scripts/nimrod.vim
Nim language plugin for vim
License: MIT License
If I open a file like lib/system.nim
with vim, then in another terminal try to jump to the definition of newException
the session seems hanged. What actually happens is that vim is trying to display the "You are already editing file blah, press R to rm -fR /, e to reload the file in read only mode" but there is no visual cue about this. Usually pressing enter is enough to continue in read only mode, but the problem is you have no indication of what is happening, so you end up waiting, waiting, waiting, and sometimes wondering "that's taking too long".
Given the following snippet of code:
if state.debug_idetools:
if not state.server_mode:
output.add(ATT_NL & "command: " &
XMLEncode(idetools_args(state,
state.procs[index].line,
state.procs[index].col).join(" ")))
pressing enter at the end will put the cursor aligned with state
, and typing else:
will autoalign the else:
with the column starting with XMLEncode
. It would be better if the indentation went back to the first found if
starting a column.
When I loaded the plugin I needed to add "set sw=2" to indent/nim.vim otherwise the default was 8, did I miss something or is this a bug?
If I edit the file ./hello.nim
syntastic works perfectly, but if I edit ./test/hello_test.nim
and vim CWD is ./
syntastic won't work for ./test/hello_test.nim
.
I guess that this has something to do with the fact that nim check --hints:off test/hello_test.nim
outputs
hello_test.nim(5, 1) Error: value of type 'bool' has to be discarded
instead of
test/hello_test.nim(5, 1) Error: value of type 'bool' has to be discarded
and this somehow confuses buffers.
When I write code like:
import test.nim
I can position the vim cursor on the test.nim
string and press gf
to open it. Without the extension, however, the command doesn't work. It would be nice if the plugin could detect this and automatically add the expected extension.
nim-lang/Nim@9e6fb3f removed support for the nim idetools subcommand that your GotoDefinition_nim requires. Maybe there is some nimsuggest
alternative?
When opening a test .nim file using Vim or GVim 7.4 on Ubuntu 14.10:
"test.nim" [New File]
Error detected while processing /home/.vim/bundle/nimrod.vim/autoload/nim.vim:
line 9:
the Nim compiler must be in your system's PATH
The nim compiler is definitely in the PATH (I can call it without issues), and this error even appears when I set vim to silent. The issue doesn't occur on a similar installation on OS X.
Also, I should note the syntax and indentation is working as expected, there is just a spurious error when launching.
I use vundle already and have C and Python packages installed.
I install zah/nimrod.vim without issue. Add the extra lines to my .vimrc. No auto-indent, K goes to a shell request, very little highlighting (just comments really), and until I added
au BufRead,BufNewFile *.nim set ts=2 sw=2 sts=2 expandtab autoindent
to my vimrc the tabs were tabs etc.
I'm running ubuntu 14.04 with Gnome 3.12 and Vim 7.4. Hmmm - my shell is zsh. I tried going to a minimal vimrc and then I tried dropping 7.4 and installing 7.3 from debs instead. No change.
I suspect I'm doing something amazingly stupid but I don't know what it is. Any ideas on how I could test it or provide better feedback.
It should be:
mkdir -p ~/.vim/autoload ~/.vim/bundle && \
curl -LSso ~/.vim/autoload/pathogen.vim https://tpo.pe/pathogen.vim
Taken from the pathogen README.
Entering the comment char #
in a type definition makes the cursor jump to the first column. For example:
type
Foo = object
|
If |
represents, the cursor, entering a #
in insert mode will result in
type
Foo = object
#
As opposed to:
type
Foo = object
#
This only seems to happen if #
is the first character entered on that line. If you enter another character, backspace, and then enter a #
, the cursor stays in place.
Hello
I have installed nim.vim, but every time I try to edit a nim file, the next error message appears.
Any ideas?
Error detected while processing /Users/teras/.vim/bundle/nim.vim/autoload/nim.vim:
line 15:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/Users/teras/.vim/bundle/nim.vim/autoload/nim_vim.py", line 2, in <module>
import threading, subprocess, signal, os, platform, getpass
File "/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/threading.py", line 13, in <module>
from collections import deque as _deque
File "/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/collections.py", line 20, in <module>
from _collections import deque, defaultdict
ImportError: dlopen(/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_collections.so, 2): no suitable image f
ound. Did find:
^I/usr/local/Cellar/python@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_collections.so: code signature in (/usr/local/Cellar/pyth
on@2/2.7.17_1/Frameworks/Python.framework/Versions/2.7/lib/python2.7/lib-dynload/_collections.so) not valid for use in process using Library Validation: mapped fil
e has no cdhash, completely unsigned? Code has to be at least ad-hoc signed.
Press ENTER or type command to continue
Error detected while processing function nim#init:
line 6:
E117: Unknown function: json_decode
E15: Invalid expression: json_decode(raw_dumpdata)
I get this error on a system using VIM 7.4
since commit dce4bab
Example where syntax recognition fails:
var x = 0'i32 # this is not recognized as comment (wrong color)
The plugin doesn't detect correctly the main project file despite starting to use idetools from it. See the following steps:
$ git clone https://github.com/dom96/ipsumgenera.git
$ cd ipsumgenera
$ git checkout fca1d7c100e06c2d4c900e4e75e50931a06e583d
$ vim ipsum.nim
/renderRst<enter>
:call JumpToDef() -> opens src/rstrender.nim
advance cursor to any type (like string) and :call JumpToDef()
At this point any jump query inside rstrender.nim
will fail with SIGSEGV: Illegal storage access. (Attempt to read from nil?)
. The reason for this is that the file doesn't compile without special parameters, which are present in the root ipsum.nimrod.cfg
file. The parameters add the required path switches to find the rst related modules. This can be seen running nimrod check src/rstrender.nim
which doesn't find the types either and at some point crashes.
Another way to see the problem is to manually run the query stored in the log replacing the project file with ipsum.nim
so it works, like
nimrod idetools --def --track:"/private/tmp/ipsumgenera/src/rstrender.nim,205,22" ipsum.nim
I wonder if this situation can be autodetected better. If not, would it be valid to help the vim plugin with explicit files? Maybe the plugin could look for .vim.idetools.proj
files which would be symbolic links to the correct main .nim
file?
is there an integration with the tagbar plugin which also uses ctags?
It is weird that vim knows a set of keywords which have to be highlited, but they are not used for autocompletion when pressing Ctrl+P. Is there any vim option to make these keywords available for Ctrl+P?
I'm new to nim, but when I try to use threading mechanisms like TThread
, I get the error undeclared identifier: 'TThread'
. I believe this is because you must compile with --threads:on
. How does one do that with this plugin?
I've noticed that hitting tab results in a very long indentation--twice as long as expected, to be exact. (I.e., eight spaces rather than four.) I'm having a hard time figuring out how to change this. I thought maybe this is a more general setting in Vim rather than a Nim-specific one, but I've only noticed it when writing Nim.
Sorry, just discovered this was already noted in Issue #34.
Hi,
It has been a decade since the last tag/release found here
Could you please add a new one with all the new features and files?
Thanks
Upon installing this plugin and opening a nim file, I don't seem to get any syntax checking via syntastic. Running :SyntasticInfo
yields the following:
Syntastic version: 3.9.0-23 (Vim 800, Neovim, Linux)
Info for filetype: nim
Global mode: active
Filetype nim is active
The current file will be checked automatically
Available checkers: -
Currently enabled checkers: -
So syntastic reports no available checkers. Is there any setup required here?
To get it working in Termux (which defaults to Python 3, as everything should), I had to:
apt install vim-python
~/.vim/bundle/nim.vim/autoload/nim.vim: replace the "pyfile" line with:
exe 'py3file ' . fnameescape(s:plugin_path) . '/nim_vim.py'
~/.vim/bundle/nim.vim/autoload/nim_vim.py: remove Queue from the import line, and add:
from multiprocessing import Queue
Are there any plans to implement some sort of quickfix window formatting so that we can jump to lines referenced in compiler output?
When opening a nimscript file (*.nims) into vim, all "exec" statements are executed. This makes editing nimscript files very impractical, and poses a huge security risk.
example.nims:
exec "touch a_wild_file_appears.txt"
exec "rm -r ~/my_important_projects"
This seems to occur in autoload/nim.vim:nim#init:
let cmd = printf("nim --dump.format:json --verbosity:0 dump %s", s:CurrentNimFile())
let raw_dumpdata = system(cmd)
My current workaround is to comment out the whole function call in ftplugin/nim.vim:
"call nim#init()
Thanks for your time.
i use neovim, and when i close file *.nim, an error occurs.
it won't affect something, but i want to make it go away.
what should i do?
It seems that detecting the .babel
extension should be easy and the syntax would be that of a config file (see example at https://github.com/nimrod-code/babel).
In the project readme there's a reference that this plugin adds smart indent and I was wondering if there was an option to configure said indent or just disable the version provided by this plug in as the default is 2 spaces but I personally always use 4.
I'm sorry I can't provide a PR for this but I suck at vimscript and syntax config.
Hi and thank you for developing nim.vim
Can you please add a help page on how to use the features, especially:
Hey this plugin looks awesome. That said, I can't use it :( I installed it the way described in the readme. Currently on a MacBook Pro OSX El Capitan 10.11.5 (15F34).
Tested with:
NVIM 0.1.5
VIM - Vi IMproved 7.3 (2010 Aug 15, compiled Apr 5 2016 14:53:37)
both with spf13 installs.
Here's what I see when opening up one of my nim files:
Should be renamed.
Presuming source code filters use the .tmpl
extension it would be nice if the syntax highlighting could be applied despite all the actual nimrod code being behind a first column of hashes styling everything else as comment. Though it would be even more useful if there was a keyboard mapping to invert the syntax highlighting to the nimrod code or to the other code, using some default for C/HTML/JS syntax.
With this keyboard mapping you could decide what part of the code you want to focus on and the highlighting would follow.
When opening a nim file in vim on Windows the nim plugin issues an error:
"C:\Nim\nimsuggest\nimsuggest.nim" 414L, 12172C
Error detected while processing C:\Users\Username.vim\bundle\nim.vim\autoload\nim.vim:
line 12:
Traceback (most recent call last):
File "", line 1, in
File "C:\Users\Username.vim\bundle\nim.vim\autoload/nim_vim.py", line 78, in
NimLog = open("/tmp/nim-log.txt", "w")
This is because the path /tmp
does not exist on Windows, or at least that's generally not where you'd want to store temporary files on Windows...
g:SyntasticRegistry
is not defined in an environment without syntastic.
Hi, Its not clear to me how to install this. Please forgive me if i am ignorant. I just copy paste the whole code into cmd and it says - "The syntax of the command is incorrect."
I know, i did something wrong. So please explain as step by step process ?
i.e. 4'u8
it treats it as an un-closed string/char
After installing the Nim compiler to my PATH and installing nim.vim, on opening a nim buffer I get this error:
Error detected while processing /Users/dave/.vim/bundle/nim.vim/autoload/nim.vim:
line 12:
E117: Unknown function: provider#python#Call
My vim was not compiled with the python flag. Do you think that's the cause, or is this something else?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.