summaryrefslogtreecommitdiff
path: root/.config/nvim/lua/core
diff options
context:
space:
mode:
authorGustaf Rydholm <gustaf.rydholm@gmail.com>2021-08-15 13:54:15 +0200
committerGustaf Rydholm <gustaf.rydholm@gmail.com>2021-08-15 13:54:15 +0200
commit977990584331307dd5e71ebbbbd6b45b9c961996 (patch)
treea8b3d78e80f586da192a576dd678e2fbc8ac8e00 /.config/nvim/lua/core
parent99d00f47fe780dbb021149db2f93d202a2b8b025 (diff)
Updates to nvim lsp
Diffstat (limited to '.config/nvim/lua/core')
-rw-r--r--.config/nvim/lua/core/autocmds.lua4
-rw-r--r--.config/nvim/lua/core/compe.lua20
-rw-r--r--.config/nvim/lua/core/dashboard.lua40
-rw-r--r--.config/nvim/lua/core/galaxyline.lua24
-rw-r--r--.config/nvim/lua/core/info.lua46
-rw-r--r--.config/nvim/lua/core/log.lua6
-rw-r--r--.config/nvim/lua/core/nvimtree.lua10
-rw-r--r--.config/nvim/lua/core/telescope.lua3
-rw-r--r--.config/nvim/lua/core/terminal.lua6
-rw-r--r--.config/nvim/lua/core/which-key.lua15
10 files changed, 122 insertions, 52 deletions
diff --git a/.config/nvim/lua/core/autocmds.lua b/.config/nvim/lua/core/autocmds.lua
index 959ae15..33dea53 100644
--- a/.config/nvim/lua/core/autocmds.lua
+++ b/.config/nvim/lua/core/autocmds.lua
@@ -56,6 +56,10 @@ options.autocommands = {
-- {'BufWinEnter', '.gmi', 'setlocal filetype=markdown'}, {'BufRead', '*.gmi', 'setlocal filetype=markdown'},
-- {'BufNewFile', '*.gmi', 'setlocal filetype=markdown'}
-- },
+ _git = {
+ { "FileType", "gitcommit", "setlocal wrap" },
+ { "FileType", "gitcommit", "setlocal spell" },
+ },
_markdown = {
{ "FileType", "markdown", "setlocal wrap" },
{ "FileType", "markdown", "setlocal spell" },
diff --git a/.config/nvim/lua/core/compe.lua b/.config/nvim/lua/core/compe.lua
index 3291918..14fba1a 100644
--- a/.config/nvim/lua/core/compe.lua
+++ b/.config/nvim/lua/core/compe.lua
@@ -45,10 +45,22 @@ M.config = function()
insert_mode = {
-- ["<Tab>"] = { 'pumvisible() ? "<C-n>" : "<Tab>"', { silent = true, noremap = true, expr = true } },
-- ["<S-Tab>"] = { 'pumvisible() ? "<C-p>" : "<S-Tab>"', { silent = true, noremap = true, expr = true } },
- ["<C-Space>"] = { "compe#complete()", { silent = true, noremap = true, expr = true } },
- ["<C-e>"] = { "compe#close('<C-e>')", { silent = true, noremap = true, expr = true } },
- ["<C-f>"] = { "compe#scroll({ 'delta': +4 })", { silent = true, noremap = true, expr = true } },
- ["<C-d>"] = { "compe#scroll({ 'delta': -4 })", { silent = true, noremap = true, expr = true } },
+ ["<C-Space>"] = {
+ "compe#complete()",
+ { silent = true, noremap = true, expr = true },
+ },
+ ["<C-e>"] = {
+ "compe#close('<C-e>')",
+ { silent = true, noremap = true, expr = true },
+ },
+ ["<C-f>"] = {
+ "compe#scroll({ 'delta': +4 })",
+ { silent = true, noremap = true, expr = true },
+ },
+ ["<C-d>"] = {
+ "compe#scroll({ 'delta': -4 })",
+ { silent = true, noremap = true, expr = true },
+ },
},
},
opts = {
diff --git a/.config/nvim/lua/core/dashboard.lua b/.config/nvim/lua/core/dashboard.lua
index c868540..efbb790 100644
--- a/.config/nvim/lua/core/dashboard.lua
+++ b/.config/nvim/lua/core/dashboard.lua
@@ -4,24 +4,24 @@ M.config = function()
active = false,
search_handler = "telescope",
custom_header = {
- ' ##############..... ############## ',
- ' ##############......############## ',
- ' ##########..........########## ',
- ' ##########........########## ',
- ' ##########.......########## ',
- ' ##########.....##########.. ',
- ' ##########....##########..... ',
- ' ..##########..##########......... ',
- ' ....##########.#########............. ',
- ' ..################JJJ............ ',
- ' ################............. ',
- ' ##############.JJJ.JJJJJJJJJJ ',
- ' ############...JJ...JJ..JJ JJ ',
- ' ##########....JJ...JJ..JJ JJ ',
- ' ########......JJJ..JJJ JJJ JJJ ',
- ' ###### ......... ',
- ' ..... ',
- ' . ',
+ " ##############..... ############## ",
+ " ##############......############## ",
+ " ##########..........########## ",
+ " ##########........########## ",
+ " ##########.......########## ",
+ " ##########.....##########.. ",
+ " ##########....##########..... ",
+ " ..##########..##########......... ",
+ " ....##########.#########............. ",
+ " ..################JJJ............ ",
+ " ################............. ",
+ " ##############.JJJ.JJJJJJJJJJ ",
+ " ############...JJ...JJ..JJ JJ ",
+ " ##########....JJ...JJ..JJ JJ ",
+ " ########......JJJ..JJJ JJJ JJJ ",
+ " ###### ......... ",
+ " ..... ",
+ " . ",
},
custom_section = {
@@ -42,7 +42,6 @@ M.config = function()
command = ":e ~/.config/nvim/config.lua",
},
},
-
}
end
@@ -88,7 +87,8 @@ M.setup = function()
{
"FileType",
"dashboard",
- "set showtabline=0 | autocmd BufLeave <buffer> set showtabline=" .. vim.opt.showtabline._value,
+ "set showtabline=0 | autocmd BufLeave <buffer> set showtabline="
+ .. vim.opt.showtabline._value,
},
{ "FileType", "dashboard", "nnoremap <silent> <buffer> q :q<CR>" },
},
diff --git a/.config/nvim/lua/core/galaxyline.lua b/.config/nvim/lua/core/galaxyline.lua
index ff8c59a..f7fa8c9 100644
--- a/.config/nvim/lua/core/galaxyline.lua
+++ b/.config/nvim/lua/core/galaxyline.lua
@@ -22,19 +22,19 @@ table.insert(gls.left, {
ViMode = {
provider = function()
local alias = {
- n = 'NORMAL',
- i = 'INSERT',
- c = 'COMMAND',
- V = 'VISUAL',
- [''] = 'VISUAL',
- v = 'VISUAL',
- R = 'REPLACE',
+ n = "NORMAL",
+ i = "INSERT",
+ c = "COMMAND",
+ V = "VISUAL",
+ [""] = "VISUAL",
+ v = "VISUAL",
+ R = "REPLACE",
}
local alias_mode = alias[vim.fn.mode()]
if alias_mode == nil then
alias_mode = vim.fn.mode()
end
- return alias_mode..' '
+ return alias_mode .. " "
end,
separator_highlight = { "NONE", colors.alt_bg },
highlight = { colors.grey, colors.alt_bg },
@@ -193,19 +193,23 @@ table.insert(gls.right, {
local function get_attached_provider_name(msg)
msg = msg or "LSP Inactive"
+
local buf_clients = vim.lsp.buf_get_clients()
if next(buf_clients) == nil then
return msg
end
- local buf_ft = vim.bo.filetype
+
local buf_client_names = {}
- local null_ls_providers = require("lsp.null-ls").get_registered_providers_by_filetype(buf_ft)
for _, client in pairs(buf_clients) do
if client.name ~= "null-ls" then
table.insert(buf_client_names, client.name)
end
end
+
+ local null_ls = require "lsp.null-ls"
+ local null_ls_providers = null_ls.list_supported_provider_names(vim.bo.filetype)
vim.list_extend(buf_client_names, null_ls_providers)
+
return table.concat(buf_client_names, ", ")
end
diff --git a/.config/nvim/lua/core/info.lua b/.config/nvim/lua/core/info.lua
index c9d34ce..5b7ef53 100644
--- a/.config/nvim/lua/core/info.lua
+++ b/.config/nvim/lua/core/info.lua
@@ -136,10 +136,20 @@ function M.toggle_popup(ft)
local lsp_info = {
"Associated language-server: " .. client.name,
- indent .. "* Active: " .. tostring(is_client_active) .. ", id: " .. tostring(client.id),
- indent .. "* Formatting support: " .. tostring(client.resolved_capabilities.document_formatting),
- indent .. "* Capabilities list: " .. table.concat(vim.list_slice(client_enabled_caps, 1, num_caps / 2), ", "),
- indent .. indent .. indent .. table.concat(vim.list_slice(client_enabled_caps, ((num_caps / 2) + 1)), ", "),
+ indent .. "* Active: " .. tostring(is_client_active) .. ", id: " .. tostring(
+ client.id
+ ),
+ indent .. "* Formatting support: " .. tostring(
+ client.resolved_capabilities.document_formatting
+ ),
+ indent .. "* Capabilities list: " .. table.concat(
+ vim.list_slice(client_enabled_caps, 1, num_caps / 2),
+ ", "
+ ),
+ indent .. indent .. indent .. table.concat(
+ vim.list_slice(client_enabled_caps, ((num_caps / 2) + 1)),
+ ", "
+ ),
"",
}
vim.list_extend(buf_lines, lsp_info)
@@ -152,13 +162,19 @@ function M.toggle_popup(ft)
local missing_formatters_status
if vim.tbl_count(missing_formatters) > 0 then
- missing_formatters_status = { "Missing formatters: " .. table.concat(missing_formatters, "  , ") .. "  ", "" }
+ missing_formatters_status = {
+ "Missing formatters: " .. table.concat(missing_formatters, "  , ") .. "  ",
+ "",
+ }
vim.list_extend(buf_lines, missing_formatters_status)
end
local missing_linters_status
if vim.tbl_count(missing_linters) > 0 then
- missing_linters_status = { "Missing linters: " .. table.concat(missing_linters, "  , ") .. "  ", "" }
+ missing_linters_status = {
+ "Missing linters: " .. table.concat(missing_linters, "  , ") .. "  ",
+ "",
+ }
vim.list_extend(buf_lines, missing_linters_status)
end
@@ -170,9 +186,21 @@ function M.toggle_popup(ft)
--TODO: highlighting is either inconsistent or not working :\
vim.cmd("syntax match Identifier /filetype is: .*\\zs\\<" .. ft .. "\\>/")
vim.cmd("syntax match Identifier /server: .*\\zs\\<" .. client.name .. "\\>/")
- vim.cmd("syntax match Identifier /providers: .*\\zs\\<" .. table.concat(null_ls_providers, ", ") .. "\\>/")
- vim.cmd("syntax match Identifier /formatters: .*\\zs\\<" .. table.concat(missing_formatters, ", ") .. "\\>/")
- vim.cmd("syntax match Identifier /linters: .*\\zs\\<" .. table.concat(missing_linters, ", ") .. "\\>/")
+ vim.cmd(
+ "syntax match Identifier /providers: .*\\zs\\<"
+ .. table.concat(null_ls_providers, ", ")
+ .. "\\>/"
+ )
+ vim.cmd(
+ "syntax match Identifier /formatters: .*\\zs\\<"
+ .. table.concat(missing_formatters, ", ")
+ .. "\\>/"
+ )
+ vim.cmd(
+ "syntax match Identifier /linters: .*\\zs\\<"
+ .. table.concat(missing_linters, ", ")
+ .. "\\>/"
+ )
end
return M.create_simple_popup(buf_lines, set_syntax_hl)
diff --git a/.config/nvim/lua/core/log.lua b/.config/nvim/lua/core/log.lua
index d364ffb..e6f7afe 100644
--- a/.config/nvim/lua/core/log.lua
+++ b/.config/nvim/lua/core/log.lua
@@ -10,7 +10,11 @@ function Log:new(opts)
end
local obj = require("plenary.log").new(opts)
- local path = string.format("%s/%s.log", vim.api.nvim_call_function("stdpath", { "cache" }), opts.plugin)
+ local path = string.format(
+ "%s/%s.log",
+ vim.api.nvim_call_function("stdpath", { "cache" }),
+ opts.plugin
+ )
obj.get_path = function()
return path
diff --git a/.config/nvim/lua/core/nvimtree.lua b/.config/nvim/lua/core/nvimtree.lua
index 698bd6e..376ae56 100644
--- a/.config/nvim/lua/core/nvimtree.lua
+++ b/.config/nvim/lua/core/nvimtree.lua
@@ -66,6 +66,8 @@ M.setup = function()
{ key = { "l", "<CR>", "o" }, cb = tree_cb "edit" },
{ key = "h", cb = tree_cb "close_node" },
{ key = "v", cb = tree_cb "vsplit" },
+
+ { key = "q", cb = ":lua require('core.nvimtree').toggle_tree()<cr>" },
}
end
end
@@ -93,7 +95,9 @@ M.focus_or_close = function()
end
else
view.open()
- if package.loaded["bufferline.state"] and options.builtin.nvimtree.side == "left" then
+ if
+ package.loaded["bufferline.state"] and options.builtin.nvimtree.side == "left"
+ then
require("bufferline.state").set_offset(options.builtin.nvimtree.width + 1, "")
end
end
@@ -110,7 +114,9 @@ M.toggle_tree = function()
require("bufferline.state").set_offset(0)
end
else
- if package.loaded["bufferline.state"] and options.builtin.nvimtree.side == "left" then
+ if
+ package.loaded["bufferline.state"] and options.builtin.nvimtree.side == "left"
+ then
require("bufferline.state").set_offset(options.builtin.nvimtree.width + 1, "")
end
require("nvim-tree").toggle()
diff --git a/.config/nvim/lua/core/telescope.lua b/.config/nvim/lua/core/telescope.lua
index 2b0a013..513665e 100644
--- a/.config/nvim/lua/core/telescope.lua
+++ b/.config/nvim/lua/core/telescope.lua
@@ -34,7 +34,7 @@ M.config = function()
file_sorter = require("telescope.sorters").get_fzy_sorter,
file_ignore_patterns = {},
generic_sorter = require("telescope.sorters").get_generic_fuzzy_sorter,
- path_display = {"shorten"},
+ path_display = { "shorten" },
winblend = 0,
border = {},
borderchars = { "─", "│", "─", "│", "╭", "╮", "╯", "╰" },
@@ -45,7 +45,6 @@ M.config = function()
grep_previewer = require("telescope.previewers").vim_buffer_vimgrep.new,
qflist_previewer = require("telescope.previewers").vim_buffer_qflist.new,
-
-- Developer configurations: Not meant for general override
-- buffer_previewer_maker = require("telescope.previewers").buffer_previewer_maker,
mappings = {
diff --git a/.config/nvim/lua/core/terminal.lua b/.config/nvim/lua/core/terminal.lua
index 2793da2..ff3f95e 100644
--- a/.config/nvim/lua/core/terminal.lua
+++ b/.config/nvim/lua/core/terminal.lua
@@ -86,7 +86,11 @@ end
M._exec_toggle = function(exec)
local binary = M._split(exec)[1]
if is_installed(binary) ~= true then
- print("Please install executable " .. binary .. ". Check documentation for more information")
+ print(
+ "Please install executable "
+ .. binary
+ .. ". Check documentation for more information"
+ )
return
end
local Terminal = require("toggleterm.terminal").Terminal
diff --git a/.config/nvim/lua/core/which-key.lua b/.config/nvim/lua/core/which-key.lua
index 6227a8e..775ea67 100644
--- a/.config/nvim/lua/core/which-key.lua
+++ b/.config/nvim/lua/core/which-key.lua
@@ -156,8 +156,14 @@ M.config = function()
p = {
name = "Peek",
d = { "<cmd>lua require('lsp.peek').Peek('definition')<cr>", "Definition" },
- t = { "<cmd>lua require('lsp.peek').Peek('typeDefinition')<cr>", "Type Definition" },
- i = { "<cmd>lua require('lsp.peek').Peek('implementation')<cr>", "Implementation" },
+ t = {
+ "<cmd>lua require('lsp.peek').Peek('typeDefinition')<cr>",
+ "Type Definition",
+ },
+ i = {
+ "<cmd>lua require('lsp.peek').Peek('implementation')<cr>",
+ "Implementation",
+ },
},
q = { "<cmd>lua vim.lsp.diagnostic.set_loclist()<cr>", "Quickfix" },
r = { "<cmd>lua vim.lsp.buf.rename()<cr>", "Rename" },
@@ -169,7 +175,10 @@ M.config = function()
},
I = {
name = "+nvim",
- k = { "<cmd>lua require('keymappings').print()<cr>", "View nvim's default keymappings" },
+ k = {
+ "<cmd>lua require('keymappings').print()<cr>",
+ "View nvim's default keymappings",
+ },
i = {
"<cmd>lua require('core.info').toggle_popup(vim.bo.filetype)<cr>",
"Toggle nvim Info",