summaryrefslogtreecommitdiff
path: root/lua
diff options
context:
space:
mode:
authorVito G. Graffagnino <vito@graffagnino.xyz>2022-06-04 20:47:17 +0100
committerVito G. Graffagnino <vito@graffagnino.xyz>2022-06-04 20:47:17 +0100
commitb9015658d092fb7e6c7319802c9bf6a66ba1d297 (patch)
tree8a238164fa9a496e234c678ff78e9fcb35903a98 /lua
parentf5c8925f14f57e4768ab105ec3089aa39e664d0a (diff)
Created after/ftplugin directory and lua.lua file to allow lua directory
to be recognised by the gf command.
Diffstat (limited to 'lua')
-rw-r--r--lua/user/lsp/lsp-installer.lua2
-rw-r--r--lua/user/lsp/settings/r_language_server.lua2
-rw-r--r--lua/user/lua.lua77
-rw-r--r--lua/user/plugins.lua1
-rw-r--r--lua/user/whichkey.lua2
5 files changed, 4 insertions, 80 deletions
diff --git a/lua/user/lsp/lsp-installer.lua b/lua/user/lsp/lsp-installer.lua
index 2057007..f86b7b7 100644
--- a/lua/user/lsp/lsp-installer.lua
+++ b/lua/user/lsp/lsp-installer.lua
@@ -51,7 +51,7 @@ lsp_installer.on_server_ready(function(server)
opts = vim.tbl_deep_extend("force", html_opts, opts)
end
- if server.name == "ltex" then
+ if server.name == "ltex-ls" then
local ltex_opts = require("user.lsp.settings.ltex")
opts = vim.tbl_deep_extend("force", ltex_opts, opts)
end
diff --git a/lua/user/lsp/settings/r_language_server.lua b/lua/user/lsp/settings/r_language_server.lua
index fbe8846..d7e242d 100644
--- a/lua/user/lsp/settings/r_language_server.lua
+++ b/lua/user/lsp/settings/r_language_server.lua
@@ -2,7 +2,7 @@ return {
settings = {
R = {
- filetypes = { 'r' },
+ filetypes = { 'r','rmd' },
single_file_support = true,
}
}
diff --git a/lua/user/lua.lua b/lua/user/lua.lua
deleted file mode 100644
index a37b3e7..0000000
--- a/lua/user/lua.lua
+++ /dev/null
@@ -1,77 +0,0 @@
-local fmt = string.format
-
--- Iterator that splits a string o a given delimiter
-local function split(str, delim)
- delim = delim or "%s"
- return string.gmatch(str, fmt('[^%s]+', delim))
-end
-
--- Find the proper directory separator depending
--- on lua installation or OS.
-local function dir_separator()
- -- Look at package.config for directory separator string (it's the first line)
- if package.config then
- return string.match(package.config, '^[^\n]')
- else
- return '/'
- end
-end
-
--- Search for lua traditional include paths.
--- This mimics how require internally works.
-local function include_paths(fname, ext)
- ext = ext or "lua"
- local sep = dir_separator()
- local paths = string.gsub(package.path, '%?', fname)
- for path in split(paths, "%;") do
- if vim.fn.filereadable(path) == 1 then
- return path
- end
- end
-end
-
--- Search for nvim lua include paths
-local function include_rtpaths(fname, ext)
- ext = ext or "lua"
- local sep = dir_separator()
- local rtpaths = vim.api.nvim_list_runtime_paths()
- local modfile, initfile = fmt('%s.%s', fname, ext), fmt('init.%s', ext)
- for _, path in ipairs(rtpaths) do
- -- Look on runtime path for 'lua/*.lua' files
- local path1 = table.concat({path, ext, modfile}, sep)
- if vim.fn.filereadable(path1) == 1 then
- return path1
- end
- -- Look on runtime path for 'lua/*/init.lua' files
- local path2 = table.concat({path, ext, fname, initfile}, sep)
- if vim.fn.filereadable(path2) == 1 then
- return path2
- end
- end
-end
-
--- Global function that searches the path for the required file
-function find_required_path(module)
- -- Look at package.config for directory separator string (it's the first line)
- local sep = string.match(package.config, '^[^\n]')
- -- Properly change '.' to separator (probably '/' on *nix and '\' on Windows)
- local fname = vim.fn.substitute(module, "\\.", sep, "g")
- local f
- ---- First search for lua modules
- f = include_paths(fname, 'lua')
- if f then return f end
- -- This part is just for nvim modules
- f = include_rtpaths(fname, 'lua')
- if f then return f end
- ---- Now search for Fennel modules
- f = include_paths(fname, 'fnl')
- if f then return f end
- -- This part is just for nvim modules
- f = include_rtpaths(fname, 'fnl')
- if f then return f end
-end
-
-
--- Set options to open require with gf
-vim.opt_local.include = [=[\v<((do|load)file|require)\s*\(?['"]\zs[^'"]+\ze['"]]=]
-vim.opt_local.includeexpr = "v:lua.find_required_path(v:fname)"
diff --git a/lua/user/plugins.lua b/lua/user/plugins.lua
index 6008cd7..c528f95 100644
--- a/lua/user/plugins.lua
+++ b/lua/user/plugins.lua
@@ -56,6 +56,7 @@ return packer.startup(function(use)
use "numToStr/Comment.nvim" -- Easily comment stuff
use "nvim-lualine/lualine.nvim"
use "windwp/nvim-autopairs" -- Autopairs, integrates with both cmp and treesitter
+ use "vimwiki/vimwiki"
-- Colorschemes
use "lunarvim/colorschemes" -- A bunch of colorschemes you can try out
diff --git a/lua/user/whichkey.lua b/lua/user/whichkey.lua
index 3d7abca..8a1bd2a 100644
--- a/lua/user/whichkey.lua
+++ b/lua/user/whichkey.lua
@@ -108,7 +108,7 @@ local mappings = {
g = {
name = "Git",
- g = { "<cmd>lua _LAZYGIT_TOGGLE()<CR>", "Lazygit" },
+ G = { "<cmd>lua _LAZYGIT_TOGGLE()<CR>", "Lazygit" },
j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
l = { "<cmd>lua require 'gitsigns'.blame_line()<cr>", "Blame" },