Skip to content

docs: Adds a paragraph about lua being a real programming language. #1446

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 7 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 37 additions & 0 deletions init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,43 @@ I hope you enjoy your Neovim journey,

P.S. You can delete this when you're done too. It's your config now! :)
--]]
--
--
-- One last note before we leave you to explore: Lua is a real programming language.
-- Why is that important? First of all, that you can use all the features of Lua,
-- like variables, conditionals, loops and functions. Secondly, that you can interact with
-- neovim in a concise way. The following lines contain two examples that might give you some inspiration.
-- This snippet adds a keymap to open a predefined file in a new tab:
--
-- local function open_notes()
-- vim.cmd 'tabnew'
-- vim.cmd 'tabnext'
-- local command = 'e' .. '/full_path/to_file' -- '..' is the build in string concatenation
-- vim.cmd(command)
-- end
-- vim.keymap.set('n', '<leader>m', open_notes)
--
-- This is interesting because there are certainly plugins out there
-- that provide this functionallity in a sophisticated manner.
-- But a plugin might change, might not provide the options you like,
-- or you might not use this feature at all. If you do not use it,
-- simply delete this code and you are done. If you like it, you
-- may expand to what you need and nothing else. And if this is to
-- much work, you might end up using the plugin anyway, but based
-- on valid effidence that you like this feature.
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

effidence

is this a normative word? As a non-native speaker, I suspect it's not a standard English word.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excactly, you spotted a typo. I should have been more thorough on these.

--
-- The following snippet loads/executes some lua file when a specific file is opened:
--
-- if vim.fn.expand("%") == "file.txt" then
-- vim.cmd("so ./additional_config.lua")
-- end
--
-- One use-case could be a journal where the script.lua automatically moves your cursor
-- to the end of file and inserts the curent date when you open it. (This suggestion is certainly not
-- the easiest example, but that it is possible at all should get your mind racing
-- with possibilities.)
--
-- Good luck tinkering :)

-- Set <space> as the leader key
-- See `:help mapleader`
Expand Down