init dotfiles
This commit is contained in:
commit
2e7ba7945f
55 changed files with 3783 additions and 0 deletions
149
.config/nvim/UltiSnips/tex.snippets
Normal file
149
.config/nvim/UltiSnips/tex.snippets
Normal file
|
@ -0,0 +1,149 @@
|
|||
snippet templateHs "Start file with template"
|
||||
\documentclass{article}
|
||||
|
||||
%imports
|
||||
%include polycode.fmt
|
||||
%format (cond (p) (f) (g)) = "\mcond{" p "}{" f "}{" g "}"
|
||||
%format (div (x)(y)) = x "\div " y
|
||||
%format succ = "\succ "
|
||||
%format ==> = "\Longrightarrow "
|
||||
%format map = "\map "
|
||||
%format length = "\length "
|
||||
%format fst = "\p1"
|
||||
%format p1 = "\p1"
|
||||
%format snd = "\p2"
|
||||
%format p2 = "\p2"
|
||||
%format Left = "i_1"
|
||||
%format Right = "i_2"
|
||||
%format i1 = "i_1"
|
||||
%format i2 = "i_2"
|
||||
%format >< = "\times"
|
||||
%format >|< = "\bowtie "
|
||||
%format |-> = "\mapsto"
|
||||
%format . = "\comp "
|
||||
%format .=?=. = "\mathbin{\stackrel{\mathrm{?}}{=}}"
|
||||
%format (kcomp (f)(g)) = f "\kcomp " g
|
||||
%format -|- = "+"
|
||||
%format conc = "\mathsf{conc}"
|
||||
%format summation = "{\sum}"
|
||||
%format (either (a) (b)) = "\alt{" a "}{" b "}"
|
||||
%format (frac (a) (b)) = "\frac{" a "}{" b "}"
|
||||
%format (uncurry f) = "\uncurry{" f "}"
|
||||
%format (const (f)) = "\underline{" f "}"
|
||||
%format TLTree = "\mathsf{TLTree}"
|
||||
%format (lcbr (x)(y)) = "\begin{lcbr}" x "\\" y "\end{lcbr}"
|
||||
%format (split (x) (y)) = "\conj{" x "}{" y "}"
|
||||
%format (for (f) (i)) = "\for{" f "}\ {" i "}"
|
||||
%format B_tree = "\mathsf{B}\mbox{-}\mathsf{tree} "
|
||||
\def\ana#1{\mathopen{[\!(}#1\mathclose{)\!]}}
|
||||
%format <$> = "\mathbin{\mathopen{\langle}\$\mathclose{\rangle}}"
|
||||
%format Either a b = a "+" b
|
||||
%format fmap = "\mathsf{fmap}"
|
||||
%format NA = "\textsc{na}"
|
||||
%format NB = "\textsc{nb}"
|
||||
%format inT = "\mathsf{in}"
|
||||
%format outT = "\mathsf{out}"
|
||||
%format outLTree = "\mathsf{out}"
|
||||
%format inLTree = "\mathsf{in}"
|
||||
%format inFTree = "\mathsf{in}"
|
||||
%format outFTree = "\mathsf{out}"
|
||||
%format Null = "1"
|
||||
%format (Prod (a) (b)) = a >< b
|
||||
%format fF = "\fun F "
|
||||
%format k1 = "k_1 "
|
||||
%format k2 = "k_2 "
|
||||
%format h1 = "h_1 "
|
||||
%format h2 = "h_2 "
|
||||
%format f1 = "f_1 "
|
||||
%format f2 = "f_2 "
|
||||
%format l1 = "l_1 "
|
||||
%format map1 = "map_1 "
|
||||
%format map2 = "map_2 "
|
||||
%format map3 = "map_3"
|
||||
%format l2 = "l_2 "
|
||||
%format Dist = "\fun{Dist}"
|
||||
%format IO = "\fun{IO}"
|
||||
%format LTree = "{\LTree}"
|
||||
%format FTree = "{\FTree}"
|
||||
%format inNat = "\mathsf{in}"
|
||||
%format (cata (f)) = "\cata{" f "}"
|
||||
%format (cataNat (g)) = "\cataNat{" g "}"
|
||||
%format (cataList (g)) = "\cataList{" g "}"
|
||||
%format (anaList (g)) = "\anaList{" g "}"
|
||||
%format Nat0 = "\N_0"
|
||||
%format Rational = "\Q "
|
||||
%format toRational = " to_\Q "
|
||||
%format fromRational = " from_\Q "
|
||||
%format muB = "\mu "
|
||||
%format (frac (n)(m)) = "\frac{" n "}{" m "}"
|
||||
%format (fac (n)) = "{" n "!}"
|
||||
%format (underbrace (t) (p)) = "\underbrace{" t "}_{" p "}"
|
||||
%format matrix = "matrix"
|
||||
%%format (bin (n) (k)) = "\Big(\vcenter{\xymatrix@R=1pt{" n "\\" k "}}\Big)"
|
||||
%format `ominus` = "\mathbin{\ominus}"
|
||||
%format % = "\mathbin{/}"
|
||||
%format <-> = "{\,\leftrightarrow\,}"
|
||||
%format <|> = "{\,\updownarrow\,}"
|
||||
%format `minusNat`= "\mathbin{-}"
|
||||
%format ==> = "\Rightarrow"
|
||||
%format .==>. = "\Rightarrow"
|
||||
%format .<==>. = "\Leftrightarrow"
|
||||
%format .==. = "\equiv"
|
||||
%format .<=. = "\leq"
|
||||
%format .&&&. = "\wedge"
|
||||
%format cdots = "\cdots "
|
||||
%format pi = "\pi "
|
||||
%format (curry (f)) = "\overline{" f "}"
|
||||
%format (cataLTree (x)) = "\llparenthesis\, " x "\,\rrparenthesis"
|
||||
%format (cataFTree (x)) = "\llparenthesis\, " x "\,\rrparenthesis"
|
||||
%format (anaLTree (x)) = "\mathopen{[\!(}" x "\mathclose{)\!]}"
|
||||
%format delta = "\Delta "
|
||||
%format (plus (f)(g)) = "{" f "}\plus{" g "}"
|
||||
%format ++ = "\mathbin{+\!\!\!+}"
|
||||
%format Integer = "\mathbb{Z}"
|
||||
\def\plus{\mathbin{\dagger}}
|
||||
\usepackage[all]{xy}
|
||||
\usepackage{mathtools}
|
||||
\usepackage[a4paper,left=3cm,right=2cm,top=2.5cm,bottom=2.5cm]{geometry}
|
||||
\usepackage{palatino}
|
||||
\usepackage[colorlinks=true,linkcolor=blue,citecolor=blue]{hyperref}
|
||||
\usepackage{graphicx}
|
||||
\usepackage{cp2122t}
|
||||
\usepackage{subcaption}
|
||||
\usepackage{adjustbox}
|
||||
\usepackage{color}
|
||||
|
||||
|
||||
\title{\Huge{Some Class}}
|
||||
\author{\huge{Afonso Franco}}
|
||||
|
||||
\begin{document}
|
||||
|
||||
\maketitle
|
||||
\newpage
|
||||
|
||||
\tableofcontents
|
||||
\pagebreak
|
||||
|
||||
$1
|
||||
|
||||
\end{document}
|
||||
endsnippet
|
||||
|
||||
snippet rule "Add CP rule"
|
||||
\equiv \\{\text{Propriedade ${1:Nome/Numero}}\\}\\\\
|
||||
endsnippet
|
||||
|
||||
snippet split "Add CP split"
|
||||
\langle $1 \rangle
|
||||
endsnippet
|
||||
|
||||
snippet diagram "Create diagram template"
|
||||
\xymatrix{
|
||||
$1
|
||||
}
|
||||
endsnippet
|
||||
|
||||
snippet arrow "Create arrow in diagram"
|
||||
\ar[${1:direction}]^{${2:functions}}
|
||||
endsnippet
|
181
.config/nvim/after/plugin/cmp.lua
Normal file
181
.config/nvim/after/plugin/cmp.lua
Normal file
|
@ -0,0 +1,181 @@
|
|||
local cmp_status_ok, cmp = pcall(require, "cmp")
|
||||
if not cmp_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
local snip_status_ok, luasnip = pcall(require, "luasnip")
|
||||
if not snip_status_ok then
|
||||
return
|
||||
end
|
||||
|
||||
require("luasnip/loaders/from_vscode").lazy_load()
|
||||
|
||||
local check_backspace = function()
|
||||
local col = vim.fn.col "." - 1
|
||||
return col == 0 or vim.fn.getline("."):sub(col, col):match "%s"
|
||||
end
|
||||
|
||||
-- פּ ﯟ some other good icons
|
||||
local kind_icons = {
|
||||
Text = "",
|
||||
Method = "m",
|
||||
Function = "",
|
||||
Constructor = "",
|
||||
Field = "",
|
||||
Variable = "",
|
||||
Class = "",
|
||||
Interface = "",
|
||||
Module = "",
|
||||
Property = "",
|
||||
Unit = "",
|
||||
Value = "",
|
||||
Enum = "",
|
||||
Keyword = "",
|
||||
Snippet = "",
|
||||
Color = "",
|
||||
File = "",
|
||||
Reference = "",
|
||||
Folder = "",
|
||||
EnumMember = "",
|
||||
Constant = "",
|
||||
Struct = "",
|
||||
Event = "",
|
||||
Operator = "",
|
||||
TypeParameter = "",
|
||||
}
|
||||
-- find more here: https://www.nerdfonts.com/cheat-sheet
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body) -- For `luasnip` users.
|
||||
end,
|
||||
},
|
||||
mapping = {
|
||||
["<C-b>"] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }),
|
||||
["<C-f>"] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }),
|
||||
["<C-Space>"] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }),
|
||||
["<C-y>"] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `<C-y>` mapping.
|
||||
["<C-e>"] = cmp.mapping {
|
||||
i = cmp.mapping.abort(),
|
||||
c = cmp.mapping.close(),
|
||||
},
|
||||
-- Accept currently selected item. If none selected, do nothing.
|
||||
["<CR>"] = cmp.mapping.confirm { select = false },
|
||||
["<C-k>"] = cmp.mapping(function(fallback)
|
||||
if luasnip.expandable() then
|
||||
luasnip.expand()
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
elseif check_backspace() then
|
||||
fallback()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end),
|
||||
["<C-j>"] = cmp.mapping(function(fallback)
|
||||
if luasnip.jumpable(-1) then
|
||||
luasnip.jump(-1)
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end
|
||||
),
|
||||
["<Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_next_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
["<S-Tab>"] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
else
|
||||
fallback()
|
||||
end
|
||||
end, {
|
||||
"i",
|
||||
"s",
|
||||
}),
|
||||
},
|
||||
formatting = {
|
||||
fields = { "kind", "abbr", "menu" },
|
||||
format = function(entry, vim_item)
|
||||
-- Kind icons
|
||||
vim_item.kind = string.format("%s", kind_icons[vim_item.kind])
|
||||
-- vim_item.kind = string.format('%s %s', kind_icons[vim_item.kind], vim_item.kind) -- This concatonates the icons with the name of the item kind
|
||||
vim_item.menu = ({
|
||||
nvim_lsp = "(LSP)",
|
||||
luasnip = "(Snippet)",
|
||||
buffer = "(Text)",
|
||||
nvim_lsp_signature_help = "(Signature)",
|
||||
nvim_lua = "(Nvim LSP)",
|
||||
path = "(Path)",
|
||||
})[entry.source.name]
|
||||
return vim_item
|
||||
end,
|
||||
},
|
||||
sorting = {
|
||||
comparators = {
|
||||
cmp.config.compare.exact,
|
||||
cmp.config.compare.offset,
|
||||
cmp.config.compare.recently_used,
|
||||
}
|
||||
},
|
||||
sources = cmp.config.sources(
|
||||
{
|
||||
{ name = "nvim_lsp",
|
||||
entry_filter = function(entry, context)
|
||||
local kind = entry:get_kind()
|
||||
local line = context.cursor_line
|
||||
local col = context.cursor.col
|
||||
local char_before_cursor = string.sub(line, col - 1, col - 1)
|
||||
|
||||
if char_before_cursor == "." then
|
||||
if kind == 2 or kind == 5 then
|
||||
return true
|
||||
else return false end
|
||||
elseif string.match(line, "^%s*%w*$") then
|
||||
if kind == 3 or kind == 6 then
|
||||
return true
|
||||
else
|
||||
return false
|
||||
end
|
||||
end
|
||||
return true
|
||||
end
|
||||
|
||||
},
|
||||
{ name = 'nvim_lua' },
|
||||
{ name = 'luasnip' },
|
||||
{ name = 'nvim_lsp_signature_help' },
|
||||
{ name = "path" },
|
||||
},
|
||||
{
|
||||
--This sources will only show up if there aren't any sources from the other list
|
||||
{ name = "buffer", keyword_length = 5 },
|
||||
},
|
||||
{
|
||||
{ name = "orgmode" }
|
||||
}
|
||||
),
|
||||
confirm_opts = {
|
||||
behavior = cmp.ConfirmBehavior.Replace,
|
||||
select = false,
|
||||
},
|
||||
window = {
|
||||
documentation = cmp.config.window.bordered(),
|
||||
completion = cmp.config.window.bordered({
|
||||
winhighlight = "Normal:Pmenu,FloatBorder:Pmenu,CursorLine:PmenuSel,Search:None"
|
||||
})
|
||||
|
||||
},
|
||||
experimental = {
|
||||
ghost_text = true,
|
||||
native_menu = false,
|
||||
},
|
||||
}
|
37
.config/nvim/after/plugin/colorscheme.lua
Normal file
37
.config/nvim/after/plugin/colorscheme.lua
Normal file
|
@ -0,0 +1,37 @@
|
|||
require("catppuccin").setup({
|
||||
flavour = "frappe", -- latte, frappe, macchiato, mocha
|
||||
transparent_background = false,
|
||||
term_colors = false,
|
||||
|
||||
no_italic = false, -- Force no italic
|
||||
no_bold = false, -- Force no bold
|
||||
styles = {
|
||||
comments = {"italic"},
|
||||
conditionals = {"italic"},
|
||||
loops = {},
|
||||
functions = {},
|
||||
keywords = {},
|
||||
strings = {},
|
||||
variables = {},
|
||||
numbers = {},
|
||||
booleans = {},
|
||||
properties = {},
|
||||
types = {},
|
||||
operators = {},
|
||||
},
|
||||
integrations = {
|
||||
cmp = true,
|
||||
gitsigns = true,
|
||||
telescope = true,
|
||||
},
|
||||
})
|
||||
|
||||
function ColorMyPencils(color)
|
||||
color = color or "catppuccin"
|
||||
|
||||
vim.cmd.colorscheme(color)
|
||||
-- vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
|
||||
-- vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none" })
|
||||
end
|
||||
|
||||
ColorMyPencils()
|
1
.config/nvim/after/plugin/fidget.lua
Normal file
1
.config/nvim/after/plugin/fidget.lua
Normal file
|
@ -0,0 +1 @@
|
|||
require("fidget").setup()
|
1
.config/nvim/after/plugin/fugitive.lua
Normal file
1
.config/nvim/after/plugin/fugitive.lua
Normal file
|
@ -0,0 +1 @@
|
|||
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
|
10
.config/nvim/after/plugin/harpoon.lua
Normal file
10
.config/nvim/after/plugin/harpoon.lua
Normal file
|
@ -0,0 +1,10 @@
|
|||
local mark = require("harpoon.mark")
|
||||
local ui = require("harpoon.ui")
|
||||
|
||||
vim.keymap.set("n", "<leader>a", mark.add_file)
|
||||
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
||||
|
||||
vim.keymap.set("n", "<C-j>", function () ui.nav_file(1) end)
|
||||
vim.keymap.set("n", "<C-k>", function () ui.nav_file(2) end)
|
||||
vim.keymap.set("n", "<C-l>", function () ui.nav_file(3) end)
|
||||
vim.keymap.set("n", "<C-;>", function () ui.nav_file(4) end)
|
97
.config/nvim/after/plugin/lspconfig.lua
Normal file
97
.config/nvim/after/plugin/lspconfig.lua
Normal file
|
@ -0,0 +1,97 @@
|
|||
local present, mason = pcall(require, "mason")
|
||||
|
||||
vim.api.nvim_create_augroup("_mason", { clear = true })
|
||||
|
||||
local options = {
|
||||
PATH = "skip",
|
||||
|
||||
ui = {
|
||||
icons = {
|
||||
package_pending = " ",
|
||||
package_installed = " ",
|
||||
package_uninstalled = " ﮊ",
|
||||
},
|
||||
|
||||
keymaps = {
|
||||
toggle_server_expand = "<CR>",
|
||||
install_server = "i",
|
||||
update_server = "u",
|
||||
check_server_version = "c",
|
||||
update_all_servers = "U",
|
||||
check_outdated_servers = "C",
|
||||
uninstall_server = "X",
|
||||
cancel_installation = "<C-c>",
|
||||
},
|
||||
},
|
||||
|
||||
max_concurrent_installers = 10,
|
||||
}
|
||||
|
||||
mason.setup(options)
|
||||
|
||||
local mason_lspconfig = require "mason-lspconfig"
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = {},
|
||||
automatic_installation = true
|
||||
})
|
||||
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, opts)
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, opts)
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, opts)
|
||||
vim.keymap.set('n', '<space>q', vim.diagnostic.setloclist, opts)
|
||||
|
||||
-- Use an on_attach function to only map the following keys
|
||||
-- after the language server attaches to the current buffer
|
||||
local on_attach = function(client, bufnr)
|
||||
-- Enable completion triggered by <c-x><c-o>
|
||||
vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc')
|
||||
|
||||
-- Mappings.
|
||||
-- See `:help vim.lsp.*` for documentation on any of the below functions
|
||||
local bufopts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, bufopts)
|
||||
vim.keymap.set('n', 'gd', vim.lsp.buf.definition, bufopts)
|
||||
vim.keymap.set('n', 'K', vim.lsp.buf.hover, bufopts)
|
||||
vim.keymap.set('n', 'gi', vim.lsp.buf.implementation, bufopts)
|
||||
-- vim.keymap.set('n', '<C-k>', vim.lsp.buf.signature_help, bufopts)
|
||||
vim.keymap.set('n', '<space>wa', vim.lsp.buf.add_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wr', vim.lsp.buf.remove_workspace_folder, bufopts)
|
||||
vim.keymap.set('n', '<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, bufopts)
|
||||
vim.keymap.set('n', '<space>D', vim.lsp.buf.type_definition, bufopts)
|
||||
vim.keymap.set('n', '<space>rn', vim.lsp.buf.rename, bufopts)
|
||||
vim.keymap.set('n', '<space>ca', vim.lsp.buf.code_action, bufopts)
|
||||
vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts)
|
||||
vim.keymap.set('n', '<space>ge', function() vim.diagnostic.goto_next() end, bufopts)
|
||||
vim.keymap.set('n', '<space>gE', function() vim.diagnostic.goto_prev() end, bufopts)
|
||||
vim.keymap.set('n', '<space>fo', function() vim.lsp.buf.format { async = true } end, bufopts)
|
||||
end
|
||||
|
||||
local lspconfig = require "lspconfig"
|
||||
|
||||
-- ADD NVIM CMP AS A CAPABILITY
|
||||
local lsp_defaults = lspconfig.util.default_config
|
||||
|
||||
local capabilities = vim.tbl_deep_extend(
|
||||
'force',
|
||||
lsp_defaults.capabilities,
|
||||
require('cmp_nvim_lsp').default_capabilities()
|
||||
)
|
||||
|
||||
|
||||
mason_lspconfig.setup_handlers {
|
||||
|
||||
-- This is a default handler that will be called for each installed server (also for new servers that are installed during a session)
|
||||
function(server_name)
|
||||
lspconfig[server_name].setup {
|
||||
on_attach = on_attach,
|
||||
on_init = on_init,
|
||||
flags = lsp_flags,
|
||||
capabilities = capabilities,
|
||||
}
|
||||
end,
|
||||
}
|
11
.config/nvim/after/plugin/null-ls.lua
Normal file
11
.config/nvim/after/plugin/null-ls.lua
Normal file
|
@ -0,0 +1,11 @@
|
|||
local null_ls = require("null-ls")
|
||||
|
||||
null_ls.setup({
|
||||
sources = {
|
||||
null_ls.builtins.formatting.rustfmt,
|
||||
null_ls.builtins.formatting.black,
|
||||
null_ls.builtins.formatting.prettierd.with({
|
||||
filetypes = { "html", "json", "yaml", "markdown" },
|
||||
}),
|
||||
}
|
||||
})
|
21
.config/nvim/after/plugin/orgmode.lua
Normal file
21
.config/nvim/after/plugin/orgmode.lua
Normal file
|
@ -0,0 +1,21 @@
|
|||
-- -- Load custom treesitter grammar for org filetype
|
||||
require('orgmode').setup_ts_grammar()
|
||||
|
||||
-- Treesitter configuration
|
||||
|
||||
require('nvim-treesitter.configs').setup {
|
||||
-- If TS highlights are not enabled at all, or disabled via `disable` prop,
|
||||
-- highlighting will fallback to default Vim syntax highlighting
|
||||
highlight = {
|
||||
enable = true,
|
||||
-- Required for spellcheck, some LaTex highlights and
|
||||
-- code block highlights that do not have ts grammar
|
||||
additional_vim_regex_highlighting = { 'org' },
|
||||
},
|
||||
ensure_installed = { 'org' }, -- Or run :TSUpdate org
|
||||
}
|
||||
|
||||
require('orgmode').setup({
|
||||
org_agenda_files = { '~/Dropbox/org/*', '~/my-orgs/**/*' },
|
||||
org_default_notes_file = '~/Dropbox/org/refile.org',
|
||||
})
|
40
.config/nvim/after/plugin/statusline.lua
Normal file
40
.config/nvim/after/plugin/statusline.lua
Normal file
|
@ -0,0 +1,40 @@
|
|||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'auto',
|
||||
component_separators = { left = '', right = ''},
|
||||
section_separators = { left = '', right = ''},
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 1000,
|
||||
tabline = 1000,
|
||||
winbar = 1000,
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {'mode'},
|
||||
lualine_b = {'branch', 'diff', 'diagnostics'},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'encoding', 'fileformat', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {}
|
||||
}
|
5
.config/nvim/after/plugin/telescope.lua
Normal file
5
.config/nvim/after/plugin/telescope.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<leader>sg', builtin.live_grep, {})
|
||||
vim.keymap.set('n', '<leader>sb', builtin.buffers, {})
|
||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, {})
|
36
.config/nvim/after/plugin/treesitter-context.lua
Normal file
36
.config/nvim/after/plugin/treesitter-context.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
function ContextSetup(show_all_context)
|
||||
require("treesitter-context").setup({
|
||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||
throttle = true, -- Throttles plugin updates (may improve performance)
|
||||
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||
show_all_context = show_all_context,
|
||||
patterns = { -- Match patterns for TS nodes. These get wrapped to match at word boundaries.
|
||||
-- For all filetypes
|
||||
-- Note that setting an entry here replaces all other patterns for this entry.
|
||||
-- By setting the 'default' entry below, you can control which nodes you want to
|
||||
-- appear in the context window.
|
||||
default = {
|
||||
"function",
|
||||
"method",
|
||||
"for",
|
||||
"while",
|
||||
"if",
|
||||
"switch",
|
||||
"case",
|
||||
},
|
||||
|
||||
rust = {
|
||||
"loop_expression",
|
||||
"impl_item",
|
||||
},
|
||||
|
||||
typescript = {
|
||||
"class_declaration",
|
||||
"abstract_class_declaration",
|
||||
"else_clause",
|
||||
},
|
||||
},
|
||||
})
|
||||
end
|
||||
|
||||
ContextSetup(false)
|
9
.config/nvim/after/plugin/treesitter.lua
Normal file
9
.config/nvim/after/plugin/treesitter.lua
Normal file
|
@ -0,0 +1,9 @@
|
|||
require'nvim-treesitter.configs'.setup {
|
||||
ensure_installed = {"vim","help","python","rust","lua","haskell","c","java", "bash"},
|
||||
sync_install = false,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
1
.config/nvim/after/plugin/undotree.lua
Normal file
1
.config/nvim/after/plugin/undotree.lua
Normal file
|
@ -0,0 +1 @@
|
|||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
2
.config/nvim/after/plugin/vimtex.lua
Normal file
2
.config/nvim/after/plugin/vimtex.lua
Normal file
|
@ -0,0 +1,2 @@
|
|||
vim.g.vimtex_view_method = 'zathura'
|
||||
vim.g.vimtex_compiler_methor = 'latexmk'
|
6
.config/nvim/ftplugin/java.lua
Normal file
6
.config/nvim/ftplugin/java.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
local config = {
|
||||
cmd = { '/home/tsousa/.local/share/nvim/mason/bin/jdtls' },
|
||||
root_dir = vim.fs.dirname(vim.fs.find({ '.gradlew', '.git', 'mvnw' }, { upward = true })[1]),
|
||||
}
|
||||
|
||||
require('jdtls').start_or_attach(config)
|
4
.config/nvim/ftplugin/lhaskell.lua
Normal file
4
.config/nvim/ftplugin/lhaskell.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
vim.bo.filetype = "tex"
|
||||
vim.bo.syntax = "lhaskell"
|
||||
|
||||
|
1
.config/nvim/init.lua
Normal file
1
.config/nvim/init.lua
Normal file
|
@ -0,0 +1 @@
|
|||
require("tsousa")
|
54
.config/nvim/lua/mappings.lua
Normal file
54
.config/nvim/lua/mappings.lua
Normal file
|
@ -0,0 +1,54 @@
|
|||
--Relative line numbers
|
||||
vim.wo.number=true
|
||||
vim.wo.relativenumber= true
|
||||
vim.g.instant_username = "Afonso"
|
||||
vim.opt.clipboard= 'unnamedplus'
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.smartindent = true
|
||||
vim.opt.wrap = false
|
||||
vim.g.mapleader = " "
|
||||
--TAB KEYBINDINGS
|
||||
local map = vim.api.nvim_set_keymap
|
||||
local opts = { noremap = true, silent = true }
|
||||
|
||||
-- Move to previous/next
|
||||
map('n', '<A-,>', '<Cmd>BufferPrevious<CR>', opts)
|
||||
map('n', '<A-.>', '<Cmd>BufferNext<CR>', opts)
|
||||
-- Re-order to previous/next
|
||||
map('n', '<A-<>', '<Cmd>BufferMovePrevious<CR>', opts)
|
||||
map('n', '<A->>', '<Cmd>BufferMoveNext<CR>', opts)
|
||||
-- Goto buffer in position...
|
||||
map('n', '<A-1>', '<Cmd>BufferGoto 1<CR>', opts)
|
||||
map('n', '<A-2>', '<Cmd>BufferGoto 2<CR>', opts)
|
||||
map('n', '<A-3>', '<Cmd>BufferGoto 3<CR>', opts)
|
||||
map('n', '<A-4>', '<Cmd>BufferGoto 4<CR>', opts)
|
||||
map('n', '<A-5>', '<Cmd>BufferGoto 5<CR>', opts)
|
||||
map('n', '<A-6>', '<Cmd>BufferGoto 6<CR>', opts)
|
||||
map('n', '<A-7>', '<Cmd>BufferGoto 7<CR>', opts)
|
||||
map('n', '<A-8>', '<Cmd>BufferGoto 8<CR>', opts)
|
||||
map('n', '<A-9>', '<Cmd>BufferGoto 9<CR>', opts)
|
||||
map('n', '<A-0>', '<Cmd>BufferLast<CR>', opts)
|
||||
-- Pin/unpin buffer
|
||||
map('n', '<A-p>', '<Cmd>BufferPin<CR>', opts)
|
||||
-- Close buffer
|
||||
map('n', '<A-c>', '<Cmd>BufferClose<CR>', opts)
|
||||
-- Wipeout buffer
|
||||
-- :BufferWipeout
|
||||
-- Close commands
|
||||
-- :BufferCloseAllButCurrent
|
||||
-- :BufferCloseAllButPinned
|
||||
-- :BufferCloseAllButCurrentOrPinned
|
||||
-- :BufferCloseBuffersLeft
|
||||
-- :BufferCloseBuffersRight
|
||||
-- Magic buffer-picking mode
|
||||
map('n', '<C-p>', '<Cmd>BufferPick<CR>', opts)
|
||||
-- Sort automatically by...
|
||||
map('n', '<Space>bb', '<Cmd>BufferOrderByBufferNumber<CR>', opts)
|
||||
map('n', '<Space>bd', '<Cmd>BufferOrderByDirectory<CR>', opts)
|
||||
map('n', '<Space>bl', '<Cmd>BufferOrderByLanguage<CR>', opts)
|
||||
map('n', '<Space>bw', '<Cmd>BufferOrderByWindowNumber<CR>', opts)
|
||||
|
||||
|
||||
--NVimTree
|
||||
|
||||
map('n', '<C-n>', '<Cmd>NvimTreeToggle<CR>',opts)
|
74
.config/nvim/lua/plugins/barbar.lua
Normal file
74
.config/nvim/lua/plugins/barbar.lua
Normal file
|
@ -0,0 +1,74 @@
|
|||
-- Set barbar's options
|
||||
require'bufferline'.setup {
|
||||
-- Enable/disable animations
|
||||
animation = true,
|
||||
|
||||
-- Enable/disable auto-hiding the tab bar when there is a single buffer
|
||||
auto_hide = false,
|
||||
|
||||
-- Enable/disable current/total tabpages indicator (top right corner)
|
||||
tabpages = true,
|
||||
|
||||
-- Enable/disable close button
|
||||
closable = true,
|
||||
|
||||
-- Enables/disable clickable tabs
|
||||
-- - left-click: go to buffer
|
||||
-- - middle-click: delete buffer
|
||||
clickable = true,
|
||||
|
||||
-- Excludes buffers from the tabline
|
||||
exclude_ft = {'javascript'},
|
||||
exclude_name = {'package.json'},
|
||||
|
||||
-- Show every buffer
|
||||
hide = {current = false, inactive = false, visible = false},
|
||||
|
||||
|
||||
-- Enable/disable icons
|
||||
-- if set to 'numbers', will show buffer index in the tabline
|
||||
-- if set to 'both', will show buffer index and icons in the tabline
|
||||
icons = true,
|
||||
|
||||
-- If set, the icon color will follow its corresponding buffer
|
||||
-- highlight group. By default, the Buffer*Icon group is linked to the
|
||||
-- Buffer* group (see Highlighting below). Otherwise, it will take its
|
||||
-- default value as defined by devicons.
|
||||
icon_custom_colors = false,
|
||||
|
||||
-- Configure icons on the bufferline.
|
||||
icon_separator_active = '▎',
|
||||
icon_separator_inactive = '▎',
|
||||
icon_close_tab = '',
|
||||
icon_close_tab_modified = '●',
|
||||
icon_pinned = '車',
|
||||
|
||||
-- If true, new buffers will be inserted at the start/end of the list.
|
||||
-- Default is to insert after current buffer.
|
||||
insert_at_end = false,
|
||||
insert_at_start = false,
|
||||
|
||||
-- Sets the maximum padding width with which to surround each tab
|
||||
maximum_padding = 1,
|
||||
|
||||
-- Sets the minimum padding width with which to surround each tab
|
||||
minimum_padding = 1,
|
||||
|
||||
-- Sets the maximum buffer name length.
|
||||
maximum_length = 30,
|
||||
|
||||
-- If set, the letters for each buffer in buffer-pick mode will be
|
||||
-- assigned based on their name. Otherwise or in case all letters are
|
||||
-- already assigned, the behavior is to assign letters in order of
|
||||
-- usability (see order below)
|
||||
semantic_letters = true,
|
||||
|
||||
-- New buffer letters are assigned in this order. This order is
|
||||
-- optimal for the qwerty keyboard layout but might need adjustement
|
||||
-- for other layouts.
|
||||
letters = 'asdfjkl;ghnmxcvbziowerutyqpASDFJKLGHNMXCVBZIOWERUTYQP',
|
||||
|
||||
-- Sets the name of unnamed buffers. By default format is "[Buffer X]"
|
||||
-- where X is the buffer number. But only a static string is accepted here.
|
||||
no_name_title = nil,
|
||||
}
|
16
.config/nvim/lua/plugins/lspconfig.lua
Normal file
16
.config/nvim/lua/plugins/lspconfig.lua
Normal file
|
@ -0,0 +1,16 @@
|
|||
local present, lspconfig = pcall(require,"lspconfig")
|
||||
|
||||
on_attach = function(client, bufnr)
|
||||
client.server_capabilities.documentFormattingProvider = false
|
||||
client.server_capabilities.documentRangeFormattingProvider = false
|
||||
|
||||
utils.load_mappings("lspconfig", { buffer = bufnr })
|
||||
|
||||
end
|
||||
|
||||
capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
|
||||
|
||||
lspconfig.hls.setup{}
|
||||
|
||||
lspconfig.rust_analyzer.setup{}
|
31
.config/nvim/lua/plugins/mason.lua
Normal file
31
.config/nvim/lua/plugins/mason.lua
Normal file
|
@ -0,0 +1,31 @@
|
|||
local present, mason = pcall(require, "mason")
|
||||
|
||||
vim.api.nvim_create_augroup("_mason", { clear = true })
|
||||
|
||||
local options = {
|
||||
PATH = "skip",
|
||||
|
||||
ui = {
|
||||
icons = {
|
||||
package_pending = " ",
|
||||
package_installed = " ",
|
||||
package_uninstalled = " ﮊ",
|
||||
},
|
||||
|
||||
keymaps = {
|
||||
toggle_server_expand = "<CR>",
|
||||
install_server = "i",
|
||||
update_server = "u",
|
||||
check_server_version = "c",
|
||||
update_all_servers = "U",
|
||||
check_outdated_servers = "C",
|
||||
uninstall_server = "X",
|
||||
cancel_installation = "<C-c>",
|
||||
},
|
||||
},
|
||||
|
||||
max_concurrent_installers = 10,
|
||||
}
|
||||
|
||||
|
||||
mason.setup(options)
|
181
.config/nvim/lua/plugins/nvim-coc.lua
Normal file
181
.config/nvim/lua/plugins/nvim-coc.lua
Normal file
|
@ -0,0 +1,181 @@
|
|||
-- Some servers have issues with backup files, see #649.
|
||||
vim.opt.backup = false
|
||||
vim.opt.writebackup = false
|
||||
|
||||
-- Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
|
||||
-- delays and poor user experience.
|
||||
vim.opt.updatetime = 300
|
||||
|
||||
-- Always show the signcolumn, otherwise it would shift the text each time
|
||||
-- diagnostics appear/become resolved.
|
||||
vim.opt.signcolumn = "yes"
|
||||
|
||||
local keyset = vim.keymap.set
|
||||
-- Auto complete
|
||||
function _G.check_back_space()
|
||||
local col = vim.fn.col('.') - 1
|
||||
return col == 0 or vim.fn.getline('.'):sub(col, col):match('%s') ~= nil
|
||||
end
|
||||
|
||||
-- Use tab for trigger completion with characters ahead and navigate.
|
||||
-- NOTE: There's always complete item selected by default, you may want to enable
|
||||
-- no select by `"suggest.noselect": true` in your configuration file.
|
||||
-- NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by
|
||||
-- other plugin before putting this into your config.
|
||||
local opts = {silent = true, noremap = true, expr = true, replace_keycodes = false}
|
||||
keyset("i", "<TAB>", 'coc#pum#visible() ? coc#pum#next(1) : v:lua.check_back_space() ? "<TAB>" : coc#refresh()', opts)
|
||||
keyset("i", "<S-TAB>", [[coc#pum#visible() ? coc#pum#prev(1) : "\<C-h>"]], opts)
|
||||
|
||||
-- Make <CR> to accept selected completion item or notify coc.nvim to format
|
||||
-- <C-g>u breaks current undo, please make your own choice.
|
||||
keyset("i", "<cr>", [[coc#pum#visible() ? coc#pum#confirm() : "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>"]], opts)
|
||||
|
||||
-- Use <c-j> to trigger snippets
|
||||
keyset("i", "<c-j>", "<Plug>(coc-snippets-expand-jump)")
|
||||
-- Use <c-space> to trigger completion.
|
||||
keyset("i", "<c-space>", "coc#refresh()", {silent = true, expr = true})
|
||||
|
||||
-- Use `[g` and `]g` to navigate diagnostics
|
||||
-- Use `:CocDiagnostics` to get all diagnostics of current buffer in location list.
|
||||
keyset("n", "[g", "<Plug>(coc-diagnostic-prev)", {silent = true})
|
||||
keyset("n", "]g", "<Plug>(coc-diagnostic-next)", {silent = true})
|
||||
|
||||
-- GoTo code navigation.
|
||||
keyset("n", "gd", "<Plug>(coc-definition)", {silent = true})
|
||||
keyset("n", "gy", "<Plug>(coc-type-definition)", {silent = true})
|
||||
keyset("n", "gi", "<Plug>(coc-implementation)", {silent = true})
|
||||
keyset("n", "gr", "<Plug>(coc-references)", {silent = true})
|
||||
|
||||
|
||||
-- Use K to show documentation in preview window.
|
||||
function _G.show_docs()
|
||||
local cw = vim.fn.expand('<cword>')
|
||||
if vim.fn.index({'vim', 'help'}, vim.bo.filetype) >= 0 then
|
||||
vim.api.nvim_command('h ' .. cw)
|
||||
elseif vim.api.nvim_eval('coc#rpc#ready()') then
|
||||
vim.fn.CocActionAsync('doHover')
|
||||
else
|
||||
vim.api.nvim_command('!' .. vim.o.keywordprg .. ' ' .. cw)
|
||||
end
|
||||
end
|
||||
keyset("n", "K", '<CMD>lua _G.show_docs()<CR>', {silent = true})
|
||||
|
||||
|
||||
-- Highlight the symbol and its references when holding the cursor.
|
||||
vim.api.nvim_create_augroup("CocGroup", {})
|
||||
vim.api.nvim_create_autocmd("CursorHold", {
|
||||
group = "CocGroup",
|
||||
command = "silent call CocActionAsync('highlight')",
|
||||
desc = "Highlight symbol under cursor on CursorHold"
|
||||
})
|
||||
|
||||
|
||||
-- Symbol renaming.
|
||||
keyset("n", "<leader>rn", "<Plug>(coc-rename)", {silent = true})
|
||||
|
||||
|
||||
-- Formatting selected code.
|
||||
keyset("x", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})
|
||||
keyset("n", "<leader>f", "<Plug>(coc-format-selected)", {silent = true})
|
||||
|
||||
|
||||
-- Setup formatexpr specified filetype(s).
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
group = "CocGroup",
|
||||
pattern = "typescript,json",
|
||||
command = "setl formatexpr=CocAction('formatSelected')",
|
||||
desc = "Setup formatexpr specified filetype(s)."
|
||||
})
|
||||
|
||||
-- Update signature help on jump placeholder.
|
||||
vim.api.nvim_create_autocmd("User", {
|
||||
group = "CocGroup",
|
||||
pattern = "CocJumpPlaceholder",
|
||||
command = "call CocActionAsync('showSignatureHelp')",
|
||||
desc = "Update signature help on jump placeholder"
|
||||
})
|
||||
|
||||
|
||||
-- Applying codeAction to the selected region.
|
||||
-- Example: `<leader>aap` for current paragraph
|
||||
local opts = {silent = true, nowait = true}
|
||||
keyset("x", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)
|
||||
keyset("n", "<leader>a", "<Plug>(coc-codeaction-selected)", opts)
|
||||
|
||||
-- Remap keys for applying codeAction to the current buffer.
|
||||
keyset("n", "<leader>ac", "<Plug>(coc-codeaction)", opts)
|
||||
|
||||
|
||||
-- Apply AutoFix to problem on the current line.
|
||||
keyset("n", "<leader>qf", "<Plug>(coc-fix-current)", opts)
|
||||
|
||||
|
||||
-- Run the Code Lens action on the current line.
|
||||
keyset("n", "<leader>cl", "<Plug>(coc-codelens-action)", opts)
|
||||
|
||||
|
||||
-- Map function and class text objects
|
||||
-- NOTE: Requires 'textDocument.documentSymbol' support from the language server.
|
||||
keyset("x", "if", "<Plug>(coc-funcobj-i)", opts)
|
||||
keyset("o", "if", "<Plug>(coc-funcobj-i)", opts)
|
||||
keyset("x", "af", "<Plug>(coc-funcobj-a)", opts)
|
||||
keyset("o", "af", "<Plug>(coc-funcobj-a)", opts)
|
||||
keyset("x", "ic", "<Plug>(coc-classobj-i)", opts)
|
||||
keyset("o", "ic", "<Plug>(coc-classobj-i)", opts)
|
||||
keyset("x", "ac", "<Plug>(coc-classobj-a)", opts)
|
||||
keyset("o", "ac", "<Plug>(coc-classobj-a)", opts)
|
||||
|
||||
|
||||
-- Remap <C-f> and <C-b> for scroll float windows/popups.
|
||||
---@diagnostic disable-next-line: redefined-local
|
||||
local opts = {silent = true, nowait = true, expr = true}
|
||||
keyset("n", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
|
||||
keyset("n", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
|
||||
keyset("i", "<C-f>",
|
||||
'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(1)<cr>" : "<Right>"', opts)
|
||||
keyset("i", "<C-b>",
|
||||
'coc#float#has_scroll() ? "<c-r>=coc#float#scroll(0)<cr>" : "<Left>"', opts)
|
||||
keyset("v", "<C-f>", 'coc#float#has_scroll() ? coc#float#scroll(1) : "<C-f>"', opts)
|
||||
keyset("v", "<C-b>", 'coc#float#has_scroll() ? coc#float#scroll(0) : "<C-b>"', opts)
|
||||
|
||||
|
||||
-- Use CTRL-S for selections ranges.
|
||||
-- Requires 'textDocument/selectionRange' support of language server.
|
||||
keyset("n", "<C-s>", "<Plug>(coc-range-select)", {silent = true})
|
||||
keyset("x", "<C-s>", "<Plug>(coc-range-select)", {silent = true})
|
||||
|
||||
|
||||
-- Add `:Format` command to format current buffer.
|
||||
vim.api.nvim_create_user_command("Format", "call CocAction('format')", {})
|
||||
|
||||
-- " Add `:Fold` command to fold current buffer.
|
||||
vim.api.nvim_create_user_command("Fold", "call CocAction('fold', <f-args>)", {nargs = '?'})
|
||||
|
||||
-- Add `:OR` command for organize imports of the current buffer.
|
||||
vim.api.nvim_create_user_command("OR", "call CocActionAsync('runCommand', 'editor.action.organizeImport')", {})
|
||||
|
||||
-- Add (Neo)Vim's native statusline support.
|
||||
-- NOTE: Please see `:h coc-status` for integrations with external plugins that
|
||||
-- provide custom statusline: lightline.vim, vim-airline.
|
||||
vim.opt.statusline:prepend("%{coc#status()}%{get(b:,'coc_current_function','')}")
|
||||
|
||||
-- Mappings for CoCList
|
||||
-- code actions and coc stuff
|
||||
---@diagnostic disable-next-line: redefined-local
|
||||
local opts = {silent = true, nowait = true}
|
||||
-- Show all diagnostics.
|
||||
keyset("n", "<space>a", ":<C-u>CocList diagnostics<cr>", opts)
|
||||
-- Manage extensions.
|
||||
keyset("n", "<space>e", ":<C-u>CocList extensions<cr>", opts)
|
||||
-- Show commands.
|
||||
keyset("n", "<space>c", ":<C-u>CocList commands<cr>", opts)
|
||||
-- Find symbol of current document.
|
||||
keyset("n", "<space>o", ":<C-u>CocList outline<cr>", opts)
|
||||
-- Search workspace symbols.
|
||||
keyset("n", "<space>s", ":<C-u>CocList -I symbols<cr>", opts)
|
||||
-- Do default action for next item.
|
||||
keyset("n", "<space>j", ":<C-u>CocNext<cr>", opts)
|
||||
-- Do default action for previous item.
|
||||
keyset("n", "<space>k", ":<C-u>CocPrev<cr>", opts)
|
||||
-- Resume latest coc list.
|
||||
keyset("n", "<space>p", ":<C-u>CocListResume<cr>", opts)
|
94
.config/nvim/lua/plugins/packer.lua
Normal file
94
.config/nvim/lua/plugins/packer.lua
Normal file
|
@ -0,0 +1,94 @@
|
|||
|
||||
local packer = require("packer")
|
||||
|
||||
local plugins = packer.startup({function(use)
|
||||
|
||||
use {
|
||||
"wbthomason/packer.nvim",
|
||||
config = [[require("plugins.packer")]]
|
||||
}
|
||||
|
||||
use{ "lewis6991/impatient.nvim"}
|
||||
|
||||
|
||||
use{ "lervag/vimtex",
|
||||
config = function ()
|
||||
require "plugins.vimtex"
|
||||
end
|
||||
}
|
||||
|
||||
use { "ggandor/leap.nvim",
|
||||
config = function ()
|
||||
require('leap').add_default_mappings()
|
||||
end
|
||||
}
|
||||
|
||||
use { "neovim/nvim-lspconfig",
|
||||
config = function ()
|
||||
require "plugins.lspconfig"
|
||||
end
|
||||
}
|
||||
|
||||
use { "williamboman/mason.nvim",
|
||||
config = function ()
|
||||
require "plugins.mason"
|
||||
end
|
||||
}
|
||||
|
||||
use { "feline-nvim/feline.nvim" }
|
||||
|
||||
use {"joshdick/onedark.vim" }
|
||||
|
||||
use {"nvim-tree/nvim-tree.lua",
|
||||
requires = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
config = function()
|
||||
require("nvim-tree").setup()
|
||||
end
|
||||
}
|
||||
|
||||
use {"nvim-treesitter/nvim-treesitter",
|
||||
config = function()
|
||||
require "plugins.treesitter"
|
||||
end
|
||||
}
|
||||
|
||||
use {'romgrk/barbar.nvim',
|
||||
requires = 'kyazdani42/nvim-web-devicons',
|
||||
config = function ()
|
||||
require "plugins.barbar"
|
||||
end
|
||||
}
|
||||
|
||||
use {"windwp/nvim-autopairs",
|
||||
config = function() require("nvim-autopairs").setup {} end
|
||||
}
|
||||
|
||||
use {"neoclide/coc.nvim",
|
||||
config = function() require("plugins.nvim-coc") end
|
||||
}
|
||||
|
||||
use {
|
||||
'nvim-telescope/telescope.nvim', tag = '0.1.0',
|
||||
-- or , branch = '0.1.x',
|
||||
requires = { {'nvim-lua/plenary.nvim'} },
|
||||
config = function() require('plugins.telescope') end
|
||||
}
|
||||
|
||||
use {"jbyuki/instant.nvim"}
|
||||
end,
|
||||
|
||||
config = {
|
||||
auto_clean = true,
|
||||
compile_on_sync = true,
|
||||
git = { clone_timeout = 6000 },
|
||||
display = {
|
||||
working_sym = "ﲊ",
|
||||
error_sym = "✗ ",
|
||||
done_sym = " ",
|
||||
removed_sym = " ",
|
||||
moved_sym = "",
|
||||
},
|
||||
}
|
||||
})
|
12
.config/nvim/lua/plugins/rust-tools.lua
Normal file
12
.config/nvim/lua/plugins/rust-tools.lua
Normal file
|
@ -0,0 +1,12 @@
|
|||
local rt = require("rust-tools")
|
||||
|
||||
rt.setup({
|
||||
server = {
|
||||
on_attach = function(_, bufnr)
|
||||
-- Hover actions
|
||||
vim.keymap.set("n", "<C-space>", rt.hover_actions.hover_actions, { buffer = bufnr })
|
||||
-- Code action groups
|
||||
vim.keymap.set("n", "<Leader>a", rt.code_action_group.code_action_group, { buffer = bufnr })
|
||||
end,
|
||||
},
|
||||
})
|
5
.config/nvim/lua/plugins/telescope.lua
Normal file
5
.config/nvim/lua/plugins/telescope.lua
Normal file
|
@ -0,0 +1,5 @@
|
|||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, {})
|
||||
vim.keymap.set('n', '<leader>fb', builtin.buffers, {})
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, {})
|
6
.config/nvim/lua/plugins/theme.lua
Normal file
6
.config/nvim/lua/plugins/theme.lua
Normal file
|
@ -0,0 +1,6 @@
|
|||
local colorscheme = "onedark"
|
||||
|
||||
local status_ok, _ = pcall(vim.cmd, "colorscheme " .. colorscheme)
|
||||
if not status_ok then
|
||||
return
|
||||
end
|
23
.config/nvim/lua/plugins/treesitter.lua
Normal file
23
.config/nvim/lua/plugins/treesitter.lua
Normal file
|
@ -0,0 +1,23 @@
|
|||
local present, treesitter = pcall(require, "nvim-treesitter.configs")
|
||||
|
||||
require('nvim-treesitter.install').update({ with_sync = true })
|
||||
|
||||
|
||||
if not present then
|
||||
return
|
||||
end
|
||||
|
||||
local options = {
|
||||
ensure_installed = {"lua", "haskell", "rust", },
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
use_languagetree = true,
|
||||
},
|
||||
|
||||
indent = {
|
||||
enable = true,
|
||||
},
|
||||
}
|
||||
|
||||
treesitter.setup(options)
|
3
.config/nvim/lua/plugins/vimtex.lua
Normal file
3
.config/nvim/lua/plugins/vimtex.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
vim.g.vimtex_view_method = 'zathura'
|
||||
|
||||
vim.g.vimtex_compiler_methor = 'latexmk'
|
3
.config/nvim/lua/tsousa/init.lua
Normal file
3
.config/nvim/lua/tsousa/init.lua
Normal file
|
@ -0,0 +1,3 @@
|
|||
require("tsousa.packer")
|
||||
require("tsousa.set")
|
||||
require("tsousa.remap")
|
50
.config/nvim/lua/tsousa/packer.lua
Normal file
50
.config/nvim/lua/tsousa/packer.lua
Normal file
|
@ -0,0 +1,50 @@
|
|||
return require('packer').startup(function(use)
|
||||
-- Packer can manage itself
|
||||
use("wbthomason/packer.nvim")
|
||||
|
||||
use("nvim-lua/plenary.nvim")
|
||||
use("nvim-lua/popup.nvim")
|
||||
use("nvim-telescope/telescope.nvim")
|
||||
use("tpope/vim-surround")
|
||||
use("tpope/vim-fugitive")
|
||||
use("theprimeagen/harpoon")
|
||||
use("mbbill/undotree")
|
||||
use("j-hui/fidget.nvim")
|
||||
|
||||
|
||||
use("nvim-orgmode/orgmode")
|
||||
use("lervag/vimtex")
|
||||
|
||||
use({"hrsh7th/nvim-cmp",
|
||||
requires = {
|
||||
"hrsh7th/cmp-nvim-lsp", -- lsp
|
||||
"hrsh7th/cmp-buffer", --buffer completions
|
||||
"hrsh7th/cmp-path", --path completions
|
||||
"hrsh7th/cmp-cmdline" --cmdline completions
|
||||
},
|
||||
})
|
||||
|
||||
use("williamboman/mason.nvim")
|
||||
use("williamboman/mason-lspconfig.nvim")
|
||||
use("hrsh7th/cmp-nvim-lsp")
|
||||
use("neovim/nvim-lspconfig")
|
||||
use("mfussenegger/nvim-jdtls")
|
||||
use("jose-elias-alvarez/null-ls.nvim")
|
||||
use({"L3MON4D3/LuaSnip",
|
||||
requires = {
|
||||
"saadparwaiz1/cmp_luasnip"
|
||||
},
|
||||
})
|
||||
|
||||
use("nvim-treesitter/nvim-treesitter", {
|
||||
run = ":TSUpdate"
|
||||
})
|
||||
use('nvim-lualine/lualine.nvim')
|
||||
|
||||
use("nvim-treesitter/playground")
|
||||
use("romgrk/nvim-treesitter-context")
|
||||
|
||||
-- Colorscheme section
|
||||
use("catppuccin/nvim")
|
||||
use("folke/tokyonight.nvim")
|
||||
end)
|
36
.config/nvim/lua/tsousa/remap.lua
Normal file
36
.config/nvim/lua/tsousa/remap.lua
Normal file
|
@ -0,0 +1,36 @@
|
|||
vim.g.mapleader = " "
|
||||
vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
|
||||
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
|
||||
vim.keymap.set("n", "J", "mzJ`z")
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
-- greatest remap ever
|
||||
vim.keymap.set("x", "<leader>p", "\"_dP")
|
||||
|
||||
-- next greatest remap ever : asbjornHaland
|
||||
vim.keymap.set("n", "<leader>y", "\"+y")
|
||||
vim.keymap.set("v", "<leader>y", "\"+y")
|
||||
vim.keymap.set("n", "<leader>Y", "\"+Y")
|
||||
|
||||
vim.keymap.set("n", "<leader>d", "\"_d")
|
||||
vim.keymap.set("v", "<leader>d", "\"_d")
|
||||
|
||||
-- This is going to get me cancelled
|
||||
vim.keymap.set("n", "Q", "<nop>")
|
||||
vim.keymap.set("n", "<leader>f", function()
|
||||
vim.lsp.buf.format()
|
||||
end)
|
||||
|
||||
vim.keymap.set("n", "<C-k>", "<cmd>cnext<CR>zz")
|
||||
vim.keymap.set("n", "<C-j>", "<cmd>cprev<CR>zz")
|
||||
vim.keymap.set("n", "<leader>k", "<cmd>lnext<CR>zz")
|
||||
vim.keymap.set("n", "<leader>j", "<cmd>lprev<CR>zz")
|
||||
|
||||
vim.keymap.set("n", "<leader>s", ":%s/\\<<C-r><C-w>\\>/<C-r><C-w>/gI<Left><Left><Left>")
|
||||
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
|
41
.config/nvim/lua/tsousa/set.lua
Normal file
41
.config/nvim/lua/tsousa/set.lua
Normal file
|
@ -0,0 +1,41 @@
|
|||
|
||||
vim.opt.nu = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
vim.opt.errorbells = false
|
||||
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
|
||||
vim.opt.smartindent = true
|
||||
|
||||
vim.opt.wrap = false
|
||||
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.backup = false
|
||||
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||
vim.opt.undofile = true
|
||||
vim.opt.showmode = false
|
||||
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.incsearch = true
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
vim.opt.scrolloff = 8
|
||||
vim.opt.signcolumn = "yes"
|
||||
vim.opt.isfname:append("@-@")
|
||||
|
||||
-- Give more space for displaying messages.
|
||||
vim.opt.cmdheight = 1
|
||||
|
||||
-- Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable
|
||||
-- delays and poor user experience.
|
||||
vim.opt.updatetime = 50
|
||||
|
||||
-- Don't pass messages to |ins-completion-menu|.
|
||||
vim.opt.shortmess:append("c")
|
||||
|
||||
vim.g.mapleader = " "
|
239
.config/nvim/plugin/packer_compiled.lua
Normal file
239
.config/nvim/plugin/packer_compiled.lua
Normal file
|
@ -0,0 +1,239 @@
|
|||
-- Automatically generated packer.nvim plugin loader code
|
||||
|
||||
if vim.api.nvim_call_function('has', {'nvim-0.5'}) ~= 1 then
|
||||
vim.api.nvim_command('echohl WarningMsg | echom "Invalid Neovim version for packer.nvim! | echohl None"')
|
||||
return
|
||||
end
|
||||
|
||||
vim.api.nvim_command('packadd packer.nvim')
|
||||
|
||||
local no_errors, error_msg = pcall(function()
|
||||
|
||||
_G._packer = _G._packer or {}
|
||||
_G._packer.inside_compile = true
|
||||
|
||||
local time
|
||||
local profile_info
|
||||
local should_profile = false
|
||||
if should_profile then
|
||||
local hrtime = vim.loop.hrtime
|
||||
profile_info = {}
|
||||
time = function(chunk, start)
|
||||
if start then
|
||||
profile_info[chunk] = hrtime()
|
||||
else
|
||||
profile_info[chunk] = (hrtime() - profile_info[chunk]) / 1e6
|
||||
end
|
||||
end
|
||||
else
|
||||
time = function(chunk, start) end
|
||||
end
|
||||
|
||||
local function save_profiles(threshold)
|
||||
local sorted_times = {}
|
||||
for chunk_name, time_taken in pairs(profile_info) do
|
||||
sorted_times[#sorted_times + 1] = {chunk_name, time_taken}
|
||||
end
|
||||
table.sort(sorted_times, function(a, b) return a[2] > b[2] end)
|
||||
local results = {}
|
||||
for i, elem in ipairs(sorted_times) do
|
||||
if not threshold or threshold and elem[2] > threshold then
|
||||
results[i] = elem[1] .. ' took ' .. elem[2] .. 'ms'
|
||||
end
|
||||
end
|
||||
if threshold then
|
||||
table.insert(results, '(Only showing plugins that took longer than ' .. threshold .. ' ms ' .. 'to load)')
|
||||
end
|
||||
|
||||
_G._packer.profile_output = results
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], true)
|
||||
local package_path_str = "/home/tsousa/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?.lua;/home/tsousa/.cache/nvim/packer_hererocks/2.1.0-beta3/share/lua/5.1/?/init.lua;/home/tsousa/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?.lua;/home/tsousa/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/luarocks/rocks-5.1/?/init.lua"
|
||||
local install_cpath_pattern = "/home/tsousa/.cache/nvim/packer_hererocks/2.1.0-beta3/lib/lua/5.1/?.so"
|
||||
if not string.find(package.path, package_path_str, 1, true) then
|
||||
package.path = package.path .. ';' .. package_path_str
|
||||
end
|
||||
|
||||
if not string.find(package.cpath, install_cpath_pattern, 1, true) then
|
||||
package.cpath = package.cpath .. ';' .. install_cpath_pattern
|
||||
end
|
||||
|
||||
time([[Luarocks path setup]], false)
|
||||
time([[try_loadstring definition]], true)
|
||||
local function try_loadstring(s, component, name)
|
||||
local success, result = pcall(loadstring(s), name, _G.packer_plugins[name])
|
||||
if not success then
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_notify('packer.nvim: Error running ' .. component .. ' for ' .. name .. ': ' .. result, vim.log.levels.ERROR, {})
|
||||
end)
|
||||
end
|
||||
return result
|
||||
end
|
||||
|
||||
time([[try_loadstring definition]], false)
|
||||
time([[Defining packer_plugins]], true)
|
||||
_G.packer_plugins = {
|
||||
LuaSnip = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/LuaSnip",
|
||||
url = "https://github.com/L3MON4D3/LuaSnip"
|
||||
},
|
||||
["cmp-buffer"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/cmp-buffer",
|
||||
url = "https://github.com/hrsh7th/cmp-buffer"
|
||||
},
|
||||
["cmp-cmdline"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/cmp-cmdline",
|
||||
url = "https://github.com/hrsh7th/cmp-cmdline"
|
||||
},
|
||||
["cmp-nvim-lsp"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/cmp-nvim-lsp",
|
||||
url = "https://github.com/hrsh7th/cmp-nvim-lsp"
|
||||
},
|
||||
["cmp-path"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/cmp-path",
|
||||
url = "https://github.com/hrsh7th/cmp-path"
|
||||
},
|
||||
cmp_luasnip = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/cmp_luasnip",
|
||||
url = "https://github.com/saadparwaiz1/cmp_luasnip"
|
||||
},
|
||||
["fidget.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/fidget.nvim",
|
||||
url = "https://github.com/j-hui/fidget.nvim"
|
||||
},
|
||||
harpoon = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/harpoon",
|
||||
url = "https://github.com/theprimeagen/harpoon"
|
||||
},
|
||||
["lualine.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/lualine.nvim",
|
||||
url = "https://github.com/nvim-lualine/lualine.nvim"
|
||||
},
|
||||
["mason-lspconfig.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/mason-lspconfig.nvim",
|
||||
url = "https://github.com/williamboman/mason-lspconfig.nvim"
|
||||
},
|
||||
["mason.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/mason.nvim",
|
||||
url = "https://github.com/williamboman/mason.nvim"
|
||||
},
|
||||
["null-ls.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/null-ls.nvim",
|
||||
url = "https://github.com/jose-elias-alvarez/null-ls.nvim"
|
||||
},
|
||||
nvim = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/nvim",
|
||||
url = "https://github.com/catppuccin/nvim"
|
||||
},
|
||||
["nvim-cmp"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/nvim-cmp",
|
||||
url = "https://github.com/hrsh7th/nvim-cmp"
|
||||
},
|
||||
["nvim-jdtls"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/nvim-jdtls",
|
||||
url = "https://github.com/mfussenegger/nvim-jdtls"
|
||||
},
|
||||
["nvim-lspconfig"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/nvim-lspconfig",
|
||||
url = "https://github.com/neovim/nvim-lspconfig"
|
||||
},
|
||||
["nvim-treesitter"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/nvim-treesitter",
|
||||
url = "https://github.com/nvim-treesitter/nvim-treesitter"
|
||||
},
|
||||
["nvim-treesitter-context"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/nvim-treesitter-context",
|
||||
url = "https://github.com/romgrk/nvim-treesitter-context"
|
||||
},
|
||||
orgmode = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/orgmode",
|
||||
url = "https://github.com/nvim-orgmode/orgmode"
|
||||
},
|
||||
["packer.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/packer.nvim",
|
||||
url = "https://github.com/wbthomason/packer.nvim"
|
||||
},
|
||||
playground = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/playground",
|
||||
url = "https://github.com/nvim-treesitter/playground"
|
||||
},
|
||||
["plenary.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/plenary.nvim",
|
||||
url = "https://github.com/nvim-lua/plenary.nvim"
|
||||
},
|
||||
["popup.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/popup.nvim",
|
||||
url = "https://github.com/nvim-lua/popup.nvim"
|
||||
},
|
||||
["telescope.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/telescope.nvim",
|
||||
url = "https://github.com/nvim-telescope/telescope.nvim"
|
||||
},
|
||||
["tokyonight.nvim"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/tokyonight.nvim",
|
||||
url = "https://github.com/folke/tokyonight.nvim"
|
||||
},
|
||||
undotree = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/undotree",
|
||||
url = "https://github.com/mbbill/undotree"
|
||||
},
|
||||
["vim-fugitive"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/vim-fugitive",
|
||||
url = "https://github.com/tpope/vim-fugitive"
|
||||
},
|
||||
["vim-surround"] = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/vim-surround",
|
||||
url = "https://github.com/tpope/vim-surround"
|
||||
},
|
||||
vimtex = {
|
||||
loaded = true,
|
||||
path = "/home/tsousa/.local/share/nvim/site/pack/packer/start/vimtex",
|
||||
url = "https://github.com/lervag/vimtex"
|
||||
}
|
||||
}
|
||||
|
||||
time([[Defining packer_plugins]], false)
|
||||
|
||||
_G._packer.inside_compile = false
|
||||
if _G._packer.needs_bufread == true then
|
||||
vim.cmd("doautocmd BufRead")
|
||||
end
|
||||
_G._packer.needs_bufread = false
|
||||
|
||||
if should_profile then save_profiles() end
|
||||
|
||||
end)
|
||||
|
||||
if not no_errors then
|
||||
error_msg = error_msg:gsub('"', '\\"')
|
||||
vim.api.nvim_command('echohl ErrorMsg | echom "Error in packer_compiled: '..error_msg..'" | echom "Please check your config for correctness" | echohl None')
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue