How to setup VIM

Questions about the LÖVE API, installing LÖVE and other support related questions go here.
Forum rules
Before you make a thread asking for help, read this.
User avatar
yetneverdone
Party member
Posts: 446
Joined: Sat Sep 24, 2016 11:20 am
Contact:

How to setup VIM

Post 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
User avatar
borix134
Prole
Posts: 18
Joined: Sat Aug 10, 2013 5:37 am

Re: How to setup VIM

Post 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.
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: How to setup VIM

Post 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.
Last edited by davisdude on Thu Dec 15, 2016 7:45 pm, edited 1 time in total.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
User avatar
yetneverdone
Party member
Posts: 446
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: How to setup VIM

Post 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?
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: How to setup VIM

Post 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.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
User avatar
Inny
Party member
Posts: 652
Joined: Fri Jan 30, 2009 3:41 am
Location: New York

Re: How to setup VIM

Post 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.
User avatar
yetneverdone
Party member
Posts: 446
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: How to setup VIM

Post 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 11215 times
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: How to setup VIM

Post 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`)
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
User avatar
yetneverdone
Party member
Posts: 446
Joined: Sat Sep 24, 2016 11:20 am
Contact:

Re: How to setup VIM

Post by yetneverdone »

The command doesnt work.
I don't have any swap/backup files.
And the help command works
davisdude
Party member
Posts: 1154
Joined: Sun Apr 28, 2013 3:29 am
Location: North Carolina

Re: How to setup VIM

Post 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.
GitHub | MLib - Math and shape intersections library | Walt - Animation library | Brady - Camera library with parallax scrolling | Vim-love-docs - Help files and syntax coloring for Vim
Post Reply

Who is online

Users browsing this forum: Google [Bot] and 51 guests