Repository files navigation

Preface

This repository is mainly for the use with plug-in managers.

Have a look at the Screenshot Page.

The development happens in WolfgangMehner/vim-plugins.

Preview Version

This is a preview version!

Notable new feature:

  • Run Lua in a terminal window directly inside the editor.
  • Fully enabled for Neovim.

The terminal window relies on the new +terminal feature, which becomes available with a patch level of approx. 8.0.1000.

Please read the release notes below.


README for lua-support.vim (Version 1.1alpha) / November 22 2020

  • INSTALLATION
  • RELEASE NOTES
  • FILES
  • ADDITIONAL TIPS
  • CREDITS

Lua-IDE for Vim/gVim/Neovim. It is written to considerably speed up writing code in a consistent style. This is done by inserting complete statements, idioms and comments. These code fragments are provided in an extendible template library. This plug-in helps with running and compiling Lua scripts, applying the code checker, and provides quick access to the online documentation of the Lua functions. Please read the documentation.

This plug-in can be used with Vim version 7.3+ and Neovim 0.2.1+.

Lua is: Copyright 1994-2016 Lua.org, PUC-Rio.


INSTALLATION

A system-wide installation for all users can also be done. This will have further effects on how the plug-in works. For a step-by-step instruction, as well as an explanation of the other consequences, please see the help file doc/luasupport.txt or look up the documentation via:

 :help luasupport-system-wide

(1) LINUX

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/.vim/ (find the value of $HOME with :echo $HOME from inside Vim).

(1.0) Save the template files in $HOME/.vim/lua-support/templates/ if you have changed any of them.

(1.1) Copy the zip archive lua-support.zip to $HOME/.vim and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/.vim/autoload/mmtemplates/...
$HOME/.vim/doc/...
$HOME/.vim/plugin/lua-support.vim

