From b21c5c20a6463f29cf9530529c14fa3cbdf191db Mon Sep 17 00:00:00 2001 From: Iron_E Date: Wed, 29 Apr 2020 15:01:59 -0400 Subject: [PATCH] Initial commit --- .gitignore | 64 +++++++++++++++++++++++++++++++++++ README.md | 12 +++++++ autoload/libmodal.vim | 9 +++++ lua/libmodal/init.lua | 16 +++++++++ lua/libmodal/src/libmodal.lua | 15 ++++++++ lua/libmodal/src/mode.lua | 31 +++++++++++++++++ lua/libmodal/src/prompt.lua | 30 ++++++++++++++++ lua/libmodal/src/utils.lua | 20 +++++++++++ plugin/libmodal.vim | 17 ++++++++++ 9 files changed, 214 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100644 autoload/libmodal.vim create mode 100644 lua/libmodal/init.lua create mode 100644 lua/libmodal/src/libmodal.lua create mode 100644 lua/libmodal/src/mode.lua create mode 100644 lua/libmodal/src/prompt.lua create mode 100644 lua/libmodal/src/utils.lua create mode 100644 plugin/libmodal.vim diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..856cd6b --- /dev/null +++ b/.gitignore @@ -0,0 +1,64 @@ +# create by https://github.com/iamcco/coc-gitignore (Wed Apr 29 2020 15:01:50 GMT-0400 (Eastern Daylight Time)) +# Vim.gitignore: +# Swap +[._]*.s[a-v][a-z] +[._]*.sw[a-p] +[._]s[a-rt-v][a-z] +[._]ss[a-gi-z] +[._]sw[a-p] + +# Session +Session.vim +Sessionx.vim + +# Temporary +.netrwhist +*~ +# Auto-generated tag files +tags +# Persistent undo +[._]*.un~ + +# create by https://github.com/iamcco/coc-gitignore (Wed Apr 29 2020 15:01:55 GMT-0400 (Eastern Daylight Time)) +# Lua.gitignore: +# Compiled Lua sources +luac.out + +# luarocks build files +*.src.rock +*.zip +*.tar.gz + +# Object files +*.o +*.os +*.ko +*.obj +*.elf + +# Precompiled Headers +*.gch +*.pch + +# Libraries +*.lib +*.a +*.la +*.lo +*.def +*.exp + +# Shared objects (inc. Windows DLLs) +*.dll +*.so +*.so.* +*.dylib + +# Executables +*.exe +*.out +*.app +*.i*86 +*.x86_64 +*.hex + diff --git a/README.md b/README.md new file mode 100644 index 0000000..4285924 --- /dev/null +++ b/README.md @@ -0,0 +1,12 @@ +# About + +This is a rewrite of [vim-libmodal](https://github.com/Iron-E/vim-libmodal) using Neovim's Lua API. + +Unfortunately, during `vim-libmodal`'s development several problems with Vimscript became apparent. Because of this, I have decided to rewrite it using Lua. This project aims to be cross-compatable with `vim-libmodal` version 2.4.0, with the only alterations being _additions_ to the source code that have been made under the 2.x.y revision number. + +Note that cross-compatability does not mean that `vim-libmodal` and `nvim-libmodal` can be installed at the same time— as a matter of fact, they are developed specifically to replace each other for specific platforms. If you use Vim, use `vim-libmodal`. If you use Neovim, use `nvim-libmodal`. If you are a plugin creator, all code that works for `vim-libmodal` will work with `nvim-libmodal`, but the reverse is not true. + +# Requirements + +* Neovim 0.4+ +* `vim-libmodal` is _not_ installed. diff --git a/autoload/libmodal.vim b/autoload/libmodal.vim new file mode 100644 index 0000000..544190b --- /dev/null +++ b/autoload/libmodal.vim @@ -0,0 +1,9 @@ +" PLACEHOLDER. +function! libmodal#Enter(...) abort + echo '' +endfunction + +" PLACEHOLDER. +function! libmodal#Prompt(...) abort + echo '' +endfunction diff --git a/lua/libmodal/init.lua b/lua/libmodal/init.lua new file mode 100644 index 0000000..d2ec90c --- /dev/null +++ b/lua/libmodal/init.lua @@ -0,0 +1,16 @@ +--[[ + /* + * MODULE + */ +]] +local libmodal = require('src.libmodal') +libmodal.mode = require('src.mode') +libmodal.prompt = require('src.prompt') +libmodal.utils = require('src.utils') + +--[[ + /* + * PUBLICIZE MODULE + */ +]] +return libmodal diff --git a/lua/libmodal/src/libmodal.lua b/lua/libmodal/src/libmodal.lua new file mode 100644 index 0000000..1714b46 --- /dev/null +++ b/lua/libmodal/src/libmodal.lua @@ -0,0 +1,15 @@ +--[[ + /* + * MODULE + */ +]] +local libmodal = {} + +-- TODO + +--[[ + /* + * PUBLICIZE MODULE + */ +]] +return libmodal diff --git a/lua/libmodal/src/mode.lua b/lua/libmodal/src/mode.lua new file mode 100644 index 0000000..ceccef9 --- /dev/null +++ b/lua/libmodal/src/mode.lua @@ -0,0 +1,31 @@ +--[[ + /* + * IMPORTS + */ +]] +local libmodal = require('src.libmodal') + +--[[ + /* + * MODULE + */ +]] +libmodal.mode = {} + +--[[SUMMARY: Enter a mode. + + PARAMETERS: + `args[1]` => the mode name. + `args[2]` => the mode callback, or mode combo table. + `args[3]` => optional exit supresion flag. +]] +function libmodal.mode.enter(...) + local args = {...} +end + +--[[ + /* + * PUBLICIZE MODULE + */ +]] +return libmodal.mode diff --git a/lua/libmodal/src/prompt.lua b/lua/libmodal/src/prompt.lua new file mode 100644 index 0000000..1020c24 --- /dev/null +++ b/lua/libmodal/src/prompt.lua @@ -0,0 +1,30 @@ +--[[ + /* + * IMPORTS + */ +]] +local libmodal = require('src.libmodal') + +--[[ + /* + * MODULE + */ +]] +libmodal.prompt = {} + +--[[SUMMARY: Enter a prompt. + + PARAMETERS: + `args[1]` => the prompt name. + `args[2]` => the prompt callback, or mode command table. +]] +function libmodal.prompt.enter(...) + local args = {...} +end + +--[[ + /* + * PUBLICIZE MODULE + */ +]] +return libmodal.prompt diff --git a/lua/libmodal/src/utils.lua b/lua/libmodal/src/utils.lua new file mode 100644 index 0000000..b36f6d6 --- /dev/null +++ b/lua/libmodal/src/utils.lua @@ -0,0 +1,20 @@ +--[[ + /* + * IMPORTS + */ +]] +local libmodal = require('src.libmodal') + +--[[ + /* + * MODULE + */ +]] +libmodal.utils = {} + +--[[ + /* + * PUBLICIZE MODULE + */ +]] +return libmodal.utils diff --git a/plugin/libmodal.vim b/plugin/libmodal.vim new file mode 100644 index 0000000..c770303 --- /dev/null +++ b/plugin/libmodal.vim @@ -0,0 +1,17 @@ +if exists('g:loaded_libmodal') + finish +endif +let g:loaded_libmodal = 1 + +if !exists('g:libmodalTimeouts') + let g:libmodalTimeouts = &timeout +endif + +" ************************************************************ +" * User Configuration +" ************************************************************ + +" The default highlight groups (for colors) are specified below. +" Change these default colors by defining or linking the corresponding highlight group. +highlight default link LibmodalPrompt ModeMsg +highlight default link LibmodalStar StatusLine