Garry's Mod Wiki

Revision Difference

Lua_Editors#546816

<cat>Dev</cat> As noted in the <page text="welcome tutorial">Beginner_Tutorial_Intro</page> Lua is plain text, so you can edit it in notepad, but you'll probably find you want something a bit better. ⤶ The editor you use is a personal preference - so it's up to you to choose one for yourself. The editors below are listed because they are the most popular editors in the Garry's Mod community. As noted in the <page text="welcome tutorial">Beginner_Tutorial_Intro</page> Lua is plain text, so you can edit it in notepad, but you'll probably find you want something a bit better. The editors below are listed because they are the most popular editors in the Garry's Mod community. ⤶ # Visual Studio Code (Recommended) ⤶ [Visual Studio Code](https://code.visualstudio.com/), commonly referred to as VS Code, VSCode, or VSC, is a free, open-source, lightweight IDE created by Microsoft. It offers a range of powerful IDE features such as IntelliSense, a massive [extension marketplace](https://marketplace.visualstudio.com/VSCode), and built-in support for Git, FTP & SSH. It supports inline-documentation (an immeasurably valuable feature when attempting to navigate the often incomprehensible world of Source modding), refactoring, reference jumping, and code completion. Due to the admirable efforts by the GLuaLint team to provide continued updates to GLuaLint, as well as VSCode's prominent role in the development community, VSCode is currently the recommended development environment for Garry's Mod addon development.⤶ ⤶ Recommended extensions:⤶ * [GLua Enhanced](https://marketplace.visualstudio.com/items?itemName=venner.vscode-glua-enhanced) - IntelliSense, autocompletion, wiki documentation, syntax highlighting, color palettes, etc.⤶ * [GLuaLint](https://marketplace.visualstudio.com/items?itemName=goz3rr.vscode-glualint) - Automatic error detection + hints (requires installation of [GLuaLint](https://github.com/FPtje/GLuaFixer))⤶ ⤶ Other extensions:⤶ * [GLua Syntax Highlighting - Acidic](https://marketplace.visualstudio.com/items?itemName=acidic9.glua) - Just syntax highlighting + snippets⤶ * [GLua Syntax Highlighting - aStonedPenguin](https://marketplace.visualstudio.com/items?itemName=aStonedPenguin.glua) - Just syntax highlighting + snippets⤶ ⤶ <upload src="46d91/8d7a4ce97a292d9.png" size="123071" name="vscode-demo.png" />⤶ # Sublime Text [Sublime](https://sublimetext.com/) is a fast, snappy, appealing, and effective text editor which is highly customizable and easy to use. It offers a number of features that will aid you in development, such as syntax highlighting, a minimap, and a number of hotkeys. It also has a great [package manager](https://packagecontrol.io/) for installing plugins. ⤶ It's probably the best choice if you are a beginner at coding, but if you have a bit more experience, you may want to try Visual Studio Code instead.⤶ [Sublime](https://sublimetext.com/) is a fast, extremely lightweight text editor which is highly customizable and easy to use. It offers a number of features that will aid you in development, such as syntax highlighting, a minimap, and a number of hotkeys. It also has a great [package manager](https://packagecontrol.io/) for installing plugins. That said, Sublime is [nagware](https://en.wikipedia.org/wiki/Shareware#Nagware), and will persistently prompt the user to purchase an $80 license. Recommended packages: * [GLua Highlighting](https://packagecontrol.io/packages/GMod%20Lua) ([Facepunch thread](https://web.archive.org/web/20160907203732/https://facepunch.com/threads/1038951a)) * [Linting](https://packagecontrol.io/packages/SublimeLinter-contrib-glua) <image src="https://i.imgur.com/qCxVDuU.png" alt="700px"/> ⤶ # Visual Studio Code⤶ ⤶ [Visual Studio Code](https://code.visualstudio.com/) is a lightweight counterpart to Visual Studio, similar to Sublime. Where it falls behind in snappiness in comparison to other text editors, it makes up for this with its extremely powerful IDE features, massive [extension marketplace](https://marketplace.visualstudio.com/VSCode) and wide range of [one-click-install themes](https://marketplace.visualstudio.com/search?target=VSCode&category=Themes&sortBy=Relevance). It has built in support for Git, FTP & SSH and brings over many of the IntelliSense features from Visual Studio such as autocompletion, documentation-as-you-type, and jumping around your code via definitions and references.⤶ ⤶ Recommended extensions:⤶ * [GLua Enhanced](https://marketplace.visualstudio.com/items?itemName=venner.vscode-glua-enhanced) - IntelliSense, autocompletion, wiki documentation, syntax highlighting, color palettes, etc.⤶ * [GLuaLint](https://marketplace.visualstudio.com/items?itemName=goz3rr.vscode-glualint) - Automatic error detection + hints⤶ * [GLua Syntax Highlighting - Acidic](https://marketplace.visualstudio.com/items?itemName=acidic9.glua) - Just syntax highlighting + snippets⤶ * [GLua Syntax Highlighting - aStonedPenguin](https://marketplace.visualstudio.com/items?itemName=aStonedPenguin.glua) - Just syntax highlighting + snippets⤶ ⤶ <upload src="46d91/8d7a4ce97a292d9.png" size="123071" name="vscode-demo.png" />⤶ # Vim [Vim](https://www.vim.org/) and [Neovim](https://neovim.io/) are highly extensible terminal based text editors, Vim based text editors use a scripting language called [Vim Script](https://www.cs.auckland.ac.nz/references/gnu/vim/usr_41.html) which is used for editing every little aspect of the program from the syntax highlighting to keybindings. Vim by itself kind of sucks, you're designed to go in and play with Vim script, adding your own keybinds and customizing it to your liking. Vim has an extremely steep learning curve. The process of learning Vim is often a frustrating one, but for those who come to master it, it rewards them with more efficient text editing capabilities, effortless manipulation of massive files, and bragging rights. That said, not everybody should learn Vim. For those who spend hours every day in a terminal environment, learning Vim will save weeks of their life in the long run, but for those who enjoy programming as an occasional hobby, a GUI-based IDE (like Visual Studio Code) is likely a better bet. <note>Vim isn't designed for new users and you should get a grip of programming before using it.</note> * [GLua Highlighting for Vim](https://github.com/vim-scripts/gmlua.vim/blob/master/syntax/gmlua.vim) * [Intellisense for Vim](https://github.com/neoclide/coc.nvim) <upload src="8ccfa/8d8928d72467cc1.png" size="40296" name="image.png" /> ⤶ # Visual Studio⤶ ⤶ If you use [Visual Studio](https://msdn.microsoft.com/en-us/vstudio/) then it might be more comfortable and convenient using it to edit Lua too (rather than learning a new editor). The free versions of Visual Studio are called 'Express'. There's a good page about Lua plugins on the [World Of Warcraft Wiki](http://www.wowwiki.com/Lua_editors/Visual_Studio). ⤶ ⤶ <image src="VisualStudioLua.png" alt="700px"/>⤶ # Notepad++ [Notepad++](https://notepad-plus-plus.org/) is a text editor with a number of features. It has syntax highlighting, a minimap, and a number of hotkeys, along with a Garry's Mod specific Syntax Highlighter which can be found [here](https://web.archive.org/web/20190406231524/https://forum.facepunch.com/gmoddev/oarh/Notepad-GLua-Highlighter/1/). <warning>Notepad++ is the weakest editor here; it severely lacks plugins that the other editors such as Sublime Text and Visual Studio Code have such as up-to-date code snippets and linting. However, it is completely fine for editing a few GLua files.</warning> <image src="Notepadplusplus.png" alt="center"/>