(1.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/.vimrc. Create one if there is none or use the file in $HOME/.vim/lua-support/rc as a starting point.

(1.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME/.vim/doc/

(1.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/.vim/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(1.5) Consider additional settings in the file $HOME/.vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your .vimrc and .gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/.vim/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2) WINDOWS

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/vimfiles/ (find the value of $HOME with :echo $HOME from inside Vim).

(2.0) Save the template files in $HOME/vimfiles/lua-support/templates/ if you have changed any of them.

(2.1) Copy the zip archive lua-support.zip to $HOME/vimfiles and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/vimfiles/autoload/mmtemplates/...
$HOME/vimfiles/doc/...
$HOME/vimfiles/plugin/lua-support.vim

(2.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/_vimrc. Create one if there is none or use the file in $HOME/vimfiles/lua-support/rc as a starting point.

(2.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME\vimfiles\doc\

(2.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/vimfiles/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(2.5) Consider additional settings in the file $HOME/_vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your _vimrc and _gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/vimfiles/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2.6) Make sure the shell is set up correctly. The options shell, shellcmdflag, shellquote, and shellxquote must be set consistently. Compare :help luasupport-troubleshooting.

(3) ADDITIONAL REMARKS

There are a lot of features and options which can be used and influenced:

  • use of the extendible template library
  • automated generation of comments for functions
  • use of the Lua interpreter, compiler and code checker
  • quick access to the online documentation
  • removing the Lua menu

Actions differ for different modes. Please read the documentation:

 :help luasupport

Any problems? See the TROUBLESHOOTING section at the end of the help file doc/luasupport.txt.


RELEASE NOTES

RELEASE NOTES FOR VERSION 1.1alpha

  • Adapt for running under Neovim more smoothly.
  • Add output method 'terminal' for running scripts in a terminal window (requires +terminal).
  • Rename output methods 'vim-io' to 'cmd-line', and 'vim-qf' to 'quickfix', for more consistency (old settings will still work).
  • The templates which are inserted into new files as file skeletons can be specified in the templates library, via the property: Lua::FileSkeleton::Script
  • Add configuration variables g:Lua_Ctrl_j and g:Lua_Ctrl_d to control the creation of the CTRL+J and CTRL+D maps.
  • Update Lua's reference manual to 5.3.6.
  • Move the filetype plug-in for lua to lua-support/rc.
  • Minor changes and bugfixes.

Note: The filetype plug-in has been moved, and is thus not loaded automatically anymore. Copy it from lua-support/rc/ to ftplugin, or add the commands there to your own filetype plug-in.

RELEASE NOTES FOR OLDER VERSIONS

-> see file lua-support/doc/ChangeLog


FILES

README.md
This file.
autoload/mmtemplates/*
The template system.
autoload/mmtoolbox/*
The toolbox (make, ...).
doc/luasupport.txt
The help file for Lua support.
doc/templatesupport.txt
The help file for the template system.
doc/toolbox*.txt
The help files for the toolbox.
plugin/lua-support.vim
The Lua plug-in for Vim/gVim/Neovim.
lua-support/templates/Templates
Lua main template file.
lua-support/templates/*.templates
Several dependent template files.

The following files and extensions are for convenience only.lua-support.vim will work without them.The settings are explained in the files themselves.

ftdetect/template.vim
ftplugin/template.vim
syntax/template.vim
Additional files for working with templates.
lua-support/codesnippets/*
Some Lua code snippets as a starting point.
lua-support/doc/ChangeLog
Complete change log.
lua-support/rc/additions.gvimrc
Additional settings for use in .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/additions.vimrc
Example settings for use in .vimrc:
setup of the plug-in
lua-support/rc/customization.gvimrc
Suggestion for the configuration file .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/customization.vimrc
Suggestion for the configuration file .vimrc:
hot keys, tabstop, use of dictionaries,
the setup of the plug-in, ...
lua-support/rc/lua.vim
Example filetype plug-in for Lua:
defines additional maps
lua-support/rc/*.templates
Sample template files for customization. Used by the
template setup wizard.

ADDITIONAL TIPS

(1) You may want to use a central hidden directory for all your backup files:

1.1 Add the following line to .vimrc:

 set backupdir=$HOME/.vim.backupdir

1.2 Create $HOME/.vim.backupdir .

1.3 Add the following line to your shell initialization file ~/.profile :

 find $HOME/.vim.backupdir/ -name "*" -type f -mtime +60 -exec rm -f {} \;

When you are logging in all files in the backup directory older then 60 days (-mtime +60) will be removed (60 days is a suggestion, of course). Be sure to backup in shorter terms !

(2) gVim. Toggle 'insert mode' <--> 'normal mode' with the right mouse button (see mapping in file customization.gvimrc).

(3) gVim. Use tear off menus.

(4) Try 'Focus under mouse' as window behavior (No mouse click when the mouse pointer is back from the menu entry).

(5) Use Emulate3Buttons "on" (X11) even for a 3-button mouse. Pressing left and right button simultaneously without moving your fingers is faster than moving a finger to the middle button (which is often a wheel).


CREDITS

We thank:

  • Fritz Mehner (vim.org user name: mehner) for a number of things:

    • his plug-ins (bash-support, c-support, perl-support, ...) provided the inspiration and model for this plug-in and the utilized template support
    • parts of the documentation and other material (including the 'ADDITIONAL TIPS' above) are taken from his plug-ins as well
  • Luis Carvalho (Kozure):

For a complete list of people who made contributions to this plug-in, please be so kind as to take a look at the credits:

 :help luasupport-credits

About

Edit Lua scripts in Vim/gVim/Neovim. Insert code snippets, run, compile, and check the code and look up help.

Topics

Resources

Stars

25 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Repository files navigation

Preface

This repository is mainly for the use with plug-in managers.

Have a look at the Screenshot Page.

The development happens in WolfgangMehner/vim-plugins.

Preview Version

This is a preview version!

Notable new feature:

  • Run Lua in a terminal window directly inside the editor.
  • Fully enabled for Neovim.

The terminal window relies on the new +terminal feature, which becomes available with a patch level of approx. 8.0.1000.

Please read the release notes below.


README for lua-support.vim (Version 1.1alpha) / November 22 2020

  • INSTALLATION
  • RELEASE NOTES
  • FILES
  • ADDITIONAL TIPS
  • CREDITS

Lua-IDE for Vim/gVim/Neovim. It is written to considerably speed up writing code in a consistent style. This is done by inserting complete statements, idioms and comments. These code fragments are provided in an extendible template library. This plug-in helps with running and compiling Lua scripts, applying the code checker, and provides quick access to the online documentation of the Lua functions. Please read the documentation.

This plug-in can be used with Vim version 7.3+ and Neovim 0.2.1+.

Lua is: Copyright 1994-2016 Lua.org, PUC-Rio.


INSTALLATION

A system-wide installation for all users can also be done. This will have further effects on how the plug-in works. For a step-by-step instruction, as well as an explanation of the other consequences, please see the help file doc/luasupport.txt or look up the documentation via:

 :help luasupport-system-wide

(1) LINUX

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/.vim/ (find the value of $HOME with :echo $HOME from inside Vim).

(1.0) Save the template files in $HOME/.vim/lua-support/templates/ if you have changed any of them.

(1.1) Copy the zip archive lua-support.zip to $HOME/.vim and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/.vim/autoload/mmtemplates/...
$HOME/.vim/doc/...
$HOME/.vim/plugin/lua-support.vim

(1.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/.vimrc. Create one if there is none or use the file in $HOME/.vim/lua-support/rc as a starting point.

(1.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME/.vim/doc/

(1.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/.vim/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(1.5) Consider additional settings in the file $HOME/.vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your .vimrc and .gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/.vim/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2) WINDOWS

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/vimfiles/ (find the value of $HOME with :echo $HOME from inside Vim).

(2.0) Save the template files in $HOME/vimfiles/lua-support/templates/ if you have changed any of them.

(2.1) Copy the zip archive lua-support.zip to $HOME/vimfiles and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/vimfiles/autoload/mmtemplates/...
$HOME/vimfiles/doc/...
$HOME/vimfiles/plugin/lua-support.vim

(2.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/_vimrc. Create one if there is none or use the file in $HOME/vimfiles/lua-support/rc as a starting point.

(2.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME\vimfiles\doc\

(2.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/vimfiles/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(2.5) Consider additional settings in the file $HOME/_vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your _vimrc and _gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/vimfiles/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2.6) Make sure the shell is set up correctly. The options shell, shellcmdflag, shellquote, and shellxquote must be set consistently. Compare :help luasupport-troubleshooting.

(3) ADDITIONAL REMARKS

There are a lot of features and options which can be used and influenced:

  • use of the extendible template library
  • automated generation of comments for functions
  • use of the Lua interpreter, compiler and code checker
  • quick access to the online documentation
  • removing the Lua menu

Actions differ for different modes. Please read the documentation:

 :help luasupport

Any problems? See the TROUBLESHOOTING section at the end of the help file doc/luasupport.txt.


RELEASE NOTES

RELEASE NOTES FOR VERSION 1.1alpha

  • Adapt for running under Neovim more smoothly.
  • Add output method 'terminal' for running scripts in a terminal window (requires +terminal).
  • Rename output methods 'vim-io' to 'cmd-line', and 'vim-qf' to 'quickfix', for more consistency (old settings will still work).
  • The templates which are inserted into new files as file skeletons can be specified in the templates library, via the property: Lua::FileSkeleton::Script
  • Add configuration variables g:Lua_Ctrl_j and g:Lua_Ctrl_d to control the creation of the CTRL+J and CTRL+D maps.
  • Update Lua's reference manual to 5.3.6.
  • Move the filetype plug-in for lua to lua-support/rc.
  • Minor changes and bugfixes.

Note: The filetype plug-in has been moved, and is thus not loaded automatically anymore. Copy it from lua-support/rc/ to ftplugin, or add the commands there to your own filetype plug-in.

RELEASE NOTES FOR OLDER VERSIONS

-> see file lua-support/doc/ChangeLog


FILES

README.md
This file.
autoload/mmtemplates/*
The template system.
autoload/mmtoolbox/*
The toolbox (make, ...).
doc/luasupport.txt
The help file for Lua support.
doc/templatesupport.txt
The help file for the template system.
doc/toolbox*.txt
The help files for the toolbox.
plugin/lua-support.vim
The Lua plug-in for Vim/gVim/Neovim.
lua-support/templates/Templates
Lua main template file.
lua-support/templates/*.templates
Several dependent template files.

The following files and extensions are for convenience only.lua-support.vim will work without them.The settings are explained in the files themselves.

ftdetect/template.vim
ftplugin/template.vim
syntax/template.vim
Additional files for working with templates.
lua-support/codesnippets/*
Some Lua code snippets as a starting point.
lua-support/doc/ChangeLog
Complete change log.
lua-support/rc/additions.gvimrc
Additional settings for use in .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/additions.vimrc
Example settings for use in .vimrc:
setup of the plug-in
lua-support/rc/customization.gvimrc
Suggestion for the configuration file .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/customization.vimrc
Suggestion for the configuration file .vimrc:
hot keys, tabstop, use of dictionaries,
the setup of the plug-in, ...
lua-support/rc/lua.vim
Example filetype plug-in for Lua:
defines additional maps
lua-support/rc/*.templates
Sample template files for customization. Used by the
template setup wizard.

ADDITIONAL TIPS

(1) You may want to use a central hidden directory for all your backup files:

1.1 Add the following line to .vimrc:

 set backupdir=$HOME/.vim.backupdir

1.2 Create $HOME/.vim.backupdir .

1.3 Add the following line to your shell initialization file ~/.profile :

 find $HOME/.vim.backupdir/ -name "*" -type f -mtime +60 -exec rm -f {} \;

When you are logging in all files in the backup directory older then 60 days (-mtime +60) will be removed (60 days is a suggestion, of course). Be sure to backup in shorter terms !

(2) gVim. Toggle 'insert mode' <--> 'normal mode' with the right mouse button (see mapping in file customization.gvimrc).

(3) gVim. Use tear off menus.

(4) Try 'Focus under mouse' as window behavior (No mouse click when the mouse pointer is back from the menu entry).

(5) Use Emulate3Buttons "on" (X11) even for a 3-button mouse. Pressing left and right button simultaneously without moving your fingers is faster than moving a finger to the middle button (which is often a wheel).


CREDITS

We thank:

  • Fritz Mehner (vim.org user name: mehner) for a number of things:

    • his plug-ins (bash-support, c-support, perl-support, ...) provided the inspiration and model for this plug-in and the utilized template support
    • parts of the documentation and other material (including the 'ADDITIONAL TIPS' above) are taken from his plug-ins as well
  • Luis Carvalho (Kozure):

For a complete list of people who made contributions to this plug-in, please be so kind as to take a look at the credits:

 :help luasupport-credits

About

Edit Lua scripts in Vim/gVim/Neovim. Insert code snippets, run, compile, and check the code and look up help.

Topics

Resources

Stars

25 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Preface

This repository is mainly for the use with plug-in managers.

Have a look at the Screenshot Page.

The development happens in WolfgangMehner/vim-plugins.

Preview Version

This is a preview version!

Notable new feature:

  • Run Lua in a terminal window directly inside the editor.
  • Fully enabled for Neovim.

The terminal window relies on the new +terminal feature, which becomes available with a patch level of approx. 8.0.1000.

Please read the release notes below.


README for lua-support.vim (Version 1.1alpha) / November 22 2020

  • INSTALLATION
  • RELEASE NOTES
  • FILES
  • ADDITIONAL TIPS
  • CREDITS

Lua-IDE for Vim/gVim/Neovim. It is written to considerably speed up writing code in a consistent style. This is done by inserting complete statements, idioms and comments. These code fragments are provided in an extendible template library. This plug-in helps with running and compiling Lua scripts, applying the code checker, and provides quick access to the online documentation of the Lua functions. Please read the documentation.

This plug-in can be used with Vim version 7.3+ and Neovim 0.2.1+.

Lua is: Copyright 1994-2016 Lua.org, PUC-Rio.


INSTALLATION

A system-wide installation for all users can also be done. This will have further effects on how the plug-in works. For a step-by-step instruction, as well as an explanation of the other consequences, please see the help file doc/luasupport.txt or look up the documentation via:

 :help luasupport-system-wide

(1) LINUX

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/.vim/ (find the value of $HOME with :echo $HOME from inside Vim).

(1.0) Save the template files in $HOME/.vim/lua-support/templates/ if you have changed any of them.

(1.1) Copy the zip archive lua-support.zip to $HOME/.vim and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/.vim/autoload/mmtemplates/...
$HOME/.vim/doc/...
$HOME/.vim/plugin/lua-support.vim

(1.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/.vimrc. Create one if there is none or use the file in $HOME/.vim/lua-support/rc as a starting point.

(1.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME/.vim/doc/

(1.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/.vim/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(1.5) Consider additional settings in the file $HOME/.vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your .vimrc and .gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/.vim/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2) WINDOWS

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/vimfiles/ (find the value of $HOME with :echo $HOME from inside Vim).

(2.0) Save the template files in $HOME/vimfiles/lua-support/templates/ if you have changed any of them.

(2.1) Copy the zip archive lua-support.zip to $HOME/vimfiles and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/vimfiles/autoload/mmtemplates/...
$HOME/vimfiles/doc/...
$HOME/vimfiles/plugin/lua-support.vim

(2.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/_vimrc. Create one if there is none or use the file in $HOME/vimfiles/lua-support/rc as a starting point.

(2.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME\vimfiles\doc\

(2.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/vimfiles/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(2.5) Consider additional settings in the file $HOME/_vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your _vimrc and _gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/vimfiles/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2.6) Make sure the shell is set up correctly. The options shell, shellcmdflag, shellquote, and shellxquote must be set consistently. Compare :help luasupport-troubleshooting.

(3) ADDITIONAL REMARKS

There are a lot of features and options which can be used and influenced:

  • use of the extendible template library
  • automated generation of comments for functions
  • use of the Lua interpreter, compiler and code checker
  • quick access to the online documentation
  • removing the Lua menu

Actions differ for different modes. Please read the documentation:

 :help luasupport

Any problems? See the TROUBLESHOOTING section at the end of the help file doc/luasupport.txt.


RELEASE NOTES

RELEASE NOTES FOR VERSION 1.1alpha

  • Adapt for running under Neovim more smoothly.
  • Add output method 'terminal' for running scripts in a terminal window (requires +terminal).
  • Rename output methods 'vim-io' to 'cmd-line', and 'vim-qf' to 'quickfix', for more consistency (old settings will still work).
  • The templates which are inserted into new files as file skeletons can be specified in the templates library, via the property: Lua::FileSkeleton::Script
  • Add configuration variables g:Lua_Ctrl_j and g:Lua_Ctrl_d to control the creation of the CTRL+J and CTRL+D maps.
  • Update Lua's reference manual to 5.3.6.
  • Move the filetype plug-in for lua to lua-support/rc.
  • Minor changes and bugfixes.

Note: The filetype plug-in has been moved, and is thus not loaded automatically anymore. Copy it from lua-support/rc/ to ftplugin, or add the commands there to your own filetype plug-in.

RELEASE NOTES FOR OLDER VERSIONS

-> see file lua-support/doc/ChangeLog


FILES

README.md
This file.
autoload/mmtemplates/*
The template system.
autoload/mmtoolbox/*
The toolbox (make, ...).
doc/luasupport.txt
The help file for Lua support.
doc/templatesupport.txt
The help file for the template system.
doc/toolbox*.txt
The help files for the toolbox.
plugin/lua-support.vim
The Lua plug-in for Vim/gVim/Neovim.
lua-support/templates/Templates
Lua main template file.
lua-support/templates/*.templates
Several dependent template files.

The following files and extensions are for convenience only.lua-support.vim will work without them.The settings are explained in the files themselves.

ftdetect/template.vim
ftplugin/template.vim
syntax/template.vim
Additional files for working with templates.
lua-support/codesnippets/*
Some Lua code snippets as a starting point.
lua-support/doc/ChangeLog
Complete change log.
lua-support/rc/additions.gvimrc
Additional settings for use in .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/additions.vimrc
Example settings for use in .vimrc:
setup of the plug-in
lua-support/rc/customization.gvimrc
Suggestion for the configuration file .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/customization.vimrc
Suggestion for the configuration file .vimrc:
hot keys, tabstop, use of dictionaries,
the setup of the plug-in, ...
lua-support/rc/lua.vim
Example filetype plug-in for Lua:
defines additional maps
lua-support/rc/*.templates
Sample template files for customization. Used by the
template setup wizard.

ADDITIONAL TIPS

(1) You may want to use a central hidden directory for all your backup files:

1.1 Add the following line to .vimrc:

 set backupdir=$HOME/.vim.backupdir

1.2 Create $HOME/.vim.backupdir .

1.3 Add the following line to your shell initialization file ~/.profile :

 find $HOME/.vim.backupdir/ -name "*" -type f -mtime +60 -exec rm -f {} \;

When you are logging in all files in the backup directory older then 60 days (-mtime +60) will be removed (60 days is a suggestion, of course). Be sure to backup in shorter terms !

(2) gVim. Toggle 'insert mode' <--> 'normal mode' with the right mouse button (see mapping in file customization.gvimrc).

(3) gVim. Use tear off menus.

(4) Try 'Focus under mouse' as window behavior (No mouse click when the mouse pointer is back from the menu entry).

(5) Use Emulate3Buttons "on" (X11) even for a 3-button mouse. Pressing left and right button simultaneously without moving your fingers is faster than moving a finger to the middle button (which is often a wheel).


CREDITS

We thank:

  • Fritz Mehner (vim.org user name: mehner) for a number of things:

    • his plug-ins (bash-support, c-support, perl-support, ...) provided the inspiration and model for this plug-in and the utilized template support
    • parts of the documentation and other material (including the 'ADDITIONAL TIPS' above) are taken from his plug-ins as well
  • Luis Carvalho (Kozure):

For a complete list of people who made contributions to this plug-in, please be so kind as to take a look at the credits:

 :help luasupport-credits

About

Edit Lua scripts in Vim/gVim/Neovim. Insert code snippets, run, compile, and check the code and look up help.

Topics

Resources

Stars

25 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Preface

This repository is mainly for the use with plug-in managers.

Have a look at the Screenshot Page.

The development happens in WolfgangMehner/vim-plugins.

Preview Version

This is a preview version!

Notable new feature:

  • Run Lua in a terminal window directly inside the editor.
  • Fully enabled for Neovim.

The terminal window relies on the new +terminal feature, which becomes available with a patch level of approx. 8.0.1000.

Please read the release notes below.


README for lua-support.vim (Version 1.1alpha) / November 22 2020

  • INSTALLATION
  • RELEASE NOTES
  • FILES
  • ADDITIONAL TIPS
  • CREDITS

Lua-IDE for Vim/gVim/Neovim. It is written to considerably speed up writing code in a consistent style. This is done by inserting complete statements, idioms and comments. These code fragments are provided in an extendible template library. This plug-in helps with running and compiling Lua scripts, applying the code checker, and provides quick access to the online documentation of the Lua functions. Please read the documentation.

This plug-in can be used with Vim version 7.3+ and Neovim 0.2.1+.

Lua is: Copyright 1994-2016 Lua.org, PUC-Rio.


INSTALLATION

A system-wide installation for all users can also be done. This will have further effects on how the plug-in works. For a step-by-step instruction, as well as an explanation of the other consequences, please see the help file doc/luasupport.txt or look up the documentation via:

 :help luasupport-system-wide

(1) LINUX

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/.vim/ (find the value of $HOME with :echo $HOME from inside Vim).

(1.0) Save the template files in $HOME/.vim/lua-support/templates/ if you have changed any of them.

(1.1) Copy the zip archive lua-support.zip to $HOME/.vim and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/.vim/autoload/mmtemplates/...
$HOME/.vim/doc/...
$HOME/.vim/plugin/lua-support.vim

(1.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/.vimrc. Create one if there is none or use the file in $HOME/.vim/lua-support/rc as a starting point.

(1.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME/.vim/doc/

(1.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/.vim/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(1.5) Consider additional settings in the file $HOME/.vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your .vimrc and .gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/.vim/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2) WINDOWS

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/vimfiles/ (find the value of $HOME with :echo $HOME from inside Vim).

(2.0) Save the template files in $HOME/vimfiles/lua-support/templates/ if you have changed any of them.

(2.1) Copy the zip archive lua-support.zip to $HOME/vimfiles and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/vimfiles/autoload/mmtemplates/...
$HOME/vimfiles/doc/...
$HOME/vimfiles/plugin/lua-support.vim

(2.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/_vimrc. Create one if there is none or use the file in $HOME/vimfiles/lua-support/rc as a starting point.

(2.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME\vimfiles\doc\

(2.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/vimfiles/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(2.5) Consider additional settings in the file $HOME/_vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your _vimrc and _gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/vimfiles/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2.6) Make sure the shell is set up correctly. The options shell, shellcmdflag, shellquote, and shellxquote must be set consistently. Compare :help luasupport-troubleshooting.

(3) ADDITIONAL REMARKS

There are a lot of features and options which can be used and influenced:

  • use of the extendible template library
  • automated generation of comments for functions
  • use of the Lua interpreter, compiler and code checker
  • quick access to the online documentation
  • removing the Lua menu

Actions differ for different modes. Please read the documentation:

 :help luasupport

Any problems? See the TROUBLESHOOTING section at the end of the help file doc/luasupport.txt.


RELEASE NOTES

RELEASE NOTES FOR VERSION 1.1alpha

  • Adapt for running under Neovim more smoothly.
  • Add output method 'terminal' for running scripts in a terminal window (requires +terminal).
  • Rename output methods 'vim-io' to 'cmd-line', and 'vim-qf' to 'quickfix', for more consistency (old settings will still work).
  • The templates which are inserted into new files as file skeletons can be specified in the templates library, via the property: Lua::FileSkeleton::Script
  • Add configuration variables g:Lua_Ctrl_j and g:Lua_Ctrl_d to control the creation of the CTRL+J and CTRL+D maps.
  • Update Lua's reference manual to 5.3.6.
  • Move the filetype plug-in for lua to lua-support/rc.
  • Minor changes and bugfixes.

Note: The filetype plug-in has been moved, and is thus not loaded automatically anymore. Copy it from lua-support/rc/ to ftplugin, or add the commands there to your own filetype plug-in.

RELEASE NOTES FOR OLDER VERSIONS

-> see file lua-support/doc/ChangeLog


FILES

README.md
This file.
autoload/mmtemplates/*
The template system.
autoload/mmtoolbox/*
The toolbox (make, ...).
doc/luasupport.txt
The help file for Lua support.
doc/templatesupport.txt
The help file for the template system.
doc/toolbox*.txt
The help files for the toolbox.
plugin/lua-support.vim
The Lua plug-in for Vim/gVim/Neovim.
lua-support/templates/Templates
Lua main template file.
lua-support/templates/*.templates
Several dependent template files.

The following files and extensions are for convenience only.lua-support.vim will work without them.The settings are explained in the files themselves.

ftdetect/template.vim
ftplugin/template.vim
syntax/template.vim
Additional files for working with templates.
lua-support/codesnippets/*
Some Lua code snippets as a starting point.
lua-support/doc/ChangeLog
Complete change log.
lua-support/rc/additions.gvimrc
Additional settings for use in .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/additions.vimrc
Example settings for use in .vimrc:
setup of the plug-in
lua-support/rc/customization.gvimrc
Suggestion for the configuration file .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/customization.vimrc
Suggestion for the configuration file .vimrc:
hot keys, tabstop, use of dictionaries,
the setup of the plug-in, ...
lua-support/rc/lua.vim
Example filetype plug-in for Lua:
defines additional maps
lua-support/rc/*.templates
Sample template files for customization. Used by the
template setup wizard.

ADDITIONAL TIPS

(1) You may want to use a central hidden directory for all your backup files:

1.1 Add the following line to .vimrc:

 set backupdir=$HOME/.vim.backupdir

1.2 Create $HOME/.vim.backupdir .

1.3 Add the following line to your shell initialization file ~/.profile :

 find $HOME/.vim.backupdir/ -name "*" -type f -mtime +60 -exec rm -f {} \;

When you are logging in all files in the backup directory older then 60 days (-mtime +60) will be removed (60 days is a suggestion, of course). Be sure to backup in shorter terms !

(2) gVim. Toggle 'insert mode' <--> 'normal mode' with the right mouse button (see mapping in file customization.gvimrc).

(3) gVim. Use tear off menus.

(4) Try 'Focus under mouse' as window behavior (No mouse click when the mouse pointer is back from the menu entry).

(5) Use Emulate3Buttons "on" (X11) even for a 3-button mouse. Pressing left and right button simultaneously without moving your fingers is faster than moving a finger to the middle button (which is often a wheel).


CREDITS

We thank:

  • Fritz Mehner (vim.org user name: mehner) for a number of things:

    • his plug-ins (bash-support, c-support, perl-support, ...) provided the inspiration and model for this plug-in and the utilized template support
    • parts of the documentation and other material (including the 'ADDITIONAL TIPS' above) are taken from his plug-ins as well
  • Luis Carvalho (Kozure):

For a complete list of people who made contributions to this plug-in, please be so kind as to take a look at the credits:

 :help luasupport-credits

About

Edit Lua scripts in Vim/gVim/Neovim. Insert code snippets, run, compile, and check the code and look up help.

Topics

Resources

Stars

25 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Repository files navigation

Preface

This repository is mainly for the use with plug-in managers.

Have a look at the Screenshot Page.

The development happens in WolfgangMehner/vim-plugins.

Preview Version

This is a preview version!

Notable new feature:

  • Run Lua in a terminal window directly inside the editor.
  • Fully enabled for Neovim.

The terminal window relies on the new +terminal feature, which becomes available with a patch level of approx. 8.0.1000.

Please read the release notes below.


README for lua-support.vim (Version 1.1alpha) / November 22 2020

  • INSTALLATION
  • RELEASE NOTES
  • FILES
  • ADDITIONAL TIPS
  • CREDITS

Lua-IDE for Vim/gVim/Neovim. It is written to considerably speed up writing code in a consistent style. This is done by inserting complete statements, idioms and comments. These code fragments are provided in an extendible template library. This plug-in helps with running and compiling Lua scripts, applying the code checker, and provides quick access to the online documentation of the Lua functions. Please read the documentation.

This plug-in can be used with Vim version 7.3+ and Neovim 0.2.1+.

Lua is: Copyright 1994-2016 Lua.org, PUC-Rio.


INSTALLATION

A system-wide installation for all users can also be done. This will have further effects on how the plug-in works. For a step-by-step instruction, as well as an explanation of the other consequences, please see the help file doc/luasupport.txt or look up the documentation via:

 :help luasupport-system-wide

(1) LINUX

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/.vim/ (find the value of $HOME with :echo $HOME from inside Vim).

(1.0) Save the template files in $HOME/.vim/lua-support/templates/ if you have changed any of them.

(1.1) Copy the zip archive lua-support.zip to $HOME/.vim and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/.vim/autoload/mmtemplates/...
$HOME/.vim/doc/...
$HOME/.vim/plugin/lua-support.vim

(1.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/.vimrc. Create one if there is none or use the file in $HOME/.vim/lua-support/rc as a starting point.

(1.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME/.vim/doc/

(1.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/.vim/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(1.5) Consider additional settings in the file $HOME/.vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your .vimrc and .gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/.vim/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2) WINDOWS

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/vimfiles/ (find the value of $HOME with :echo $HOME from inside Vim).

(2.0) Save the template files in $HOME/vimfiles/lua-support/templates/ if you have changed any of them.

(2.1) Copy the zip archive lua-support.zip to $HOME/vimfiles and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/vimfiles/autoload/mmtemplates/...
$HOME/vimfiles/doc/...
$HOME/vimfiles/plugin/lua-support.vim

(2.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/_vimrc. Create one if there is none or use the file in $HOME/vimfiles/lua-support/rc as a starting point.

(2.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME\vimfiles\doc\

(2.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/vimfiles/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(2.5) Consider additional settings in the file $HOME/_vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your _vimrc and _gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/vimfiles/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2.6) Make sure the shell is set up correctly. The options shell, shellcmdflag, shellquote, and shellxquote must be set consistently. Compare :help luasupport-troubleshooting.

(3) ADDITIONAL REMARKS

There are a lot of features and options which can be used and influenced:

  • use of the extendible template library
  • automated generation of comments for functions
  • use of the Lua interpreter, compiler and code checker
  • quick access to the online documentation
  • removing the Lua menu

Actions differ for different modes. Please read the documentation:

 :help luasupport

Any problems? See the TROUBLESHOOTING section at the end of the help file doc/luasupport.txt.


RELEASE NOTES

RELEASE NOTES FOR VERSION 1.1alpha

  • Adapt for running under Neovim more smoothly.
  • Add output method 'terminal' for running scripts in a terminal window (requires +terminal).
  • Rename output methods 'vim-io' to 'cmd-line', and 'vim-qf' to 'quickfix', for more consistency (old settings will still work).
  • The templates which are inserted into new files as file skeletons can be specified in the templates library, via the property: Lua::FileSkeleton::Script
  • Add configuration variables g:Lua_Ctrl_j and g:Lua_Ctrl_d to control the creation of the CTRL+J and CTRL+D maps.
  • Update Lua's reference manual to 5.3.6.
  • Move the filetype plug-in for lua to lua-support/rc.
  • Minor changes and bugfixes.

Note: The filetype plug-in has been moved, and is thus not loaded automatically anymore. Copy it from lua-support/rc/ to ftplugin, or add the commands there to your own filetype plug-in.

RELEASE NOTES FOR OLDER VERSIONS

-> see file lua-support/doc/ChangeLog


FILES

README.md
This file.
autoload/mmtemplates/*
The template system.
autoload/mmtoolbox/*
The toolbox (make, ...).
doc/luasupport.txt
The help file for Lua support.
doc/templatesupport.txt
The help file for the template system.
doc/toolbox*.txt
The help files for the toolbox.
plugin/lua-support.vim
The Lua plug-in for Vim/gVim/Neovim.
lua-support/templates/Templates
Lua main template file.
lua-support/templates/*.templates
Several dependent template files.

The following files and extensions are for convenience only.lua-support.vim will work without them.The settings are explained in the files themselves.

ftdetect/template.vim
ftplugin/template.vim
syntax/template.vim
Additional files for working with templates.
lua-support/codesnippets/*
Some Lua code snippets as a starting point.
lua-support/doc/ChangeLog
Complete change log.
lua-support/rc/additions.gvimrc
Additional settings for use in .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/additions.vimrc
Example settings for use in .vimrc:
setup of the plug-in
lua-support/rc/customization.gvimrc
Suggestion for the configuration file .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/customization.vimrc
Suggestion for the configuration file .vimrc:
hot keys, tabstop, use of dictionaries,
the setup of the plug-in, ...
lua-support/rc/lua.vim
Example filetype plug-in for Lua:
defines additional maps
lua-support/rc/*.templates
Sample template files for customization. Used by the
template setup wizard.

ADDITIONAL TIPS

(1) You may want to use a central hidden directory for all your backup files:

1.1 Add the following line to .vimrc:

 set backupdir=$HOME/.vim.backupdir

1.2 Create $HOME/.vim.backupdir .

1.3 Add the following line to your shell initialization file ~/.profile :

 find $HOME/.vim.backupdir/ -name "*" -type f -mtime +60 -exec rm -f {} \;

When you are logging in all files in the backup directory older then 60 days (-mtime +60) will be removed (60 days is a suggestion, of course). Be sure to backup in shorter terms !

(2) gVim. Toggle 'insert mode' <--> 'normal mode' with the right mouse button (see mapping in file customization.gvimrc).

(3) gVim. Use tear off menus.

(4) Try 'Focus under mouse' as window behavior (No mouse click when the mouse pointer is back from the menu entry).

(5) Use Emulate3Buttons "on" (X11) even for a 3-button mouse. Pressing left and right button simultaneously without moving your fingers is faster than moving a finger to the middle button (which is often a wheel).


CREDITS

We thank:

  • Fritz Mehner (vim.org user name: mehner) for a number of things:

    • his plug-ins (bash-support, c-support, perl-support, ...) provided the inspiration and model for this plug-in and the utilized template support
    • parts of the documentation and other material (including the 'ADDITIONAL TIPS' above) are taken from his plug-ins as well
  • Luis Carvalho (Kozure):

For a complete list of people who made contributions to this plug-in, please be so kind as to take a look at the credits:

 :help luasupport-credits

About

Edit Lua scripts in Vim/gVim/Neovim. Insert code snippets, run, compile, and check the code and look up help.

Topics

Resources

Stars

25 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Preface

This repository is mainly for the use with plug-in managers.

Have a look at the Screenshot Page.

The development happens in WolfgangMehner/vim-plugins.

Preview Version

This is a preview version!

Notable new feature:

  • Run Lua in a terminal window directly inside the editor.
  • Fully enabled for Neovim.

The terminal window relies on the new +terminal feature, which becomes available with a patch level of approx. 8.0.1000.

Please read the release notes below.


README for lua-support.vim (Version 1.1alpha) / November 22 2020

  • INSTALLATION
  • RELEASE NOTES
  • FILES
  • ADDITIONAL TIPS
  • CREDITS

Lua-IDE for Vim/gVim/Neovim. It is written to considerably speed up writing code in a consistent style. This is done by inserting complete statements, idioms and comments. These code fragments are provided in an extendible template library. This plug-in helps with running and compiling Lua scripts, applying the code checker, and provides quick access to the online documentation of the Lua functions. Please read the documentation.

This plug-in can be used with Vim version 7.3+ and Neovim 0.2.1+.

Lua is: Copyright 1994-2016 Lua.org, PUC-Rio.


INSTALLATION

A system-wide installation for all users can also be done. This will have further effects on how the plug-in works. For a step-by-step instruction, as well as an explanation of the other consequences, please see the help file doc/luasupport.txt or look up the documentation via:

 :help luasupport-system-wide

(1) LINUX

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/.vim/ (find the value of $HOME with :echo $HOME from inside Vim).

(1.0) Save the template files in $HOME/.vim/lua-support/templates/ if you have changed any of them.

(1.1) Copy the zip archive lua-support.zip to $HOME/.vim and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/.vim/autoload/mmtemplates/...
$HOME/.vim/doc/...
$HOME/.vim/plugin/lua-support.vim

(1.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/.vimrc. Create one if there is none or use the file in $HOME/.vim/lua-support/rc as a starting point.

(1.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME/.vim/doc/

(1.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/.vim/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(1.5) Consider additional settings in the file $HOME/.vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your .vimrc and .gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/.vim/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2) WINDOWS

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/vimfiles/ (find the value of $HOME with :echo $HOME from inside Vim).

(2.0) Save the template files in $HOME/vimfiles/lua-support/templates/ if you have changed any of them.

(2.1) Copy the zip archive lua-support.zip to $HOME/vimfiles and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/vimfiles/autoload/mmtemplates/...
$HOME/vimfiles/doc/...
$HOME/vimfiles/plugin/lua-support.vim

(2.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/_vimrc. Create one if there is none or use the file in $HOME/vimfiles/lua-support/rc as a starting point.

(2.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME\vimfiles\doc\

(2.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/vimfiles/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(2.5) Consider additional settings in the file $HOME/_vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your _vimrc and _gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/vimfiles/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2.6) Make sure the shell is set up correctly. The options shell, shellcmdflag, shellquote, and shellxquote must be set consistently. Compare :help luasupport-troubleshooting.

(3) ADDITIONAL REMARKS

There are a lot of features and options which can be used and influenced:

  • use of the extendible template library
  • automated generation of comments for functions
  • use of the Lua interpreter, compiler and code checker
  • quick access to the online documentation
  • removing the Lua menu

Actions differ for different modes. Please read the documentation:

 :help luasupport

Any problems? See the TROUBLESHOOTING section at the end of the help file doc/luasupport.txt.


RELEASE NOTES

RELEASE NOTES FOR VERSION 1.1alpha

  • Adapt for running under Neovim more smoothly.
  • Add output method 'terminal' for running scripts in a terminal window (requires +terminal).
  • Rename output methods 'vim-io' to 'cmd-line', and 'vim-qf' to 'quickfix', for more consistency (old settings will still work).
  • The templates which are inserted into new files as file skeletons can be specified in the templates library, via the property: Lua::FileSkeleton::Script
  • Add configuration variables g:Lua_Ctrl_j and g:Lua_Ctrl_d to control the creation of the CTRL+J and CTRL+D maps.
  • Update Lua's reference manual to 5.3.6.
  • Move the filetype plug-in for lua to lua-support/rc.
  • Minor changes and bugfixes.

Note: The filetype plug-in has been moved, and is thus not loaded automatically anymore. Copy it from lua-support/rc/ to ftplugin, or add the commands there to your own filetype plug-in.

RELEASE NOTES FOR OLDER VERSIONS

-> see file lua-support/doc/ChangeLog


FILES

README.md
This file.
autoload/mmtemplates/*
The template system.
autoload/mmtoolbox/*
The toolbox (make, ...).
doc/luasupport.txt
The help file for Lua support.
doc/templatesupport.txt
The help file for the template system.
doc/toolbox*.txt
The help files for the toolbox.
plugin/lua-support.vim
The Lua plug-in for Vim/gVim/Neovim.
lua-support/templates/Templates
Lua main template file.
lua-support/templates/*.templates
Several dependent template files.

The following files and extensions are for convenience only.lua-support.vim will work without them.The settings are explained in the files themselves.

ftdetect/template.vim
ftplugin/template.vim
syntax/template.vim
Additional files for working with templates.
lua-support/codesnippets/*
Some Lua code snippets as a starting point.
lua-support/doc/ChangeLog
Complete change log.
lua-support/rc/additions.gvimrc
Additional settings for use in .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/additions.vimrc
Example settings for use in .vimrc:
setup of the plug-in
lua-support/rc/customization.gvimrc
Suggestion for the configuration file .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/customization.vimrc
Suggestion for the configuration file .vimrc:
hot keys, tabstop, use of dictionaries,
the setup of the plug-in, ...
lua-support/rc/lua.vim
Example filetype plug-in for Lua:
defines additional maps
lua-support/rc/*.templates
Sample template files for customization. Used by the
template setup wizard.

ADDITIONAL TIPS

(1) You may want to use a central hidden directory for all your backup files:

1.1 Add the following line to .vimrc:

 set backupdir=$HOME/.vim.backupdir

1.2 Create $HOME/.vim.backupdir .

1.3 Add the following line to your shell initialization file ~/.profile :

 find $HOME/.vim.backupdir/ -name "*" -type f -mtime +60 -exec rm -f {} \;

When you are logging in all files in the backup directory older then 60 days (-mtime +60) will be removed (60 days is a suggestion, of course). Be sure to backup in shorter terms !

(2) gVim. Toggle 'insert mode' <--> 'normal mode' with the right mouse button (see mapping in file customization.gvimrc).

(3) gVim. Use tear off menus.

(4) Try 'Focus under mouse' as window behavior (No mouse click when the mouse pointer is back from the menu entry).

(5) Use Emulate3Buttons "on" (X11) even for a 3-button mouse. Pressing left and right button simultaneously without moving your fingers is faster than moving a finger to the middle button (which is often a wheel).


CREDITS

We thank:

  • Fritz Mehner (vim.org user name: mehner) for a number of things:

    • his plug-ins (bash-support, c-support, perl-support, ...) provided the inspiration and model for this plug-in and the utilized template support
    • parts of the documentation and other material (including the 'ADDITIONAL TIPS' above) are taken from his plug-ins as well
  • Luis Carvalho (Kozure):

For a complete list of people who made contributions to this plug-in, please be so kind as to take a look at the credits:

 :help luasupport-credits

About

Edit Lua scripts in Vim/gVim/Neovim. Insert code snippets, run, compile, and check the code and look up help.

Topics

Resources

Stars

25 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Preface

This repository is mainly for the use with plug-in managers.

Have a look at the Screenshot Page.

The development happens in WolfgangMehner/vim-plugins.

Preview Version

This is a preview version!

Notable new feature:

  • Run Lua in a terminal window directly inside the editor.
  • Fully enabled for Neovim.

The terminal window relies on the new +terminal feature, which becomes available with a patch level of approx. 8.0.1000.

Please read the release notes below.


README for lua-support.vim (Version 1.1alpha) / November 22 2020

  • INSTALLATION
  • RELEASE NOTES
  • FILES
  • ADDITIONAL TIPS
  • CREDITS

Lua-IDE for Vim/gVim/Neovim. It is written to considerably speed up writing code in a consistent style. This is done by inserting complete statements, idioms and comments. These code fragments are provided in an extendible template library. This plug-in helps with running and compiling Lua scripts, applying the code checker, and provides quick access to the online documentation of the Lua functions. Please read the documentation.

This plug-in can be used with Vim version 7.3+ and Neovim 0.2.1+.

Lua is: Copyright 1994-2016 Lua.org, PUC-Rio.


INSTALLATION

A system-wide installation for all users can also be done. This will have further effects on how the plug-in works. For a step-by-step instruction, as well as an explanation of the other consequences, please see the help file doc/luasupport.txt or look up the documentation via:

 :help luasupport-system-wide

(1) LINUX

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/.vim/ (find the value of $HOME with :echo $HOME from inside Vim).

(1.0) Save the template files in $HOME/.vim/lua-support/templates/ if you have changed any of them.

(1.1) Copy the zip archive lua-support.zip to $HOME/.vim and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/.vim/autoload/mmtemplates/...
$HOME/.vim/doc/...
$HOME/.vim/plugin/lua-support.vim

(1.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/.vimrc. Create one if there is none or use the file in $HOME/.vim/lua-support/rc as a starting point.

(1.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME/.vim/doc/

(1.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/.vim/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(1.5) Consider additional settings in the file $HOME/.vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your .vimrc and .gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/.vim/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2) WINDOWS

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/vimfiles/ (find the value of $HOME with :echo $HOME from inside Vim).

(2.0) Save the template files in $HOME/vimfiles/lua-support/templates/ if you have changed any of them.

(2.1) Copy the zip archive lua-support.zip to $HOME/vimfiles and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/vimfiles/autoload/mmtemplates/...
$HOME/vimfiles/doc/...
$HOME/vimfiles/plugin/lua-support.vim

(2.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/_vimrc. Create one if there is none or use the file in $HOME/vimfiles/lua-support/rc as a starting point.

(2.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME\vimfiles\doc\

(2.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/vimfiles/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(2.5) Consider additional settings in the file $HOME/_vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your _vimrc and _gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/vimfiles/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2.6) Make sure the shell is set up correctly. The options shell, shellcmdflag, shellquote, and shellxquote must be set consistently. Compare :help luasupport-troubleshooting.

(3) ADDITIONAL REMARKS

There are a lot of features and options which can be used and influenced:

  • use of the extendible template library
  • automated generation of comments for functions
  • use of the Lua interpreter, compiler and code checker
  • quick access to the online documentation
  • removing the Lua menu

Actions differ for different modes. Please read the documentation:

 :help luasupport

Any problems? See the TROUBLESHOOTING section at the end of the help file doc/luasupport.txt.


RELEASE NOTES

RELEASE NOTES FOR VERSION 1.1alpha

  • Adapt for running under Neovim more smoothly.
  • Add output method 'terminal' for running scripts in a terminal window (requires +terminal).
  • Rename output methods 'vim-io' to 'cmd-line', and 'vim-qf' to 'quickfix', for more consistency (old settings will still work).
  • The templates which are inserted into new files as file skeletons can be specified in the templates library, via the property: Lua::FileSkeleton::Script
  • Add configuration variables g:Lua_Ctrl_j and g:Lua_Ctrl_d to control the creation of the CTRL+J and CTRL+D maps.
  • Update Lua's reference manual to 5.3.6.
  • Move the filetype plug-in for lua to lua-support/rc.
  • Minor changes and bugfixes.

Note: The filetype plug-in has been moved, and is thus not loaded automatically anymore. Copy it from lua-support/rc/ to ftplugin, or add the commands there to your own filetype plug-in.

RELEASE NOTES FOR OLDER VERSIONS

-> see file lua-support/doc/ChangeLog


FILES

README.md
This file.
autoload/mmtemplates/*
The template system.
autoload/mmtoolbox/*
The toolbox (make, ...).
doc/luasupport.txt
The help file for Lua support.
doc/templatesupport.txt
The help file for the template system.
doc/toolbox*.txt
The help files for the toolbox.
plugin/lua-support.vim
The Lua plug-in for Vim/gVim/Neovim.
lua-support/templates/Templates
Lua main template file.
lua-support/templates/*.templates
Several dependent template files.

The following files and extensions are for convenience only.lua-support.vim will work without them.The settings are explained in the files themselves.

ftdetect/template.vim
ftplugin/template.vim
syntax/template.vim
Additional files for working with templates.
lua-support/codesnippets/*
Some Lua code snippets as a starting point.
lua-support/doc/ChangeLog
Complete change log.
lua-support/rc/additions.gvimrc
Additional settings for use in .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/additions.vimrc
Example settings for use in .vimrc:
setup of the plug-in
lua-support/rc/customization.gvimrc
Suggestion for the configuration file .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/customization.vimrc
Suggestion for the configuration file .vimrc:
hot keys, tabstop, use of dictionaries,
the setup of the plug-in, ...
lua-support/rc/lua.vim
Example filetype plug-in for Lua:
defines additional maps
lua-support/rc/*.templates
Sample template files for customization. Used by the
template setup wizard.

ADDITIONAL TIPS

(1) You may want to use a central hidden directory for all your backup files:

1.1 Add the following line to .vimrc:

 set backupdir=$HOME/.vim.backupdir

1.2 Create $HOME/.vim.backupdir .

1.3 Add the following line to your shell initialization file ~/.profile :

 find $HOME/.vim.backupdir/ -name "*" -type f -mtime +60 -exec rm -f {} \;

When you are logging in all files in the backup directory older then 60 days (-mtime +60) will be removed (60 days is a suggestion, of course). Be sure to backup in shorter terms !

(2) gVim. Toggle 'insert mode' <--> 'normal mode' with the right mouse button (see mapping in file customization.gvimrc).

(3) gVim. Use tear off menus.

(4) Try 'Focus under mouse' as window behavior (No mouse click when the mouse pointer is back from the menu entry).

(5) Use Emulate3Buttons "on" (X11) even for a 3-button mouse. Pressing left and right button simultaneously without moving your fingers is faster than moving a finger to the middle button (which is often a wheel).


CREDITS

We thank:

  • Fritz Mehner (vim.org user name: mehner) for a number of things:

    • his plug-ins (bash-support, c-support, perl-support, ...) provided the inspiration and model for this plug-in and the utilized template support
    • parts of the documentation and other material (including the 'ADDITIONAL TIPS' above) are taken from his plug-ins as well
  • Luis Carvalho (Kozure):

For a complete list of people who made contributions to this plug-in, please be so kind as to take a look at the credits:

 :help luasupport-credits

About

Edit Lua scripts in Vim/gVim/Neovim. Insert code snippets, run, compile, and check the code and look up help.

Topics

Resources

Stars

25 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Repository files navigation

Preface

This repository is mainly for the use with plug-in managers.

Have a look at the Screenshot Page.

The development happens in WolfgangMehner/vim-plugins.

Preview Version

This is a preview version!

Notable new feature:

  • Run Lua in a terminal window directly inside the editor.
  • Fully enabled for Neovim.

The terminal window relies on the new +terminal feature, which becomes available with a patch level of approx. 8.0.1000.

Please read the release notes below.


README for lua-support.vim (Version 1.1alpha) / November 22 2020

  • INSTALLATION
  • RELEASE NOTES
  • FILES
  • ADDITIONAL TIPS
  • CREDITS

Lua-IDE for Vim/gVim/Neovim. It is written to considerably speed up writing code in a consistent style. This is done by inserting complete statements, idioms and comments. These code fragments are provided in an extendible template library. This plug-in helps with running and compiling Lua scripts, applying the code checker, and provides quick access to the online documentation of the Lua functions. Please read the documentation.

This plug-in can be used with Vim version 7.3+ and Neovim 0.2.1+.

Lua is: Copyright 1994-2016 Lua.org, PUC-Rio.


INSTALLATION

A system-wide installation for all users can also be done. This will have further effects on how the plug-in works. For a step-by-step instruction, as well as an explanation of the other consequences, please see the help file doc/luasupport.txt or look up the documentation via:

 :help luasupport-system-wide

(1) LINUX

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/.vim/ (find the value of $HOME with :echo $HOME from inside Vim).

(1.0) Save the template files in $HOME/.vim/lua-support/templates/ if you have changed any of them.

(1.1) Copy the zip archive lua-support.zip to $HOME/.vim and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/.vim/autoload/mmtemplates/...
$HOME/.vim/doc/...
$HOME/.vim/plugin/lua-support.vim

(1.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/.vimrc. Create one if there is none or use the file in $HOME/.vim/lua-support/rc as a starting point.

(1.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME/.vim/doc/

(1.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/.vim/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(1.5) Consider additional settings in the file $HOME/.vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your .vimrc and .gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/.vim/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2) WINDOWS

The subdirectories in the zip archive lua-support.zip mirror the directory structure which is needed below the local installation directory $HOME/vimfiles/ (find the value of $HOME with :echo $HOME from inside Vim).

(2.0) Save the template files in $HOME/vimfiles/lua-support/templates/ if you have changed any of them.

(2.1) Copy the zip archive lua-support.zip to $HOME/vimfiles and run

 unzip lua-support.zip

Afterwards, these files should exist:

 $HOME/vimfiles/autoload/mmtemplates/...
$HOME/vimfiles/doc/...
$HOME/vimfiles/plugin/lua-support.vim

(2.2) Loading of plug-in files must be enabled. If not use

 :filetype plugin on

This is the minimal content of the file $HOME/_vimrc. Create one if there is none or use the file in $HOME/vimfiles/lua-support/rc as a starting point.

(2.3) Make the plug-in help accessible by typing the following command on the Vim command line:

 :helptags $HOME\vimfiles\doc\

(2.4) Set at least some personal details. Use the map \ntw inside a Lua buffer or the menu entry:

 Lua -> Snippets -> template setup wizard

It will help you set up the file _runtimepath_/templates/personal.templates. The file is read by all plug-ins supporting this feature to get your personal details. Here is the minimal personalization (my settings as an example):

 SetMacro( 'AUTHOR', 'Wolfgang Mehner' )
SetMacro( 'AUTHORREF', 'WM' )
SetMacro( 'EMAIL', 'wolfgang-mehner@web.de' )
SetMacro( 'ORGANIZATION', '' )
SetMacro( 'COPYRIGHT', 'Copyright (c) |YEAR|, |AUTHOR|' )

Use the file $HOME/vimfiles/templates/lua.templates to customize or add to your Lua template library. It can also be set up via the wizard.

This plug-in ships with templates for Lua's C-API. If you want to use them, please consult the help file :help luasupport-usage-capi.

(Read more about the template system in the plug-in documentation.)

(2.5) Consider additional settings in the file $HOME/_vimrc. The files customization.vimrc and customization.gvimrc are replacements or extensions for your _vimrc and _gvimrc. You may want to use parts of them. The files are documented.

Some settings are specifically for Lua buffers and should be placed in the filetype plug-in. You may copy the file lua-support/rc/lua.vim into the directory $HOME/vimfiles/ftplugin/, or use the settings there as additions to your own filetype plug-in.

(2.6) Make sure the shell is set up correctly. The options shell, shellcmdflag, shellquote, and shellxquote must be set consistently. Compare :help luasupport-troubleshooting.

(3) ADDITIONAL REMARKS

There are a lot of features and options which can be used and influenced:

  • use of the extendible template library
  • automated generation of comments for functions
  • use of the Lua interpreter, compiler and code checker
  • quick access to the online documentation
  • removing the Lua menu

Actions differ for different modes. Please read the documentation:

 :help luasupport

Any problems? See the TROUBLESHOOTING section at the end of the help file doc/luasupport.txt.


RELEASE NOTES

RELEASE NOTES FOR VERSION 1.1alpha

  • Adapt for running under Neovim more smoothly.
  • Add output method 'terminal' for running scripts in a terminal window (requires +terminal).
  • Rename output methods 'vim-io' to 'cmd-line', and 'vim-qf' to 'quickfix', for more consistency (old settings will still work).
  • The templates which are inserted into new files as file skeletons can be specified in the templates library, via the property: Lua::FileSkeleton::Script
  • Add configuration variables g:Lua_Ctrl_j and g:Lua_Ctrl_d to control the creation of the CTRL+J and CTRL+D maps.
  • Update Lua's reference manual to 5.3.6.
  • Move the filetype plug-in for lua to lua-support/rc.
  • Minor changes and bugfixes.

Note: The filetype plug-in has been moved, and is thus not loaded automatically anymore. Copy it from lua-support/rc/ to ftplugin, or add the commands there to your own filetype plug-in.

RELEASE NOTES FOR OLDER VERSIONS

-> see file lua-support/doc/ChangeLog


FILES

README.md
This file.
autoload/mmtemplates/*
The template system.
autoload/mmtoolbox/*
The toolbox (make, ...).
doc/luasupport.txt
The help file for Lua support.
doc/templatesupport.txt
The help file for the template system.
doc/toolbox*.txt
The help files for the toolbox.
plugin/lua-support.vim
The Lua plug-in for Vim/gVim/Neovim.
lua-support/templates/Templates
Lua main template file.
lua-support/templates/*.templates
Several dependent template files.

The following files and extensions are for convenience only.lua-support.vim will work without them.The settings are explained in the files themselves.

ftdetect/template.vim
ftplugin/template.vim
syntax/template.vim
Additional files for working with templates.
lua-support/codesnippets/*
Some Lua code snippets as a starting point.
lua-support/doc/ChangeLog
Complete change log.
lua-support/rc/additions.gvimrc
Additional settings for use in .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/additions.vimrc
Example settings for use in .vimrc:
setup of the plug-in
lua-support/rc/customization.gvimrc
Suggestion for the configuration file .gvimrc:
hot keys, mouse settings, fonts, ...
lua-support/rc/customization.vimrc
Suggestion for the configuration file .vimrc:
hot keys, tabstop, use of dictionaries,
the setup of the plug-in, ...
lua-support/rc/lua.vim
Example filetype plug-in for Lua:
defines additional maps
lua-support/rc/*.templates
Sample template files for customization. Used by the
template setup wizard.

ADDITIONAL TIPS

(1) You may want to use a central hidden directory for all your backup files:

1.1 Add the following line to .vimrc:

 set backupdir=$HOME/.vim.backupdir

1.2 Create $HOME/.vim.backupdir .

1.3 Add the following line to your shell initialization file ~/.profile :

 find $HOME/.vim.backupdir/ -name "*" -type f -mtime +60 -exec rm -f {} \;

When you are logging in all files in the backup directory older then 60 days (-mtime +60) will be removed (60 days is a suggestion, of course). Be sure to backup in shorter terms !

(2) gVim. Toggle 'insert mode' <--> 'normal mode' with the right mouse button (see mapping in file customization.gvimrc).

(3) gVim. Use tear off menus.

(4) Try 'Focus under mouse' as window behavior (No mouse click when the mouse pointer is back from the menu entry).

(5) Use Emulate3Buttons "on" (X11) even for a 3-button mouse. Pressing left and right button simultaneously without moving your fingers is faster than moving a finger to the middle button (which is often a wheel).


CREDITS

We thank:

  • Fritz Mehner (vim.org user name: mehner) for a number of things:

    • his plug-ins (bash-support, c-support, perl-support, ...) provided the inspiration and model for this plug-in and the utilized template support
    • parts of the documentation and other material (including the 'ADDITIONAL TIPS' above) are taken from his plug-ins as well
  • Luis Carvalho (Kozure):

For a complete list of people who made contributions to this plug-in, please be so kind as to take a look at the credits:

 :help luasupport-credits

About

Edit Lua scripts in Vim/gVim/Neovim. Insert code snippets, run, compile, and check the code and look up help.

Topics

Resources

Stars

25 stars

Watchers

3 watching

Forks

Releases

Packages

Contributors

Languages