mirror of
https://github.com/ItsDrike/dotfiles.git
synced 2024-11-10 02:39:40 +00:00
32 lines
901 B
Lua
32 lines
901 B
Lua
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 "options"
|
|
require "theme"
|
|
require "mappings"
|
|
require "abbreviations"
|
|
require "autocmd"
|
|
require "plugins"
|