Page 1 of 4

How to setup VIM

Posted: Thu Dec 15, 2016 6:06 pm
by yetneverdone
Hi, im on linux. I already have vim installed and I want to use it fully for love2d.

Can anyone teach me how to set it up? Including:

Syntax Highlighting
Autocompletion
Colorscheme
Running the game

Thanks

Re: How to setup VIM

Posted: Thu Dec 15, 2016 7:18 pm
by borix134
http://www.vim.org/scripts/script.php?script_id=3169
Follow the instructions and/or find where the vim dictionaries are on your system, then add the Lua syntax highlighting. If the dictionary ports are not optimal, there are plenty of other Lua dictionary files for vim, a simple Google would work.
use:

Code: Select all

:syntax on
Perhaps append that to your vimrc
For running and building, make a shell script (something) like so:
(build.sh)

Code: Select all

zip main.lua asset.jpg game.love
love game.love
make the script executable
Its pretty similar on windows, from what I remember
then do in vim:
:!./build.sh
You may have to modify some things, but in concept, this is how it would work.

Re: How to setup VIM

Posted: Thu Dec 15, 2016 7:45 pm
by davisdude
yetneverdone wrote:Hi, im on linux. I already have vim installed and I want to use it fully for love2d.

Can anyone teach me how to set it up? Including:

Syntax Highlighting
Autocompletion
Colorscheme
Running the game

Thanks
I can handle some of those for you.

In regards to highlighting for Lua, it should already be installed. Make sure to put syntax on in your vimrc.

In regards to LOVE highlighting, I made a plugin called vim-love-docs which should handle that for you. It handles highlighting LOVE keywords, and you can also pull up documentation from within the editor by using the help files. For instance, if you can't remember the order of parameters for love.graphics.draw, just do :h love.graphics.draw and it'll pull up the help file in-browser.

For running your game, I have made something to handle that too: love-launch.

I've never used autocompletion in Vim, so I can't be much help there, but for the colorscheme I'm a big fan of Gruvbox. You can see a screenshot I posted recently here.

Re: How to setup VIM

Posted: Thu Dec 15, 2016 8:07 pm
by yetneverdone
davisdude wrote:
yetneverdone wrote:Hi, im on linux. I already have vim installed and I want to use it fully for love2d.

Can anyone teach me how to set it up? Including:

Syntax Highlighting
Autocompletion
Colorscheme
Running the game

Thanks
I can handle some of those for you.

In regards to highlighting for Lua, it should already be installed. Make sure to put syntax on in your vimrc.

In regards to LOVE highlighting, I made a plugin called vim-love-docs which should handle that for you. It handles highlighting LOVE keywords, and you can also pull up documentation from within the editor by using the help files. For instance, if you can't remember the order of parameters for love.graphics.draw, just do :h love.graphics.draw and it'll pull up the help file in-browser.

For running your game, I have made something to handle that too: love-launch.

I've never used autocompletion in Vim, so I can't be much help there, but for the colorscheme I'm a big fan of Gruvbox. You can see a screenshot I posted recently here.

where to put the vim-love-docs files?

Re: How to setup VIM

Posted: Thu Dec 15, 2016 8:14 pm
by davisdude
I didn't realize that you were entirely new to Vim. If you read the README file in the repo, you should be able to run a file within the src/ directory (the .sh file in your case, since you're on Linux). Then, you navigate back to the parent directory and copy the generated outputs (all but the src directory) and put them in the "vimfiles" directory. It may be something different if you're on Linux.

Given that you're just starting, you'll want a Plugin manager. You need to read up on how to configure these things to your liking. That's what makes Vim great, is that you make it work for you.

Re: How to setup VIM

Posted: Thu Dec 15, 2016 11:13 pm
by Inny
If you're completely brand new to Vim, I highly discourage it. Vim is not easy, and mastery takes a lot of effort. If you still want to try to learn vim, despite my attempt to dissuade you, then please run the vimtutor command first and dedicate about 30 minutes to it.

Re: How to setup VIM

Posted: Mon Mar 27, 2017 5:56 am
by yetneverdone
davisdude wrote: Thu Dec 15, 2016 8:14 pm I didn't realize that you were entirely new to Vim. If you read the README file in the repo, you should be able to run a file within the src/ directory (the .sh file in your case, since you're on Linux). Then, you navigate back to the parent directory and copy the generated outputs (all but the src directory) and put them in the "vimfiles" directory. It may be something different if you're on Linux.

Given that you're just starting, you'll want a Plugin manager. You need to read up on how to configure these things to your liking. That's what makes Vim great, is that you make it work for you.
Dude, need help. I've downloaded the love-docs, generated the files. I've put the "after/love-conf.vim and lua.vim" to my "~/.vim/syntax/" and put the "plugin/love.vim" to my "~/.vim/plugins"

When i run vim, no errors. But the syntax highlighting isnt working. Also, in my .vimrc file, ive out syntax on

EDIT: Ive tried typing "love.graphics.draw", the syntax highlighting worked. But how come it doesnt work in my existing lua files?
-bin-bash_259.png
-bin-bash_259.png (74.62 KiB) Viewed 11541 times

Re: How to setup VIM

Posted: Mon Mar 27, 2017 12:01 pm
by davisdude
yetneverdone wrote: Mon Mar 27, 2017 5:56 amBut how come it doesnt work in my existing lua files?
I'm not sure why it's not working, but try running the command `:syntax sync fromstart` and let me know if that fixes your problem. Another possibility could be swap files/backups. I have no idea if this is the case or not, but my guess would be that it's caching the old syntax highlighting somewhere to reduce startup time or something? Not completely sure to be honest...

Also let me know if you can pull up any of the help documentation (`:help love.graphics`)

Re: How to setup VIM

Posted: Mon Mar 27, 2017 12:21 pm
by yetneverdone
The command doesnt work.
I don't have any swap/backup files.
And the help command works

Re: How to setup VIM

Posted: Mon Mar 27, 2017 12:58 pm
by davisdude
That's weird... try `:syntax off` `:syntax on` to try and force the syntax and see if that works. I'm honestly not completely sure but it's definitely something I will try and figure out.

In the meantime, we can continue this conversation on GitHub if you like, I opened an issue.

*edit: I'm not sure how crucial it is, but try creating a directory in .vim called "after" and putting the syntax files in there and see if that does anything.