Compare commits
10 Commits
d417baec56
...
85a34ff49f
Author | SHA1 | Date | |
---|---|---|---|
85a34ff49f | |||
|
e1b14db831 | ||
|
c3509e44d8 | ||
|
a5c06e6707 | ||
|
5e147aec68 | ||
|
0443978eb5 | ||
|
39da199c3a | ||
|
9b4a527c88 | ||
|
6c28c5e9b7 | ||
|
072c9771a5 |
109
init.lua
109
init.lua
@ -31,6 +31,7 @@ require('lazy').setup({
|
||||
-- Automatically install LSPs to stdpath for neovim
|
||||
{ 'williamboman/mason.nvim', config = true },
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||
|
||||
{
|
||||
'j-hui/fidget.nvim',
|
||||
@ -46,7 +47,18 @@ require('lazy').setup({
|
||||
},
|
||||
},
|
||||
|
||||
'folke/neodev.nvim',
|
||||
{
|
||||
-- `lazydev` configures Lua LSP for your Neovim config, runtime and plugins
|
||||
-- used for completion, annotations and signatures of Neovim apis
|
||||
'folke/lazydev.nvim',
|
||||
ft = 'lua',
|
||||
opts = {
|
||||
library = {
|
||||
-- Load luvit types when the `vim.uv` word is found
|
||||
{ path = 'luvit-meta/library', words = { 'vim%.uv' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
@ -136,9 +148,9 @@ vim.wo.number = true
|
||||
-- Enable mouse mode
|
||||
vim.o.mouse = 'a'
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- See `:help 'clipboard'`
|
||||
vim.o.clipboard = 'unnamedplus'
|
||||
vim.schedule(function()
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
end)
|
||||
|
||||
-- Enable break indent
|
||||
vim.o.breakindent = true
|
||||
@ -232,7 +244,7 @@ require('nvim-treesitter.configs').setup {
|
||||
ensure_installed = { 'c', 'go', 'lua', 'python', 'tsx', 'typescript', 'markdown', 'bash', 'html', 'css' },
|
||||
|
||||
-- Autoinstall languages that are not installed. Defaults to false (but you can change for yourself!)
|
||||
auto_install = false,
|
||||
auto_install = true,
|
||||
|
||||
highlight = { enable = true },
|
||||
-- indent = { enable = true },
|
||||
@ -300,36 +312,6 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
|
||||
-- [[ Configure LSP ]]
|
||||
-- This function gets run when an LSP connects to a particular buffer.
|
||||
local on_attach = function(_, bufnr)
|
||||
local nmap = function(keys, func, desc)
|
||||
if desc then
|
||||
desc = 'LSP: ' .. desc
|
||||
end
|
||||
|
||||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
||||
end
|
||||
|
||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
|
||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
||||
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- See `:help K` for why this keymap
|
||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||
nmap('<C-S-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||
|
||||
-- Lesser used LSP functionality
|
||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
||||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||
nmap('<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, '[W]orkspace [L]ist Folders')
|
||||
|
||||
-- Create a command `:Format` local to the LSP buffer
|
||||
vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_)
|
||||
vim.lsp.buf.format()
|
||||
@ -348,8 +330,7 @@ local on_attach = function(_, bufnr)
|
||||
vim.diagnostic.config({ float = { border = "single" } })
|
||||
end
|
||||
local servers = {
|
||||
clangd = {},
|
||||
-- hls = {},
|
||||
ocamllsp = {},
|
||||
gopls = {
|
||||
gopls = {
|
||||
usePlaceholders = true,
|
||||
@ -364,7 +345,8 @@ local servers = {
|
||||
pyright = {},
|
||||
vtsls = {},
|
||||
|
||||
nil_ls = {},
|
||||
|
||||
texlab = {},
|
||||
|
||||
jdtls = {
|
||||
java = {
|
||||
@ -387,32 +369,37 @@ local servers = {
|
||||
},
|
||||
}
|
||||
|
||||
-- Setup neovim lua configuration
|
||||
require('neodev').setup()
|
||||
|
||||
-- nvim-cmp supports additional completion capabilities, so broadcast that to servers
|
||||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities)
|
||||
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
|
||||
-- Ensure the servers above are installed
|
||||
local mason_lspconfig = require 'mason-lspconfig'
|
||||
require('mason').setup()
|
||||
|
||||
mason_lspconfig.setup {
|
||||
ensure_installed = vim.tbl_keys(servers),
|
||||
}
|
||||
local ensure_installed = vim.tbl_keys(servers or {})
|
||||
vim.list_extend(ensure_installed, {
|
||||
'stylua',
|
||||
'black',
|
||||
'prettierd',
|
||||
'gofumpt',
|
||||
'goimports-reviser',
|
||||
'golines',
|
||||
'golangci-lint',
|
||||
})
|
||||
require('mason-tool-installer').setup { ensure_installed = ensure_installed }
|
||||
|
||||
mason_lspconfig.setup_handlers {
|
||||
require('mason-lspconfig').setup {
|
||||
handlers = {
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = servers[server_name],
|
||||
filetypes = (servers[server_name] or {}).filetypes,
|
||||
}
|
||||
end
|
||||
local server = servers[server_name] or {}
|
||||
server.capabilities = vim.tbl_deep_extend('force', {}, capabilities, server.capabilities or {})
|
||||
require('lspconfig')[server_name].setup(server)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
|
||||
local lspconfig = require("lspconfig")
|
||||
|
||||
local mason_registry = require('mason-registry')
|
||||
@ -439,5 +426,17 @@ lspconfig.volar.setup {
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
lspconfig.rust_analyzer.setup {
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
['rust_analyzer'] = {
|
||||
cargo = {
|
||||
allFeatures = true,
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
-- this is for my personal config, i cant bother seeing every TJ's default and changing it to my own
|
||||
require("jabuxas")
|
||||
|
@ -62,35 +62,35 @@ return {
|
||||
},
|
||||
preselect = cmp.PreselectMode.None,
|
||||
completion = {
|
||||
completeopt = "noselect,menuone,menu"
|
||||
},
|
||||
sorting = {
|
||||
-- TODO: Would be cool to add stuff like "See variable names before method names" in rust, or something like that.
|
||||
comparators = {
|
||||
cmp.config.compare.offset,
|
||||
cmp.config.compare.exact,
|
||||
cmp.config.compare.score,
|
||||
|
||||
-- copied from cmp-under, but I don't think I need the plugin for this.
|
||||
-- I might add some more of my own.
|
||||
function(entry1, entry2)
|
||||
local _, entry1_under = entry1.completion_item.label:find("^_+")
|
||||
local _, entry2_under = entry2.completion_item.label:find("^_+")
|
||||
entry1_under = entry1_under or 0
|
||||
entry2_under = entry2_under or 0
|
||||
if entry1_under > entry2_under then
|
||||
return false
|
||||
elseif entry1_under < entry2_under then
|
||||
return true
|
||||
end
|
||||
end,
|
||||
|
||||
cmp.config.compare.kind,
|
||||
cmp.config.compare.sort_text,
|
||||
cmp.config.compare.length,
|
||||
cmp.config.compare.order,
|
||||
},
|
||||
completeopt = "menu,menuone,noinsert"
|
||||
},
|
||||
-- sorting = {
|
||||
-- -- TODO: Would be cool to add stuff like "See variable names before method names" in rust, or something like that.
|
||||
-- comparators = {
|
||||
-- cmp.config.compare.offset,
|
||||
-- cmp.config.compare.exact,
|
||||
-- cmp.config.compare.score,
|
||||
--
|
||||
-- -- copied from cmp-under, but I don't think I need the plugin for this.
|
||||
-- -- I might add some more of my own.
|
||||
-- function(entry1, entry2)
|
||||
-- local _, entry1_under = entry1.completion_item.label:find("^_+")
|
||||
-- local _, entry2_under = entry2.completion_item.label:find("^_+")
|
||||
-- entry1_under = entry1_under or 0
|
||||
-- entry2_under = entry2_under or 0
|
||||
-- if entry1_under > entry2_under then
|
||||
-- return false
|
||||
-- elseif entry1_under < entry2_under then
|
||||
-- return true
|
||||
-- end
|
||||
-- end,
|
||||
--
|
||||
-- cmp.config.compare.kind,
|
||||
-- cmp.config.compare.sort_text,
|
||||
-- cmp.config.compare.length,
|
||||
-- cmp.config.compare.order,
|
||||
-- },
|
||||
-- },
|
||||
mapping = cmp.mapping.preset.insert {
|
||||
['<C-p>'] = cmp.mapping.select_next_item(),
|
||||
['<C-n>'] = cmp.mapping.select_prev_item(),
|
||||
@ -121,30 +121,34 @@ return {
|
||||
end, { 'i', 's' }),
|
||||
},
|
||||
sources = {
|
||||
{
|
||||
name = 'lazydev',
|
||||
-- set group index to 0 to skip loading LuaLS completions as lazydev recommends it
|
||||
group_index = 0,
|
||||
},
|
||||
{ name = 'nvim_lsp' },
|
||||
{ name = "orgmode" },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'path' },
|
||||
{ name = 'buffer' },
|
||||
},
|
||||
formatting = {
|
||||
fields = { "abbr", "menu", "kind" },
|
||||
format = require('lspkind').cmp_format({
|
||||
mode = 'symbol_text', -- show only symbol annotations
|
||||
maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
||||
-- can also be a function to dynamically calculate max width such as
|
||||
-- maxwidth = function() return math.floor(0.45 * vim.o.columns) end,
|
||||
ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
|
||||
show_labelDetails = true, -- show labelDetails in menu. Disabled by default
|
||||
|
||||
-- The function below will be called before any actual modifications from lspkind
|
||||
-- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
|
||||
})
|
||||
},
|
||||
window = {
|
||||
completion = cmp.config.window.bordered(winhighlight),
|
||||
documentation = cmp.config.window.bordered(winhighlight),
|
||||
},
|
||||
-- formatting = {
|
||||
-- fields = { "abbr", "menu", "kind" },
|
||||
-- format = require('lspkind').cmp_format({
|
||||
-- mode = 'symbol_text', -- show only symbol annotations
|
||||
-- maxwidth = 50, -- prevent the popup from showing more than provided characters (e.g 50 will not show more than 50 characters)
|
||||
-- -- can also be a function to dynamically calculate max width such as
|
||||
-- -- maxwidth = function() return math.floor(0.45 * vim.o.columns) end,
|
||||
-- ellipsis_char = '...', -- when popup menu exceed maxwidth, the truncated part would show ellipsis_char instead (must define maxwidth first)
|
||||
-- show_labelDetails = true, -- show labelDetails in menu. Disabled by default
|
||||
--
|
||||
-- -- The function below will be called before any actual modifications from lspkind
|
||||
-- -- so that you can provide more controls on popup customization. (See [#30](https://github.com/onsails/lspkind-nvim/pull/30))
|
||||
-- })
|
||||
-- },
|
||||
-- window = {
|
||||
-- completion = cmp.config.window.bordered(winhighlight),
|
||||
-- documentation = cmp.config.window.bordered(winhighlight),
|
||||
-- },
|
||||
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
|
@ -117,20 +117,16 @@ elseif fileContent == "solarized" then
|
||||
'maxmx03/solarized.nvim',
|
||||
lazy = false,
|
||||
priority = 1000,
|
||||
config = function()
|
||||
vim.o.background = 'dark'
|
||||
vim.o.termguicolors = true
|
||||
|
||||
require('solarized').setup({
|
||||
enables = {
|
||||
bufferline = true,
|
||||
cmp = true
|
||||
---@type solarized.config
|
||||
opts = {
|
||||
palette = 'solarized',
|
||||
styles = {
|
||||
comments = { italic = true, bold = false }
|
||||
},
|
||||
pallete = "solarized",
|
||||
theme = "neo",
|
||||
transparent = true,
|
||||
})
|
||||
|
||||
},
|
||||
config = function(_, opts)
|
||||
vim.o.termguicolors = true
|
||||
require('solarized').setup(opts)
|
||||
vim.cmd.colorscheme 'solarized'
|
||||
end,
|
||||
}
|
||||
|
@ -1,303 +1,85 @@
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
config = function()
|
||||
local lualine = require("lualine")
|
||||
|
||||
local colors = {
|
||||
blue = "#268bd2",
|
||||
green = "#859900",
|
||||
violet = "#6c71c4",
|
||||
yellow = "#b58900",
|
||||
red = "#dc332f",
|
||||
cream = "#fdf6e3",
|
||||
black = "#002b36",
|
||||
grey = "#073642",
|
||||
dark = "#002b36",
|
||||
}
|
||||
|
||||
local solarized = {
|
||||
normal = {
|
||||
a = { bg = colors.dark, fg = colors.cream, gui = "bold" },
|
||||
c = { bg = colors.grey, fg = colors.cream, gui = "bold" },
|
||||
},
|
||||
insert = {
|
||||
a = { bg = colors.grey, fg = colors.cream, gui = "bold" },
|
||||
c = { bg = colors.black, fg = colors.cream, gui = "bold" },
|
||||
},
|
||||
visual = {
|
||||
a = { bg = colors.violet, fg = colors.black, gui = "bold" },
|
||||
c = { bg = colors.dark, fg = colors.cream, gui = "bold" },
|
||||
},
|
||||
command = {
|
||||
a = { bg = colors.green, fg = colors.black, gui = "bold" },
|
||||
c = { bg = colors.black, fg = colors.cream, gui = "bold" },
|
||||
},
|
||||
replace = {
|
||||
a = { bg = colors.blue, fg = colors.black, gui = "bold" },
|
||||
c = { bg = colors.black, fg = colors.cream, gui = "bold" },
|
||||
},
|
||||
inactive = {
|
||||
a = { bg = colors.green, fg = colors.black, gui = "bold" },
|
||||
c = { bg = colors.black, fg = colors.cream, gui = "bold" },
|
||||
},
|
||||
}
|
||||
|
||||
-- configure lualine with modified theme
|
||||
lualine.setup({
|
||||
options = {
|
||||
theme = solarized,
|
||||
component_separators = { left = "", right = "|" },
|
||||
section_separators = { left = "", right = "" },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
"mode",
|
||||
"branch",
|
||||
"diff",
|
||||
"diagnostics",
|
||||
{
|
||||
-- "buffers",
|
||||
-- buffers_color = {
|
||||
-- active = { bg = colors.yellow, fg = colors.black, gui = "bold" },
|
||||
-- inactive = { bg = colors.grey, fg = colors.cream, gui = "italic" },
|
||||
-- "nvim-lualine/lualine.nvim",
|
||||
-- dependencies = { "nvim-tree/nvim-web-devicons" },
|
||||
-- config = function()
|
||||
-- vim.opt.fillchars = {
|
||||
-- stl = " ",
|
||||
-- stlnc = " ",
|
||||
-- }
|
||||
--
|
||||
-- local lualine = require("lualine")
|
||||
--
|
||||
-- local colors = {
|
||||
-- blue = "#268bd2",
|
||||
-- green = "#859900",
|
||||
-- violet = "#6c71c4",
|
||||
-- yellow = "#b58900",
|
||||
-- red = "#dc332f",
|
||||
-- cream = "#fdf6e3",
|
||||
-- black = "#002b36",
|
||||
-- grey = "#073642",
|
||||
-- dark = "#002b36",
|
||||
-- }
|
||||
--
|
||||
-- local solarized = {
|
||||
-- normal = {
|
||||
-- a = { bg = colors.dark, fg = colors.cream, gui = "bold" },
|
||||
-- c = { bg = colors.grey, fg = colors.cream, gui = "bold" },
|
||||
-- },
|
||||
symbols = {
|
||||
modified = " ●",
|
||||
alternate_file = " ",
|
||||
directory = "",
|
||||
},
|
||||
mode = 2,
|
||||
},
|
||||
},
|
||||
lualine_b = {},
|
||||
lualine_c = {
|
||||
{
|
||||
"filename",
|
||||
file_status = true,
|
||||
path = 3,
|
||||
},
|
||||
},
|
||||
lualine_x = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {
|
||||
"searchcount",
|
||||
"selectioncount",
|
||||
"encoding",
|
||||
"fileformat",
|
||||
"filetype",
|
||||
"progress",
|
||||
"location",
|
||||
},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = { "filename" },
|
||||
lualine_x = { "location" },
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {},
|
||||
})
|
||||
end,
|
||||
-- insert = {
|
||||
-- a = { bg = colors.grey, fg = colors.cream, gui = "bold" },
|
||||
-- c = { bg = colors.black, fg = colors.cream, gui = "bold" },
|
||||
-- },
|
||||
-- visual = {
|
||||
-- a = { bg = colors.violet, fg = colors.black, gui = "bold" },
|
||||
-- c = { bg = colors.dark, fg = colors.cream, gui = "bold" },
|
||||
-- },
|
||||
-- command = {
|
||||
-- a = { bg = colors.green, fg = colors.black, gui = "bold" },
|
||||
-- c = { bg = colors.black, fg = colors.cream, gui = "bold" },
|
||||
-- },
|
||||
-- replace = {
|
||||
-- a = { bg = colors.blue, fg = colors.black, gui = "bold" },
|
||||
-- c = { bg = colors.black, fg = colors.cream, gui = "bold" },
|
||||
-- },
|
||||
-- inactive = {
|
||||
-- a = { bg = colors.green, fg = colors.black, gui = "bold" },
|
||||
-- c = { bg = colors.black, fg = colors.cream, gui = "bold" },
|
||||
-- },
|
||||
-- }
|
||||
--
|
||||
-- -- configure lualine with modified theme
|
||||
-- lualine.setup({
|
||||
-- options = {
|
||||
-- theme = solarized,
|
||||
-- component_separators = { left = "", right = "|" },
|
||||
-- section_separators = { left = "", right = "" },
|
||||
-- },
|
||||
-- sections = {
|
||||
-- lualine_a = {
|
||||
-- "mode",
|
||||
-- },
|
||||
-- lualine_b = {},
|
||||
-- lualine_c = { '%=', { 'filename', file_status = true } },
|
||||
-- lualine_x = {},
|
||||
-- lualine_y = {},
|
||||
-- lualine_z = {
|
||||
-- "location",
|
||||
-- "progress",
|
||||
-- },
|
||||
-- },
|
||||
-- inactive_sections = {
|
||||
-- lualine_a = {},
|
||||
-- lualine_b = {},
|
||||
-- lualine_c = { "filename" },
|
||||
-- lualine_x = { "location" },
|
||||
-- lualine_y = {},
|
||||
-- lualine_z = {},
|
||||
-- },
|
||||
-- tabline = {},
|
||||
-- winbar = {},
|
||||
-- inactive_winbar = {},
|
||||
-- extensions = {},
|
||||
-- })
|
||||
-- end,
|
||||
}
|
||||
|
||||
|
||||
-- config = function()
|
||||
-- local c = require("darkrose.colors").get()
|
||||
-- local lualine = require("lualine")
|
||||
--
|
||||
-- local bg = c.bg_float_bright
|
||||
--
|
||||
-- local conditions = {
|
||||
-- buffer_not_empty = function()
|
||||
-- return vim.fn.empty(vim.fn.expand("%:t")) ~= 1
|
||||
-- end,
|
||||
-- hide_in_width = function()
|
||||
-- return vim.fn.winwidth(0) > 80
|
||||
-- end,
|
||||
-- check_git_workspace = function()
|
||||
-- local filepath = vim.fn.expand("%:p:h")
|
||||
-- local gitdir = vim.fn.finddir(".git", filepath .. ";")
|
||||
-- return gitdir and #gitdir > 0 and #gitdir < #filepath
|
||||
-- end,
|
||||
-- }
|
||||
--
|
||||
-- -- Config
|
||||
-- local config = {
|
||||
-- options = {
|
||||
-- -- Disable sections and component separators
|
||||
-- component_separators = "",
|
||||
-- section_separators = "",
|
||||
-- theme = {
|
||||
-- -- We are going to use lualine_c an lualine_x as the left
|
||||
-- -- and right sections. Both are highlighted by c theme.
|
||||
-- normal = { c = { fg = c.fg, bg = bg } },
|
||||
-- inactive = { c = { fg = c.fg, bg = bg } },
|
||||
-- },
|
||||
-- },
|
||||
-- sections = {
|
||||
-- -- these are to remove the defaults
|
||||
-- lualine_a = {},
|
||||
-- lualine_b = {},
|
||||
-- lualine_y = {},
|
||||
-- lualine_z = {},
|
||||
-- -- These will be filled later
|
||||
-- lualine_c = {},
|
||||
-- lualine_x = {},
|
||||
-- },
|
||||
-- inactive_sections = {
|
||||
-- -- these are to remove the defaults
|
||||
-- lualine_a = {},
|
||||
-- lualine_b = {},
|
||||
-- lualine_y = {},
|
||||
-- lualine_z = {},
|
||||
-- lualine_c = {},
|
||||
-- lualine_x = {},
|
||||
-- },
|
||||
-- }
|
||||
--
|
||||
-- -- Inserts a component in lualine_c at left section
|
||||
-- local function left(component)
|
||||
-- table.insert(config.sections.lualine_c, component)
|
||||
-- end
|
||||
--
|
||||
-- -- Inserts a component in lualine_x ot right section
|
||||
-- local function right(component)
|
||||
-- table.insert(config.sections.lualine_x, component)
|
||||
-- end
|
||||
--
|
||||
-- left({
|
||||
-- function()
|
||||
-- return "▊"
|
||||
-- end,
|
||||
-- color = { fg = c.gray },
|
||||
-- padding = { left = 0, right = 1 },
|
||||
-- })
|
||||
--
|
||||
-- left({
|
||||
-- function()
|
||||
-- return ""
|
||||
-- end,
|
||||
-- color = function()
|
||||
-- local mode_color = {
|
||||
-- n = c.red, -- Normal
|
||||
-- i = c.orange, -- Insert
|
||||
-- ic = c.orange, -- Completion insert
|
||||
-- no = c.red, -- Operator-pending
|
||||
-- c = c.dark_pink, -- Command-line
|
||||
-- v = c.magenta, -- Visual
|
||||
-- V = c.magenta, -- Line-wise visual
|
||||
-- [""] = c.magenta, -- Block-wise visual
|
||||
-- s = c.magenta, -- Select
|
||||
-- S = c.magenta, -- Line-wise visual
|
||||
-- [""] = c.magenta, -- Block-wise visual
|
||||
-- R = c.light_pink, -- Replace
|
||||
-- Rv = c.light_pink, -- Virtual replace
|
||||
-- cv = c.dark_pink, -- Ex
|
||||
-- r = c.red, -- Hit-enter
|
||||
-- rm = c.red, -- More prompt
|
||||
-- ["r?"] = c.red, -- :confirm
|
||||
-- ["!"] = c.red, -- Shell command
|
||||
-- t = c.red, -- Terminal
|
||||
-- }
|
||||
-- return { fg = mode_color[vim.fn.mode()] }
|
||||
-- end,
|
||||
-- padding = { right = 1 },
|
||||
-- })
|
||||
--
|
||||
-- left({
|
||||
-- "filename",
|
||||
-- cond = conditions.buffer_not_empty,
|
||||
-- color = { fg = c.dark_pink, gui = "bold" },
|
||||
-- })
|
||||
--
|
||||
-- left({ "location" })
|
||||
--
|
||||
-- left({
|
||||
-- function()
|
||||
-- local cur = vim.fn.line(".")
|
||||
-- local total = vim.fn.line("$")
|
||||
-- return math.floor(cur / total * 100) .. "%%"
|
||||
-- end,
|
||||
-- color = { fg = c.fg, gui = "bold" },
|
||||
-- })
|
||||
--
|
||||
-- left({
|
||||
-- "diagnostics",
|
||||
-- sources = { "nvim_diagnostic" },
|
||||
-- symbols = { error = " ", warn = " ", info = " ", hint = " " },
|
||||
-- diagnostics_color = {
|
||||
-- error = { fg = c.error },
|
||||
-- warn = { fg = c.warning },
|
||||
-- info = { fg = c.info },
|
||||
-- hint = { fg = c.hint },
|
||||
-- },
|
||||
-- })
|
||||
--
|
||||
-- right({
|
||||
-- function()
|
||||
-- if vim.api.nvim_get_vvar("hlsearch") == 1 then
|
||||
-- local res = vim.fn.searchcount({ maxcount = 999, timeout = 500 })
|
||||
--
|
||||
-- if res.total > 0 then
|
||||
-- return string.format("%d/%d", res.current, res.total)
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- return ""
|
||||
-- end,
|
||||
-- })
|
||||
--
|
||||
-- right({ "filetype" })
|
||||
--
|
||||
-- right({
|
||||
-- "filesize",
|
||||
-- cond = conditions.buffer_not_empty,
|
||||
-- })
|
||||
--
|
||||
-- right({
|
||||
-- "o:encoding",
|
||||
-- fmt = string.upper,
|
||||
-- cond = conditions.hide_in_width,
|
||||
-- color = { fg = c.red, gui = "bold" },
|
||||
-- })
|
||||
--
|
||||
-- right({
|
||||
-- "fileformat",
|
||||
-- fmt = string.upper,
|
||||
-- icons_enabled = false,
|
||||
-- color = { fg = c.red, gui = "bold" },
|
||||
-- })
|
||||
--
|
||||
-- right({
|
||||
-- "branch",
|
||||
-- icon = "",
|
||||
-- color = { fg = c.orange, gui = "bold" },
|
||||
-- })
|
||||
--
|
||||
-- right({
|
||||
-- "diff",
|
||||
-- symbols = { added = "+", modified = "~", removed = "-" },
|
||||
-- diff_color = {
|
||||
-- added = { fg = c.diff.add },
|
||||
-- modified = { fg = c.diff.change },
|
||||
-- removed = { fg = c.diff.delete },
|
||||
-- },
|
||||
-- cond = conditions.hide_in_width,
|
||||
-- })
|
||||
--
|
||||
-- right({
|
||||
-- function()
|
||||
-- return "▊"
|
||||
-- end,
|
||||
-- color = { fg = c.gray },
|
||||
-- padding = { left = 1 },
|
||||
-- })
|
||||
--
|
||||
-- lualine.setup(config)
|
||||
-- end,
|
||||
|
@ -1,4 +0,0 @@
|
||||
return {
|
||||
"https://github.com/tadmccorkle/markdown.nvim",
|
||||
opts = {},
|
||||
}
|
@ -1,10 +1,2 @@
|
||||
return {
|
||||
'MeanderingProgrammer/markdown.nvim',
|
||||
name = 'render-markdown', -- Only needed if you have another plugin named markdown.nvim
|
||||
dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.nvim' }, -- if you use the mini.nvim suite
|
||||
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'echasnovski/mini.icons' }, -- if you use standalone mini plugins
|
||||
-- dependencies = { 'nvim-treesitter/nvim-treesitter', 'nvim-tree/nvim-web-devicons' }, -- if you prefer nvim-web-devicons
|
||||
config = function()
|
||||
require('render-markdown').setup({})
|
||||
end,
|
||||
}
|
||||
|
@ -4,4 +4,3 @@ return {
|
||||
ft = { "markdown" },
|
||||
build = function() vim.fn["mkdp#util#install"]() end,
|
||||
}
|
||||
|
||||
|
@ -11,8 +11,6 @@ return {
|
||||
require("null-ls").builtins.formatting.goimports_reviser,
|
||||
require("null-ls").builtins.formatting.golines,
|
||||
require("null-ls").builtins.diagnostics.golangci_lint,
|
||||
require("null-ls").builtins.formatting.google_java_format,
|
||||
require("null-ls").builtins.formatting.nixpkgs_fmt,
|
||||
}
|
||||
}
|
||||
end
|
||||
|
23
lua/custom/plugins/vimtex.lua
Normal file
23
lua/custom/plugins/vimtex.lua
Normal file
@ -0,0 +1,23 @@
|
||||
return {
|
||||
"lervag/vimtex",
|
||||
lazy = false, -- we don't want to lazy load VimTeX
|
||||
-- tag = "v2.15", -- uncomment to pin to a specific release
|
||||
init = function()
|
||||
vim.g.vimtex_view_method = "zathura"
|
||||
vim.g.vimtex_compiler_method = "tectonic"
|
||||
end,
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd({ "Filetype" }, {
|
||||
pattern = "tex",
|
||||
callback = function()
|
||||
vim.keymap.set("n", "<leader>cc", "<cmd>VimtexCompile<CR>", { desc = "Compile latex file" })
|
||||
end
|
||||
})
|
||||
vim.api.nvim_create_autocmd({ "BufWritePost" }, {
|
||||
pattern = "*.tex",
|
||||
callback = function()
|
||||
vim.cmd [[VimtexCompile]]
|
||||
end
|
||||
})
|
||||
end
|
||||
}
|
101
lua/jabuxas/bar.lua
Normal file
101
lua/jabuxas/bar.lua
Normal file
@ -0,0 +1,101 @@
|
||||
local Mode = {}
|
||||
|
||||
Mode.map = {
|
||||
['n'] = 'NORMAL',
|
||||
['no'] = 'O-PENDING',
|
||||
['nov'] = 'O-PENDING',
|
||||
['noV'] = 'O-PENDING',
|
||||
['no\22'] = 'O-PENDING',
|
||||
['niI'] = 'NORMAL',
|
||||
['niR'] = 'NORMAL',
|
||||
['niV'] = 'NORMAL',
|
||||
['nt'] = 'NORMAL',
|
||||
['ntT'] = 'NORMAL',
|
||||
['v'] = 'VISUAL',
|
||||
['vs'] = 'VISUAL',
|
||||
['V'] = 'V-LINE',
|
||||
['Vs'] = 'V-LINE',
|
||||
['\22'] = 'V-BLOCK',
|
||||
['\22s'] = 'V-BLOCK',
|
||||
['s'] = 'SELECT',
|
||||
['S'] = 'S-LINE',
|
||||
['\19'] = 'S-BLOCK',
|
||||
['i'] = 'INSERT',
|
||||
['ic'] = 'INSERT',
|
||||
['ix'] = 'INSERT',
|
||||
['R'] = 'REPLACE',
|
||||
['Rc'] = 'REPLACE',
|
||||
['Rx'] = 'REPLACE',
|
||||
['Rv'] = 'V-REPLACE',
|
||||
['Rvc'] = 'V-REPLACE',
|
||||
['Rvx'] = 'V-REPLACE',
|
||||
['c'] = 'COMMAND',
|
||||
['cv'] = 'EX',
|
||||
['ce'] = 'EX',
|
||||
['r'] = 'REPLACE',
|
||||
['rm'] = 'MORE',
|
||||
['r?'] = 'CONFIRM',
|
||||
['!'] = 'SHELL',
|
||||
['t'] = 'TERMINAL',
|
||||
}
|
||||
|
||||
function Mode.get_mode()
|
||||
local mode_code = vim.api.nvim_get_mode().mode
|
||||
if Mode.map[mode_code] == nil then
|
||||
return mode_code
|
||||
end
|
||||
return Mode.map[mode_code]
|
||||
end
|
||||
|
||||
local function filename3()
|
||||
return vim.fn.expand("%:t")
|
||||
end
|
||||
|
||||
local function location()
|
||||
return vim.fn.line('.') .. ":" .. vim.fn.charcol('.')
|
||||
end
|
||||
|
||||
local function progress()
|
||||
local total_lines = vim.fn.line('$')
|
||||
local current_line = vim.fn.line('.')
|
||||
return math.floor((current_line / total_lines) * 100) .. "%%"
|
||||
end
|
||||
|
||||
local function stats()
|
||||
return location() .. " " .. progress()
|
||||
end
|
||||
|
||||
|
||||
function statusline_render()
|
||||
local components = { Mode.get_mode(), filename3(), stats() }
|
||||
local total_length = 0
|
||||
for _, component in ipairs(components) do
|
||||
total_length = total_length + vim.fn.strwidth(component)
|
||||
end
|
||||
|
||||
local statusline_width = vim.fn.winwidth(0)
|
||||
local available_space = statusline_width - total_length
|
||||
local spaces_between = math.floor(available_space / (#components - 1))
|
||||
|
||||
local statusline = ""
|
||||
for i, component in ipairs(components) do
|
||||
statusline = statusline .. component
|
||||
if i < #components then
|
||||
statusline = statusline .. string.rep(" ", spaces_between)
|
||||
end
|
||||
end
|
||||
|
||||
return statusline
|
||||
end
|
||||
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
autocmd(
|
||||
{
|
||||
"WinEnter", "BufEnter", "BufWritePost", "SessionLoadPost", "FileChangedShellPost", "VimResized", "Filetype",
|
||||
"CursorMoved", "CursorMovedI", "ModeChanged" },
|
||||
{
|
||||
pattern = "*",
|
||||
callback = function()
|
||||
vim.opt.statusline = "%{%v:lua.statusline_render()%}"
|
||||
end,
|
||||
})
|
@ -1,2 +1,3 @@
|
||||
require("jabuxas.remap")
|
||||
require("jabuxas.set")
|
||||
require("jabuxas.bar")
|
||||
|
@ -35,8 +35,6 @@ keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true, desc = "ch
|
||||
keymap.set("n", "<leader>cm", "<cmd>make<CR>", { desc = "run make command" })
|
||||
keymap.set("n", "<leader>cc", "<cmd>!gcc -o %< % && %< <CR>", { desc = "compile current file and execute it" })
|
||||
|
||||
keymap.set("t", "<leader><Esc>", [[<C-\><C-n>]], { desc = "exit insert mode on builtin terminal" })
|
||||
|
||||
keymap.set("n", "<leader>Sv", "<C-w>v", { desc = "create split vertically" })
|
||||
keymap.set("n", "<leader>Sh", "<C-w>s", { desc = "create split horizontally" })
|
||||
keymap.set("n", "<leader>Se", "<C-w>=", { desc = "even out buffers" })
|
||||
@ -62,3 +60,34 @@ keymap.set("n", "<leader>tA", "<cmd>GoTestAdd<CR>", { desc = "Add Go Test for cu
|
||||
|
||||
keymap.set("n", "<leader>gr", "<cmd>lua vim.lsp.buf.rename()<CR>",
|
||||
{ desc = "Renames all references to the symbol under the cursor" })
|
||||
|
||||
local nmap = function(keys, func, desc)
|
||||
if desc then
|
||||
desc = 'LSP: ' .. desc
|
||||
end
|
||||
|
||||
vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc })
|
||||
end
|
||||
|
||||
|
||||
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
|
||||
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
|
||||
nmap('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
nmap('gI', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
|
||||
nmap('<leader>D', vim.lsp.buf.type_definition, 'Type [D]efinition')
|
||||
nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- See `:help K` for why this keymap
|
||||
nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||
nmap('<C-S-k>', vim.lsp.buf.signature_help, 'Signature Documentation')
|
||||
|
||||
-- Lesser used LSP functionality
|
||||
nmap('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
nmap('<leader>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace [A]dd Folder')
|
||||
nmap('<leader>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace [R]emove Folder')
|
||||
nmap('<leader>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, '[W]orkspace [L]ist Folders')
|
||||
|
@ -3,7 +3,6 @@ vim.opt.mouse = "a"
|
||||
vim.opt.nu = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.opt.clipboard:append({ "unnamedplus" })
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
@ -36,12 +35,6 @@ autocmd({ "WinEnter" }, { pattern = "*", callback = function() vim.opt.colorcolu
|
||||
-- disable bar any%
|
||||
-- vim.opt.laststatus = 0
|
||||
|
||||
autocmd("Filetype", {
|
||||
pattern = "norg",
|
||||
callback = function()
|
||||
vim.opt.wrap = true
|
||||
end
|
||||
})
|
||||
|
||||
autocmd("Filetype", {
|
||||
pattern = "*",
|
||||
@ -50,6 +43,16 @@ autocmd("Filetype", {
|
||||
end
|
||||
})
|
||||
|
||||
autocmd("Filetype", {
|
||||
pattern = { "markdown", "tex" },
|
||||
callback = function()
|
||||
vim.opt.wrap = true
|
||||
vim.o.formatoptions = "l"
|
||||
vim.o.breakindent = true
|
||||
vim.o.lbr = true
|
||||
end
|
||||
})
|
||||
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- Case insensitive searching UNLESS /C or capital in search
|
||||
|
Loading…
Reference in New Issue
Block a user