From aac70f371820ba3066255c344ea4471ca5686c4b Mon Sep 17 00:00:00 2001 From: tiago Date: Sun, 8 Oct 2023 17:51:54 +0100 Subject: [PATCH] changing from packer to lazy --- .config/nvim/tsousa/init.lua | 3 + .config/nvim/tsousa/lazy.lua | 14 ++ .config/nvim/tsousa/packer.lua | 65 ++++++ .config/nvim/tsousa/plugins/cmp.lua | 198 ++++++++++++++++++ .config/nvim/tsousa/plugins/colorizer.lua | 6 + .config/nvim/tsousa/plugins/colorscheme.lua | 54 +++++ .config/nvim/tsousa/plugins/fidget.lua | 1 + .config/nvim/tsousa/plugins/fugitive.lua | 1 + .config/nvim/tsousa/plugins/harpoon.lua | 10 + .config/nvim/tsousa/plugins/lspconfig.lua | 97 +++++++++ .config/nvim/tsousa/plugins/null-ls.lua | 12 ++ .config/nvim/tsousa/plugins/orgmode.lua | 21 ++ .config/nvim/tsousa/plugins/statusline.lua | 40 ++++ .config/nvim/tsousa/plugins/telescope.lua | 5 + .../tsousa/plugins/treesitter-context.lua | 36 ++++ .config/nvim/tsousa/plugins/treesitter.lua | 9 + .config/nvim/tsousa/plugins/undotree.lua | 1 + .config/nvim/tsousa/plugins/vimtex.lua | 2 + .config/nvim/tsousa/remap.lua | 36 ++++ .config/nvim/tsousa/set.lua | 41 ++++ 20 files changed, 652 insertions(+) create mode 100644 .config/nvim/tsousa/init.lua create mode 100644 .config/nvim/tsousa/lazy.lua create mode 100644 .config/nvim/tsousa/packer.lua create mode 100644 .config/nvim/tsousa/plugins/cmp.lua create mode 100644 .config/nvim/tsousa/plugins/colorizer.lua create mode 100644 .config/nvim/tsousa/plugins/colorscheme.lua create mode 100644 .config/nvim/tsousa/plugins/fidget.lua create mode 100644 .config/nvim/tsousa/plugins/fugitive.lua create mode 100644 .config/nvim/tsousa/plugins/harpoon.lua create mode 100644 .config/nvim/tsousa/plugins/lspconfig.lua create mode 100644 .config/nvim/tsousa/plugins/null-ls.lua create mode 100644 .config/nvim/tsousa/plugins/orgmode.lua create mode 100644 .config/nvim/tsousa/plugins/statusline.lua create mode 100644 .config/nvim/tsousa/plugins/telescope.lua create mode 100644 .config/nvim/tsousa/plugins/treesitter-context.lua create mode 100644 .config/nvim/tsousa/plugins/treesitter.lua create mode 100644 .config/nvim/tsousa/plugins/undotree.lua create mode 100644 .config/nvim/tsousa/plugins/vimtex.lua create mode 100644 .config/nvim/tsousa/remap.lua create mode 100644 .config/nvim/tsousa/set.lua diff --git a/.config/nvim/tsousa/init.lua b/.config/nvim/tsousa/init.lua new file mode 100644 index 0000000..2d47913 --- /dev/null +++ b/.config/nvim/tsousa/init.lua @@ -0,0 +1,3 @@ +require("tsousa.packer") +require("tsousa.set") +require("tsousa.remap") diff --git a/.config/nvim/tsousa/lazy.lua b/.config/nvim/tsousa/lazy.lua new file mode 100644 index 0000000..c359014 --- /dev/null +++ b/.config/nvim/tsousa/lazy.lua @@ -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") diff --git a/.config/nvim/tsousa/packer.lua b/.config/nvim/tsousa/packer.lua new file mode 100644 index 0000000..0dcc61e --- /dev/null +++ b/.config/nvim/tsousa/packer.lua @@ -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) diff --git a/.config/nvim/tsousa/plugins/cmp.lua b/.config/nvim/tsousa/plugins/cmp.lua new file mode 100644 index 0000000..c0348bc --- /dev/null +++ b/.config/nvim/tsousa/plugins/cmp.lua @@ -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 = { + [""] = cmp.mapping(cmp.mapping.scroll_docs(-1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.scroll_docs(1), { "i", "c" }), + [""] = cmp.mapping(cmp.mapping.complete(), { "i", "c" }), + [""] = cmp.config.disable, -- Specify `cmp.config.disable` if you want to remove the default `` mapping. + [""] = cmp.mapping { + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }, + -- Accept currently selected item. If none selected, do nothing. + [""] = cmp.mapping.confirm { select = false }, + [""] = 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), + [""] = cmp.mapping(function(fallback) + if luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end + ), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + else + fallback() + end + end, { + "i", + "s", + }), + [""] = 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, +} diff --git a/.config/nvim/tsousa/plugins/colorizer.lua b/.config/nvim/tsousa/plugins/colorizer.lua new file mode 100644 index 0000000..276e879 --- /dev/null +++ b/.config/nvim/tsousa/plugins/colorizer.lua @@ -0,0 +1,6 @@ +require 'colorizer'.setup({ + 'dosini'; + 'css'; + 'javascript'; + html = { mode = 'background' }; +}) diff --git a/.config/nvim/tsousa/plugins/colorscheme.lua b/.config/nvim/tsousa/plugins/colorscheme.lua new file mode 100644 index 0000000..4614ad6 --- /dev/null +++ b/.config/nvim/tsousa/plugins/colorscheme.lua @@ -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") + diff --git a/.config/nvim/tsousa/plugins/fidget.lua b/.config/nvim/tsousa/plugins/fidget.lua new file mode 100644 index 0000000..4f1ab35 --- /dev/null +++ b/.config/nvim/tsousa/plugins/fidget.lua @@ -0,0 +1 @@ +require("fidget").setup() diff --git a/.config/nvim/tsousa/plugins/fugitive.lua b/.config/nvim/tsousa/plugins/fugitive.lua new file mode 100644 index 0000000..80c9070 --- /dev/null +++ b/.config/nvim/tsousa/plugins/fugitive.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "gs", vim.cmd.Git) diff --git a/.config/nvim/tsousa/plugins/harpoon.lua b/.config/nvim/tsousa/plugins/harpoon.lua new file mode 100644 index 0000000..a082d80 --- /dev/null +++ b/.config/nvim/tsousa/plugins/harpoon.lua @@ -0,0 +1,10 @@ +local mark = require("harpoon.mark") +local ui = require("harpoon.ui") + +vim.keymap.set("n", "a", mark.add_file) +vim.keymap.set("n", "", ui.toggle_quick_menu) + +vim.keymap.set("n", "", function () ui.nav_file(1) end) +vim.keymap.set("n", "", function () ui.nav_file(2) end) +vim.keymap.set("n", "", function () ui.nav_file(3) end) +vim.keymap.set("n", "", function () ui.nav_file(4) end) diff --git a/.config/nvim/tsousa/plugins/lspconfig.lua b/.config/nvim/tsousa/plugins/lspconfig.lua new file mode 100644 index 0000000..a788704 --- /dev/null +++ b/.config/nvim/tsousa/plugins/lspconfig.lua @@ -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 = "", + install_server = "i", + update_server = "u", + check_server_version = "c", + update_all_servers = "U", + check_outdated_servers = "C", + uninstall_server = "X", + cancel_installation = "", + }, + }, + + 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', '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', '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 + 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', '', vim.lsp.buf.signature_help, bufopts) + vim.keymap.set('n', 'wa', vim.lsp.buf.add_workspace_folder, bufopts) + vim.keymap.set('n', 'wr', vim.lsp.buf.remove_workspace_folder, bufopts) + vim.keymap.set('n', 'wl', function() + print(vim.inspect(vim.lsp.buf.list_workspace_folders())) + end, bufopts) + vim.keymap.set('n', 'D', vim.lsp.buf.type_definition, bufopts) + vim.keymap.set('n', 'rn', vim.lsp.buf.rename, bufopts) + vim.keymap.set('n', 'ca', vim.lsp.buf.code_action, bufopts) + vim.keymap.set('n', 'gr', vim.lsp.buf.references, bufopts) + vim.keymap.set('n', 'ge', function() vim.diagnostic.goto_next() end, bufopts) + vim.keymap.set('n', 'gE', function() vim.diagnostic.goto_prev() end, bufopts) + vim.keymap.set('n', '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, +} diff --git a/.config/nvim/tsousa/plugins/null-ls.lua b/.config/nvim/tsousa/plugins/null-ls.lua new file mode 100644 index 0000000..54db889 --- /dev/null +++ b/.config/nvim/tsousa/plugins/null-ls.lua @@ -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" }, + }), + } +}) diff --git a/.config/nvim/tsousa/plugins/orgmode.lua b/.config/nvim/tsousa/plugins/orgmode.lua new file mode 100644 index 0000000..9a9ae33 --- /dev/null +++ b/.config/nvim/tsousa/plugins/orgmode.lua @@ -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', +}) diff --git a/.config/nvim/tsousa/plugins/statusline.lua b/.config/nvim/tsousa/plugins/statusline.lua new file mode 100644 index 0000000..56c426a --- /dev/null +++ b/.config/nvim/tsousa/plugins/statusline.lua @@ -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 = {} +} diff --git a/.config/nvim/tsousa/plugins/telescope.lua b/.config/nvim/tsousa/plugins/telescope.lua new file mode 100644 index 0000000..7157164 --- /dev/null +++ b/.config/nvim/tsousa/plugins/telescope.lua @@ -0,0 +1,5 @@ +local builtin = require('telescope.builtin') +vim.keymap.set('n', 'sf', builtin.find_files, {}) +vim.keymap.set('n', 'sg', builtin.live_grep, {}) +vim.keymap.set('n', 'sb', builtin.buffers, {}) +vim.keymap.set('n', 'sh', builtin.help_tags, {}) diff --git a/.config/nvim/tsousa/plugins/treesitter-context.lua b/.config/nvim/tsousa/plugins/treesitter-context.lua new file mode 100644 index 0000000..ff04b61 --- /dev/null +++ b/.config/nvim/tsousa/plugins/treesitter-context.lua @@ -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) diff --git a/.config/nvim/tsousa/plugins/treesitter.lua b/.config/nvim/tsousa/plugins/treesitter.lua new file mode 100644 index 0000000..7ddfa82 --- /dev/null +++ b/.config/nvim/tsousa/plugins/treesitter.lua @@ -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, + }, +} diff --git a/.config/nvim/tsousa/plugins/undotree.lua b/.config/nvim/tsousa/plugins/undotree.lua new file mode 100644 index 0000000..b6b9276 --- /dev/null +++ b/.config/nvim/tsousa/plugins/undotree.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) diff --git a/.config/nvim/tsousa/plugins/vimtex.lua b/.config/nvim/tsousa/plugins/vimtex.lua new file mode 100644 index 0000000..9b92de7 --- /dev/null +++ b/.config/nvim/tsousa/plugins/vimtex.lua @@ -0,0 +1,2 @@ +vim.g.vimtex_view_method = 'zathura' +vim.g.vimtex_compiler_methor = 'latexmk' diff --git a/.config/nvim/tsousa/remap.lua b/.config/nvim/tsousa/remap.lua new file mode 100644 index 0000000..8e0bcaa --- /dev/null +++ b/.config/nvim/tsousa/remap.lua @@ -0,0 +1,36 @@ +vim.g.mapleader = " " +vim.keymap.set("n", "pv", vim.cmd.Ex) + +vim.keymap.set("v", "J", ":m '>+1gv=gv") +vim.keymap.set("v", "K", ":m '<-2gv=gv") + +vim.keymap.set("n", "J", "mzJ`z") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "", "zz") +vim.keymap.set("n", "n", "nzzzv") +vim.keymap.set("n", "N", "Nzzzv") + +-- greatest remap ever +vim.keymap.set("x", "p", "\"_dP") + +-- next greatest remap ever : asbjornHaland +vim.keymap.set("n", "y", "\"+y") +vim.keymap.set("v", "y", "\"+y") +vim.keymap.set("n", "Y", "\"+Y") + +vim.keymap.set("n", "d", "\"_d") +vim.keymap.set("v", "d", "\"_d") + +-- This is going to get me cancelled +vim.keymap.set("n", "Q", "") +vim.keymap.set("n", "f", function() + vim.lsp.buf.format() +end) + +vim.keymap.set("n", "", "cnextzz") +vim.keymap.set("n", "", "cprevzz") +vim.keymap.set("n", "k", "lnextzz") +vim.keymap.set("n", "j", "lprevzz") + +vim.keymap.set("n", "s", ":%s/\\<\\>//gI") +vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) diff --git a/.config/nvim/tsousa/set.lua b/.config/nvim/tsousa/set.lua new file mode 100644 index 0000000..1fc6880 --- /dev/null +++ b/.config/nvim/tsousa/set.lua @@ -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 = " "