This commit is contained in:
Tiago Sousa 2023-10-09 09:51:43 +01:00
commit 4e77df8c01
24 changed files with 665 additions and 11 deletions

View file

@ -26,8 +26,8 @@ starship init fish | source
# >>> conda initialize >>>
# !! Contents within this block are managed by 'conda init' !!
if test -f /home/tsousa/miniconda3/bin/conda
eval /home/tsousa/miniconda3/bin/conda "shell.fish" "hook" $argv | source
if test -f /home/tsousa/.miniconda3/bin/conda
eval /home/tsousa/.miniconda3/bin/conda "shell.fish" "hook" $argv | source
end
# <<< conda initialize <<<
conda deactivate

View file

@ -38,17 +38,17 @@ exec --no-startup-id nm-applet
# Use pactl to adjust volume in PulseAudio.
#set $refresh_i3status killall -SIGUSR1 i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pamixer -i 5 && $refresh_i3status
bindsym XF86AudioLowerVolume exec --no-startup-id pamixer -d 5 && $refresh_i3status
bindsym XF86AudioMute exec --no-startup-id pamixer set --toggle-mute && $refresh_i3status
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle && $refresh_i3status
bindsym XF86AudioRaiseVolume exec --no-startup-id pamixer -i 5
bindsym XF86AudioLowerVolume exec --no-startup-id pamixer -d 5
bindsym XF86AudioMute exec --no-startup-id pamixer set --toggle-mute
bindsym XF86AudioMicMute exec --no-startup-id pactl set-source-mute @DEFAULT_SOURCE@ toggle
bindsym XF86AudioPlay exec --no-startup-id playerctl play-pause
bindsym XF86AudioNext exec --no-startup-id playerctl next
bindsym XF86AudioPrev exec --no-startup-id playerctl previous
# Use lux to adjust brightness
bindsym XF86MonBrightnessUp exec --no-startup-id lux -a 10% && $refresh_i3status
bindsym XF86MonBrightnessDown exec --no-startup-id lux -s 10% -m 1 && $refresh_i3status
bindsym XF86MonBrightnessUp exec --no-startup-id lux -a 10%
bindsym XF86MonBrightnessDown exec --no-startup-id lux -s 10% -m 1
# Screen capture program
bindsym Print exec --no-startup-id flameshot gui

View file

@ -16,6 +16,6 @@ require('nvim-treesitter.configs').setup {
}
require('orgmode').setup({
org_agenda_files = '~/Nextcloud/org/**/*',
org_default_notes_file = '~/Nextcloud/org/refile.org',
org_agenda_files = { '~/Nextcloud/Documents/uni/**/*'},
org_default_notes_file = '~/Nextcloud/Documents/uni/refile.org',
})

View file

@ -23,7 +23,6 @@ return require('packer').startup(function(use)
use("norcalli/nvim-colorizer.lua")
use("nvim-orgmode/orgmode")
use("lervag/vimtex")
use({
@ -52,6 +51,9 @@ return require('packer').startup(function(use)
use("nvim-treesitter/nvim-treesitter", {
run = ":TSUpdate"
})
use("nvim-orgmode/orgmode")
use('nvim-lualine/lualine.nvim')
use("nvim-treesitter/playground")

View file

@ -0,0 +1,3 @@
require("tsousa.packer")
require("tsousa.set")
require("tsousa.remap")

View file

@ -0,0 +1,14 @@
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
if not vim.loop.fs_stat(lazypath) then
vim.fn.system({
"git",
"clone",
"--filter=blob:none",
"https://github.com/folke/lazy.nvim.git",
"--branch=stable", -- latest stable release
lazypath,
})
end
vim.opt.rtp:prepend(lazypath)
require("lazy").setup("tsousa.plugins")

View file

@ -0,0 +1,65 @@
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")
-- fidget change when rewrite version comes out
use {
'j-hui/fidget.nvim',
tag = 'legacy',
config = function()
require("fidget").setup {
-- options
}
end,
}
use("norcalli/nvim-colorizer.lua")
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-orgmode/orgmode")
use('nvim-lualine/lualine.nvim')
use("nvim-treesitter/playground")
use("romgrk/nvim-treesitter-context")
-- Colorscheme section
use("catppuccin/nvim")
use("ellisonleao/gruvbox.nvim")
end)

View file

@ -0,0 +1,198 @@
return {
"hrsh7th/nvim-cmp",
dependencies = {
'hrsh7th/cmp-nvim-lsp', -- lsp
'hrsh7th/cmp-nvim-lua', -- Nvim API completions
'hrsh7th/cmp-nvim-lsp-signature-help', -- Show function signatures
'hrsh7th/cmp-buffer', --buffer completions
'hrsh7th/cmp-path', --path completions
'hrsh7th/cmp-cmdline', --cmdline completions
'L3MON4D3/LuaSnip',
'rafamadriz/friendly-snippets',
'saadparwaiz1/cmp_luasnip',
},
opts = function(_, opts)
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' },
{ name = 'orgmode' }
},
{
--This sources will only show up if there aren't any sources from the other list
{ name = "buffer", keyword_length = 5 },
}
),
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,
},
}
end,
}

View file

@ -0,0 +1,6 @@
require 'colorizer'.setup({
'dosini';
'css';
'javascript';
html = { mode = 'background' };
})

View file

@ -0,0 +1,54 @@
require("catppuccin").setup({
flavour = "macchiato", -- 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,
},
})
require("gruvbox").setup({
undercurl = true,
underline = true,
bold = true,
italic = {
strings = false,
comments = true,
operators = false,
folds = true,
},
strikethrough = true,
invert_selection = false,
invert_signs = false,
invert_tabline = false,
invert_intend_guides = false,
inverse = true, -- invert background for search, diffs, statuslines and errors
contrast = "", -- can be "hard", "soft" or empty string
palette_overrides = {},
overrides = {},
dim_inactive = false,
transparent_mode = false,
})
vim.o.background = "dark"
vim.cmd.colorscheme("catppuccin")

View file

@ -0,0 +1 @@
require("fidget").setup()

View file

@ -0,0 +1 @@
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)

View 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)

View 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_installed = "",
package_pending = "",
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,
}

View file

@ -0,0 +1,12 @@
local null_ls = require("null-ls")
null_ls.setup({
sources = {
null_ls.builtins.formatting.rustfmt,
null_ls.builtins.formatting.black,
null_ls.builtins.formatting.shfmt,
null_ls.builtins.formatting.prettierd.with({
filetypes = { "html", "json", "yaml", "markdown" },
}),
}
})

View 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 = { '~/Nextcloud/Documents/uni/**/*'},
org_default_notes_file = '~/Nextcloud/Documents/uni/refile.org',
})

View 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 = {}
}

View 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, {})

View 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)

View file

@ -0,0 +1,9 @@
require'nvim-treesitter.configs'.setup {
ensure_installed = {"lua","vim","python","rust","haskell","c","java", "bash","go"},
sync_install = false,
highlight = {
enable = true,
additional_vim_regex_highlighting = false,
},
}

View file

@ -0,0 +1 @@
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)

View file

@ -0,0 +1,2 @@
vim.g.vimtex_view_method = 'zathura'
vim.g.vimtex_compiler_methor = 'latexmk'

View 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 })

View 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 = " "