dotfiles/home/.config/nvim/init.lua

32 lines
898 B
Lua
Raw Normal View History

2021-12-05 21:33:23 +00:00
local vim = require("vim")
local fn = vim.fn
-- Define some global functions which can then be called
-- in the other required scripts
-- Load an arbitrary .vim or .lua file
function LoadFile(file_path)
local extension = file_path:match("^.+(%..+)$")
local run_cmd
if (extension == ".vim") then run_cmd = "source" else run_cmd = "luafile" end
fn.execute(run_cmd .. " " .. file_path)
end
-- Define a key mapping
function Keymap(mode, shortcut, command, options)
-- Assume silent, noremap unless specified otherwise
local opts = {noremap=true, silent=true}
if options then opts = vim.tbl_extend("force", opts, options) end
vim.api.nvim_set_keymap(mode, shortcut, command, opts)
end
-- Require additional scripts which contain individual configurations
require "base"
require "theme"
require "mappings"
require "abbreviations"
require "autocmd"
require "plugins"