diff --git a/.config/nvim/after/plugin/autopairs.lua b/.config/nvim/after/plugin/autopairs.lua index 0f775736..4de6add2 100644 --- a/.config/nvim/after/plugin/autopairs.lua +++ b/.config/nvim/after/plugin/autopairs.lua @@ -1 +1 @@ -require('nvim-autopairs').setup() +require("nvim-autopairs").setup() diff --git a/.config/nvim/after/plugin/colorizer.lua b/.config/nvim/after/plugin/colorizer.lua index c7f7af87..4a4590bb 100644 --- a/.config/nvim/after/plugin/colorizer.lua +++ b/.config/nvim/after/plugin/colorizer.lua @@ -1 +1 @@ -require'colorizer'.setup() +require("colorizer").setup() diff --git a/.config/nvim/after/plugin/harpoon.lua b/.config/nvim/after/plugin/harpoon.lua new file mode 100644 index 00000000..2a12f1d1 --- /dev/null +++ b/.config/nvim/after/plugin/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", "h", function() ui.nav_file(1) end) +vim.keymap.set("n", "j", function() ui.nav_file(2) end) +vim.keymap.set("n", "k", function() ui.nav_file(3) end) +vim.keymap.set("n", "l", function() ui.nav_file(4) end) diff --git a/.config/nvim/after/plugin/lastplace.lua b/.config/nvim/after/plugin/lastplace.lua index 61d5171a..642cdace 100644 --- a/.config/nvim/after/plugin/lastplace.lua +++ b/.config/nvim/after/plugin/lastplace.lua @@ -1 +1 @@ -require'nvim-lastplace'.setup{} +require("nvim-lastplace").setup({}) diff --git a/.config/nvim/after/plugin/lsp.lua b/.config/nvim/after/plugin/lsp.lua index 1227fb78..f69c8b3a 100644 --- a/.config/nvim/after/plugin/lsp.lua +++ b/.config/nvim/after/plugin/lsp.lua @@ -3,102 +3,64 @@ local lsp = require("lsp-zero") lsp.preset("recommended") lsp.ensure_installed({ -'tsserver', -'eslint', -'sumneko_lua', -'rust_analyzer', + "tsserver", + "eslint", + "sumneko_lua", + "rust_analyzer", }) -- Fix Undefined global 'vim' -lsp.configure('sumneko_lua', { -settings = { -Lua = { - diagnostics = { - globals = { 'vim' } - } -} -} +lsp.configure("sumneko_lua", { + settings = { + Lua = { + diagnostics = { + globals = { "vim" }, + }, + }, + }, }) - -local cmp = require('cmp') +local cmp = require("cmp") cmp.setup({ - window = { - completion = cmp.config.window.bordered(), - documentation = cmp.config.window.bordered(), - } -}) - -local cmp_select = {behavior = cmp.SelectBehavior.Select} -local cmp_mappings = lsp.defaults.cmp_mappings({ -[''] = cmp.mapping.select_prev_item(cmp_select), -[''] = cmp.mapping.select_next_item(cmp_select), -[''] = cmp.mapping.confirm({ select = true }), -[""] = cmp.mapping.complete(), -}) - --- disable completion with tab --- this helps with copilot setup -cmp_mappings[''] = nil -cmp_mappings[''] = nil - -lsp.setup_nvim_cmp({ -mapping = cmp_mappings + window = { + completion = cmp.config.window.bordered(), + documentation = cmp.config.window.bordered(), + }, }) lsp.set_preferences({ -suggest_lsp_servers = false, -sign_icons = { - error = 'E', - warn = 'W', - hint = 'H', - info = 'I' -} + suggest_lsp_servers = false, + sign_icons = { + error = "E", + warn = "W", + hint = "H", + info = "I", + }, }) -lsp.on_attach(function(client, bufnr) -local opts = {buffer = bufnr, remap = false} - -if client.name == "eslint" then - vim.cmd.LspStop('eslint') - return -end - -vim.keymap.set("n", "gd", vim.lsp.buf.definition, opts) -vim.keymap.set("n", "K", vim.lsp.buf.hover, opts) -vim.keymap.set("n", "vws", vim.lsp.buf.workspace_symbol, opts) -vim.keymap.set("n", "vd", vim.diagnostic.open_float, opts) -vim.keymap.set("n", "[d", vim.diagnostic.goto_next, opts) -vim.keymap.set("n", "]d", vim.diagnostic.goto_prev, opts) -vim.keymap.set("n", "vca", vim.lsp.buf.code_action, opts) -vim.keymap.set("n", "vrr", vim.lsp.buf.references, opts) -vim.keymap.set("n", "vrn", vim.lsp.buf.rename, opts) - vim.keymap.set("i", "", vim.lsp.buf.signature_help, opts) -end) - -- function that is used with keybinding cm to toggle autocompletion -Mode = require('cmp.types').cmp.TriggerEvent.TextChanged +Mode = require("cmp.types").cmp.TriggerEvent.TextChanged function SetAutoCmp(mode) - if mode then - cmp.setup({ - completion = { - autocomplete = { Mode } - } - }) - Mode = false - else - cmp.setup({ - completion = { - autocomplete = Mode - } - }) - Mode = require('cmp.types').cmp.TriggerEvent.TextChanged - end + if mode then + cmp.setup({ + completion = { + autocomplete = { Mode }, + }, + }) + Mode = false + else + cmp.setup({ + completion = { + autocomplete = Mode, + }, + }) + Mode = require("cmp.types").cmp.TriggerEvent.TextChanged + end end SetAutoCmp(Mode) lsp.setup() vim.diagnostic.config({ - virtual_text = true, + virtual_text = true, }) diff --git a/.config/nvim/after/plugin/lualine.lua b/.config/nvim/after/plugin/lualine.lua index a7b34d9b..b9316a92 100644 --- a/.config/nvim/after/plugin/lualine.lua +++ b/.config/nvim/after/plugin/lualine.lua @@ -1,3 +1,3 @@ -require('lualine').setup({ - options = { them = 'nord' } +require("lualine").setup({ + options = { them = "nord" }, }) diff --git a/.config/nvim/after/plugin/mardownpreview.lua b/.config/nvim/after/plugin/mardownpreview.lua index f1cbad1b..abf1fa36 100644 --- a/.config/nvim/after/plugin/mardownpreview.lua +++ b/.config/nvim/after/plugin/mardownpreview.lua @@ -1,2 +1,2 @@ -vim.g.mkdp_browser = 'librewolf' -vim.g.mkdp_theme = 'dark' +vim.g.mkdp_browser = "librewolf" +vim.g.mkdp_theme = "dark" diff --git a/.config/nvim/after/plugin/neoformat.lua b/.config/nvim/after/plugin/neoformat.lua new file mode 100644 index 00000000..90bc8386 --- /dev/null +++ b/.config/nvim/after/plugin/neoformat.lua @@ -0,0 +1 @@ +vim.cmd([[let g:shfmt_opt="-ci"]]) diff --git a/.config/nvim/after/plugin/nvimtree.lua b/.config/nvim/after/plugin/nvimtree.lua index d25e3d74..4c39cc86 100644 --- a/.config/nvim/after/plugin/nvimtree.lua +++ b/.config/nvim/after/plugin/nvimtree.lua @@ -1,117 +1,117 @@ -- Nvim_Tree configuration: -- setup with all defaults -- each of these are documented in `:help nvim-tree.OPTION_NAME` -require'nvim-tree'.setup { -- BEGIN_DEFAULT_OPTS - auto_reload_on_write = true, - disable_netrw = false, - -- hide_root_folder = false, - hijack_cursor = false, - hijack_netrw = true, - hijack_unnamed_buffer_when_opening = false, - ignore_buffer_on_setup = false, - open_on_setup = false, - open_on_setup_file = false, - open_on_tab = false, - sort_by = "name", - update_cwd = false, - view = { - width = 25, - -- height = 30, - side = "right", - preserve_window_proportions = true, - number = false, - relativenumber = false, - signcolumn = "yes", - mappings = { - custom_only = false, - list = { - -- user mappings go here - }, - }, - }, - renderer = { - indent_markers = { - enable = false, - icons = { - corner = "└ ", - edge = "│ ", - none = " ", - }, - }, - icons = { - webdev_colors = true, - }, - }, - hijack_directories = { - enable = true, - auto_open = true, - }, - update_focused_file = { - enable = false, - update_cwd = false, - ignore_list = {}, - }, - ignore_ft_on_setup = {}, - system_open = { - cmd = nil, - args = {}, - }, - diagnostics = { - enable = false, - show_on_dirs = false, - icons = { - hint = "", - info = "", - warning = "", - error = "", - }, - }, - filters = { - dotfiles = false, - custom = {}, - exclude = {}, - }, - git = { - enable = true, - ignore = true, - timeout = 400, - }, - actions = { - use_system_clipboard = true, - change_dir = { - enable = true, - global = false, - restrict_above_cwd = false, - }, - open_file = { - quit_on_open = false, - resize_window = false, - window_picker = { - enable = true, - chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", - exclude = { - filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, - buftype = { "nofile", "terminal", "help" }, - }, - }, - }, - }, - trash = { - cmd = "trash", - require_confirm = true, - }, - log = { - enable = false, - truncate = false, - types = { - all = false, - config = false, - copy_paste = false, - diagnostics = false, - git = false, - profile = false, - }, - }, -} -- END_DEFAULT_OPTS for Nvim_Tree +require("nvim-tree").setup({ -- BEGIN_DEFAULT_OPTS + auto_reload_on_write = true, + disable_netrw = false, + -- hide_root_folder = false, + hijack_cursor = false, + hijack_netrw = true, + hijack_unnamed_buffer_when_opening = false, + ignore_buffer_on_setup = false, + open_on_setup = false, + open_on_setup_file = false, + open_on_tab = false, + sort_by = "name", + update_cwd = false, + view = { + width = 25, + -- height = 30, + side = "right", + preserve_window_proportions = true, + number = false, + relativenumber = false, + signcolumn = "yes", + mappings = { + custom_only = false, + list = { + -- user mappings go here + }, + }, + }, + renderer = { + indent_markers = { + enable = false, + icons = { + corner = "└ ", + edge = "│ ", + none = " ", + }, + }, + icons = { + webdev_colors = true, + }, + }, + hijack_directories = { + enable = true, + auto_open = true, + }, + update_focused_file = { + enable = false, + update_cwd = false, + ignore_list = {}, + }, + ignore_ft_on_setup = {}, + system_open = { + cmd = nil, + args = {}, + }, + diagnostics = { + enable = false, + show_on_dirs = false, + icons = { + hint = "", + info = "", + warning = "", + error = "", + }, + }, + filters = { + dotfiles = false, + custom = {}, + exclude = {}, + }, + git = { + enable = true, + ignore = true, + timeout = 400, + }, + actions = { + use_system_clipboard = true, + change_dir = { + enable = true, + global = false, + restrict_above_cwd = false, + }, + open_file = { + quit_on_open = false, + resize_window = false, + window_picker = { + enable = true, + chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", + exclude = { + filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, + buftype = { "nofile", "terminal", "help" }, + }, + }, + }, + }, + trash = { + cmd = "trash", + require_confirm = true, + }, + log = { + enable = false, + truncate = false, + types = { + all = false, + config = false, + copy_paste = false, + diagnostics = false, + git = false, + profile = false, + }, + }, +}) -- END_DEFAULT_OPTS for Nvim_Tree - -- Automatically closes Nvim tree if last window open -vim.cmd[[autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif]] +-- Automatically closes Nvim tree if last window open +vim.cmd([[autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif]]) diff --git a/.config/nvim/after/plugin/ripgrep.lua b/.config/nvim/after/plugin/ripgrep.lua index 33b9df57..2bc6cab8 100644 --- a/.config/nvim/after/plugin/ripgrep.lua +++ b/.config/nvim/after/plugin/ripgrep.lua @@ -1,12 +1,12 @@ -- Enable use of ripgrep -require('nvim-ripgrep').setup{ - runner = require('nvim-ripgrep.run').ripgrep, -- grep command - prompt = "❯ ", -- prompt - window = { - width = 0.8, - border = "rounded", - }; - open_qf_fn = function() - return vim.api.nvim_command('copen') - end, -} +require("nvim-ripgrep").setup({ + runner = require("nvim-ripgrep.run").ripgrep, -- grep command + prompt = "❯ ", -- prompt + window = { + width = 0.8, + border = "rounded", + }, + open_qf_fn = function() + return vim.api.nvim_command("copen") + end, +}) diff --git a/.config/nvim/after/plugin/treesitter.lua b/.config/nvim/after/plugin/treesitter.lua index e0cc51f2..a731c4ca 100644 --- a/.config/nvim/after/plugin/treesitter.lua +++ b/.config/nvim/after/plugin/treesitter.lua @@ -1,22 +1,53 @@ -require'nvim-treesitter.configs'.setup { - -- A list of parser names, or "all" - ensure_installed = {"bash", "c", "c_sharp", "cmake", "cpp", "css", "dockerfile", "go", "html", "http", "java", "javascript", "json", "json5", "jsonc", "lua", "make", "perl", "php", "pug", "python", "regex", "ruby", "toml", "tsx", "typescript", "rust", "vim", "vue", "wgsl", "yaml",}, +require("nvim-treesitter.configs").setup({ + -- A list of parser names, or "all" + ensure_installed = { + "bash", + "c", + "c_sharp", + "cmake", + "cpp", + "css", + "dockerfile", + "go", + "html", + "http", + "java", + "javascript", + "json", + "json5", + "jsonc", + "lua", + "make", + "perl", + "php", + "pug", + "python", + "ruby", + "toml", + "tsx", + "typescript", + "rust", + "vim", + "vue", + "wgsl", + "yaml", + }, - -- Install parsers synchronously (only applied to `ensure_installed`) - sync_install = false, + -- Install parsers synchronously (only applied to `ensure_installed`) + sync_install = false, - -- Automatically install missing parsers when entering buffer - -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally - auto_install = true, + -- Automatically install missing parsers when entering buffer + -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally + auto_install = true, - highlight = { - -- `false` will disable the whole extension - enable = true, + highlight = { + -- `false` will disable the whole extension + enable = true, - -- Setting this to true will run `:h syntax` and tree-sitter at the same time. - -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). - -- Using this option may slow down your editor, and you may see some duplicate highlights. - -- Instead of true it can also be a list of languages - additional_vim_regex_highlighting = false, - }, -} + -- Setting this to true will run `:h syntax` and tree-sitter at the same time. + -- Set this to `true` if you depend on 'syntax' being enabled (like for indentation). + -- Using this option may slow down your editor, and you may see some duplicate highlights. + -- Instead of true it can also be a list of languages + additional_vim_regex_highlighting = false, + }, +}) diff --git a/.config/nvim/after/plugin/undotree.lua b/.config/nvim/after/plugin/undotree.lua new file mode 100644 index 00000000..b6b9276a --- /dev/null +++ b/.config/nvim/after/plugin/undotree.lua @@ -0,0 +1 @@ +vim.keymap.set("n", "u", vim.cmd.UndotreeToggle) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index f2d81ab2..de4ac39c 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1 +1 @@ -require('neovim') +require("neovim") diff --git a/.config/nvim/lua/neovim/packer.lua b/.config/nvim/lua/neovim/packer.lua index 91225a8d..7e8b820f 100644 --- a/.config/nvim/lua/neovim/packer.lua +++ b/.config/nvim/lua/neovim/packer.lua @@ -1,64 +1,75 @@ -- This file can be loaded by calling `lua require('plugins')` from your init.vim -- Only required if you have packer configured as `opt` -vim.cmd [[packadd packer.nvim]] +vim.cmd([[packadd packer.nvim]]) -return require('packer').startup(function(use) --- Packer can manage itself -use 'wbthomason/packer.nvim' -use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'} -use {'nvim-treesitter/playground'} -use ({ - 'shaunsingh/nord.nvim', - config = function() - vim.cmd('colorscheme nord') - end -}) -use {'preservim/nerdcommenter'} -use {'nvim-lualine/lualine.nvim', requires = { 'kyazdani42/nvim-web-devicons', opt = true }} -use {'kyazdani42/nvim-web-devicons'} -use {'kyazdani42/nvim-tree.lua'} -use {'psliwka/vim-smoothie'} -use {'mg979/vim-visual-multi'} -use {'Yggdroot/indentLine'} -use {'airblade/vim-gitgutter'} -use {'f-person/git-blame.nvim'} -use {'mattn/emmet-vim'} -use {'norcalli/nvim-colorizer.lua'} -use {'luochen1990/rainbow'} -use {'windwp/nvim-autopairs'} -use {'simeji/winresizer'} -use {'sbdchd/neoformat'} -use {'rhysd/vim-clang-format'} -use {'sangdol/mintabline.vim'} -use {'ethanholz/nvim-lastplace'} -use({ - "iamcco/markdown-preview.nvim", - run = function() vim.fn["mkdp#util#install"]() end, -}) --- use({ "iamcco/markdown-preview.nvim", run = "cd app && npm install", setup = function() vim.g.mkdp_filetypes = { "markdown" } end, ft = { "markdown" }, }) -use {'junegunn/fzf.vim'} -use 'rinx/nvim-ripgrep' +return require("packer").startup(function(use) + -- Packer can manage itself + use("wbthomason/packer.nvim") + use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) + use({ "nvim-treesitter/playground" }) + use({ + "shaunsingh/nord.nvim", + config = function() + vim.cmd("colorscheme nord") + end, + }) + use({ "preservim/nerdcommenter" }) + use({ "nvim-lualine/lualine.nvim", requires = { "kyazdani42/nvim-web-devicons", opt = true } }) + use({ "kyazdani42/nvim-web-devicons" }) + use({ "kyazdani42/nvim-tree.lua" }) + use({ "psliwka/vim-smoothie" }) + use({ "mg979/vim-visual-multi" }) + use({ "Yggdroot/indentLine" }) + use({ "airblade/vim-gitgutter" }) + use({ "f-person/git-blame.nvim" }) + use({ "mattn/emmet-vim" }) + use({ "norcalli/nvim-colorizer.lua" }) + use({ "luochen1990/rainbow" }) + use({ "windwp/nvim-autopairs" }) + use({ "simeji/winresizer" }) + use({ "sbdchd/neoformat" }) + use({ "rhysd/vim-clang-format" }) + use({ "sangdol/mintabline.vim" }) + use({ "ThePrimeagen/harpoon" }) + use({ + "nvim-telescope/telescope.nvim", + tag = "0.1.0", + -- or , branch = '0.1.x', + requires = { { "nvim-lua/plenary.nvim" } }, + }) + use({ "mbbill/undotree" }) + use({ "tpope/vim-fugitive" }) + use({ "ethanholz/nvim-lastplace" }) + use({ + "iamcco/markdown-preview.nvim", + run = function() + vim.fn["mkdp#util#install"]() + end, + }) + -- use({ "iamcco/markdown-preview.nvim", run = "cd app && npm install", setup = function() vim.g.mkdp_filetypes = { "markdown" } end, ft = { "markdown" }, }) + use({ "junegunn/fzf.vim" }) + use("rinx/nvim-ripgrep") - use { - 'VonHeikemen/lsp-zero.nvim', - requires = { - -- LSP Support - {'neovim/nvim-lspconfig'}, - {'williamboman/mason.nvim'}, - {'williamboman/mason-lspconfig.nvim'}, + use({ + "VonHeikemen/lsp-zero.nvim", + requires = { + -- LSP Support + { "neovim/nvim-lspconfig" }, + { "williamboman/mason.nvim" }, + { "williamboman/mason-lspconfig.nvim" }, - -- Autocompletion - {'hrsh7th/nvim-cmp'}, - {'hrsh7th/cmp-buffer'}, - {'hrsh7th/cmp-path'}, - {'saadparwaiz1/cmp_luasnip'}, - {'hrsh7th/cmp-nvim-lsp'}, - {'hrsh7th/cmp-nvim-lua'}, + -- Autocompletion + { "hrsh7th/nvim-cmp" }, + { "hrsh7th/cmp-buffer" }, + { "hrsh7th/cmp-path" }, + { "saadparwaiz1/cmp_luasnip" }, + { "hrsh7th/cmp-nvim-lsp" }, + { "hrsh7th/cmp-nvim-lua" }, - -- Snippets - {'L3MON4D3/LuaSnip'}, - {'rafamadriz/friendly-snippets'}, - } -} + -- Snippets + { "L3MON4D3/LuaSnip" }, + { "rafamadriz/friendly-snippets" }, + }, + }) end) diff --git a/.config/nvim/lua/neovim/remap.lua b/.config/nvim/lua/neovim/remap.lua index ea4de675..e4b57a97 100755 --- a/.config/nvim/lua/neovim/remap.lua +++ b/.config/nvim/lua/neovim/remap.lua @@ -4,10 +4,10 @@ vim.keymap.set("n", "pv", vim.cmd.Ex) vim.keymap.set("n", "J", "mzJ`z") -- remap for vim-smoothie -vim.cmd [[nnoremap call smoothie#do("\zz")]] -vim.cmd [[nnoremap call smoothie#do("\zz")]] -vim.cmd [[nnoremap gg call smoothie#do("gg")]] -vim.cmd [[nnoremap call smoothie#do("\zz")]] +vim.cmd([[nnoremap call smoothie#do("\zz")]]) +vim.cmd([[nnoremap call smoothie#do("\zz")]]) +vim.cmd([[nnoremap gg call smoothie#do("gg")]]) +vim.cmd([[nnoremap call smoothie#do("\zz")]]) -- recenter on next/previous search vim.keymap.set("n", "n", "nzzzv") @@ -31,64 +31,64 @@ vim.keymap.set("n", "", ":set spell!", { silent = true }) vim.keymap.set("n", "x", "!chmod +x %", { silent = true }) -- Vimium Like Keybindings -vim.keymap.set('n', 't', ':tabnew', {}) +vim.keymap.set("n", "t", ":tabnew", {}) -vim.keymap.set('n', '', ':tabprevious', {}) -vim.keymap.set('n', '', ':tabprevious', {}) -vim.keymap.set('n', '', ':tabprevious', {}) +vim.keymap.set("n", "", ":tabprevious", {}) +vim.keymap.set("n", "", ":tabprevious", {}) +vim.keymap.set("n", "", ":tabprevious", {}) -vim.keymap.set('n', '', ':tabnext', {}) -vim.keymap.set('n', '', ':tabnext', {}) -vim.keymap.set('n', '', ':tabnext', {}) +vim.keymap.set("n", "", ":tabnext", {}) +vim.keymap.set("n", "", ":tabnext", {}) +vim.keymap.set("n", "", ":tabnext", {}) -- Use ctrl- [hl] to select the active split! -vim.keymap.set('n', '', ':wincmd h', {}) -vim.keymap.set('n', '', ':wincmd l', {}) +vim.keymap.set("n", "", ":wincmd h", {}) +vim.keymap.set("n", "", ":wincmd l", {}) -- remap Nvim_Tree toggle to CTRL+B -vim.keymap.set('n', '', ':NvimTreeToggle', {}) +vim.keymap.set("n", "", ":NvimTreeToggle", {}) -- Use ctrl - [hl] to select the active split -vim.keymap.set('n', '', ':wincmd h', {}) -vim.keymap.set('n', '', ':wincmd l', {}) +vim.keymap.set("n", "", ":wincmd h", {}) +vim.keymap.set("n", "", ":wincmd l", {}) -- nv creates new vertical split -vim.keymap.set('n', 'nv', ':vnew', { silent = true }) +vim.keymap.set("n", "nv", ":vnew", { silent = true }) -- shift + p invokes PackerSync -vim.keymap.set('n', '', ':PackerSync', {}) +vim.keymap.set("n", "", ":PackerSync", {}) --- control + p enable transparency -vim.keymap.set('n', '', ':lua ColorMyPencils()', {}) +-- control + t enable transparency +vim.keymap.set("n", "", ":lua ColorMyPencils()", {}) -- open :Mason using msn -vim.keymap.set('n', 'msn', ':Mason', { silent = true }) +vim.keymap.set("n", "msn", ":Mason", { silent = true }) -- toggle relative line number with shift + x -vim.keymap.set('n', '', ':set relativenumber! number', {}) +vim.keymap.set("n", "", ":set relativenumber! number", {}) -- toggle multi-corsor with control + j/k -vim.cmd[[nmap ]] -vim.cmd[[nmap ]] +vim.cmd([[nmap ]]) +vim.cmd([[nmap ]]) -- enable gitblame with ctrl + g -vim.keymap.set('n', '', ':GitBlameToggle', { silent = true }) +vim.keymap.set("n", "", ":GitBlameToggle", { silent = true }) -- shift + m brings up markdown previewer -vim.keymap.set('n', '', ':MarkdownPreview', {}) +vim.keymap.set("n", "", ":MarkdownPreview", {}) -- invoke neoformat with nf -vim.keymap.set('n', 'nf', ':Neoformat', { silent = true }) +vim.keymap.set("n", "nf", ":Neoformat", { silent = true }) -- format C and C++ Code with cp -vim.keymap.set('n', 'cp', ':ClangFormat', { silent = true }) +vim.keymap.set("n", "cp", ":ClangFormat", { silent = true }) -- open fzf with ctrl + p -vim.cmd[[nnoremap fzf :silent :FZFExplore]] -vim.keymap.set('n', '', ':FZFExplore', {}) +vim.cmd([[nnoremap fzf :silent :FZFExplore]]) +vim.keymap.set("n", "", ":FZFExplore", {}) -- open ripgrep -vim.cmd[[nnoremap rg :silent :Rg]] +vim.cmd([[nnoremap rg :silent :Rg]]) --toggle autocompletion -vim.cmd[[nnoremap cmp :silent lua SetAutoCmp(Mode)]] +vim.cmd([[nnoremap cmp :silent lua SetAutoCmp(Mode)]]) diff --git a/.config/nvim/lua/neovim/set.lua b/.config/nvim/lua/neovim/set.lua index 50cdd7c7..71b942da 100644 --- a/.config/nvim/lua/neovim/set.lua +++ b/.config/nvim/lua/neovim/set.lua @@ -1,4 +1,5 @@ --- vim.opt.guicursor = "" +-- fat cursor no matter what +vim.opt.guicursor = "" -- vim.opt.nu = true vim.opt.relativenumber = true @@ -21,11 +22,11 @@ vim.opt.termguicolors = true vim.opt.scrolloff = 8 vim.opt.signcolumn = "yes" -vim.opt.isfname:append("@-@") +--vim.opt.isfname:append("@-@") vim.opt.updatetime = 50 -vim.opt.mouse = 'a' +vim.opt.mouse = "a" vim.opt.autoindent = true vim.opt.smarttab = true vim.opt.ignorecase = true @@ -39,37 +40,37 @@ vim.opt.splitbelow = true vim.opt.splitright = true -- Removes trailing spaces -vim.cmd[[function TrimWhiteSpace() +vim.cmd([[function TrimWhiteSpace() %s/\s*$// '' -endfunction]] +endfunction]]) --Removes trailing spaces on save -vim.cmd[[autocmd FileWritePre * call TrimWhiteSpace()]] -vim.cmd[[autocmd FileAppendPre * call TrimWhiteSpace()]] -vim.cmd[[autocmd FilterWritePre * call TrimWhiteSpace()]] -vim.cmd[[autocmd BufWritePre * call TrimWhiteSpace()]] +vim.cmd([[autocmd FileWritePre * call TrimWhiteSpace()]]) +vim.cmd([[autocmd FileAppendPre * call TrimWhiteSpace()]]) +vim.cmd([[autocmd FilterWritePre * call TrimWhiteSpace()]]) +vim.cmd([[autocmd BufWritePre * call TrimWhiteSpace()]]) -- Marks end of line, space, and trailing space characters -vim.opt.listchars:append({ eol = '↵', trail = '·', space = '·' }) +vim.opt.listchars:append({ eol = "↵", trail = "·", space = "·" }) vim.opt.list = true -- git-blame disabled by default vim.g.gitblame_enabled = 0 -- vertically center document when entering Insert mode -vim.cmd[[autocmd InsertEnter * norm zz]] +vim.cmd([[autocmd InsertEnter * norm zz]]) -- enable clipboard -vim.cmd[[set clipboard+=unnamedplus]] +vim.cmd([[set clipboard+=unnamedplus]]) -- enable hard/soft wrap -vim.cmd[[set wrap linebreak textwidth=80]] +vim.cmd([[set wrap linebreak textwidth=80]]) -- max tab characters -vim.cmd[[let g:mintabline_tab_max_chars = 10 ]] +vim.cmd([[let g:mintabline_tab_max_chars = 10 ]]) -- Search pattern across repository files using fzf -vim.cmd[[ +vim.cmd([[ function! FzfExplore(...) let inpath = substitute(a:1, "'", '', 'g') if inpath == "" || matchend(inpath, '/') == strlen(inpath) @@ -80,11 +81,9 @@ else let file = getcwd() . '/' . inpath execute "e" file endif -endfunction]] +endfunction]]) -vim.cmd[[command! -nargs=* FZFExplore call FzfExplore(shellescape())]] +vim.cmd([[command! -nargs=* FZFExplore call FzfExplore(shellescape())]]) -- fzf is on bottom of screen -vim.cmd[[let g:fzf_layout = { 'down': '~30%' }]] - - +vim.cmd([[let g:fzf_layout = { 'down': '~30%' }]]) diff --git a/.config/nvim/plugin/packer_compiled.lua b/.config/nvim/plugin/packer_compiled.lua index f576c093..66478c14 100644 --- a/.config/nvim/plugin/packer_compiled.lua +++ b/.config/nvim/plugin/packer_compiled.lua @@ -124,6 +124,11 @@ _G.packer_plugins = { path = "/home/brian/.local/share/nvim/site/pack/packer/start/git-blame.nvim", url = "https://github.com/f-person/git-blame.nvim" }, + harpoon = { + loaded = true, + path = "/home/brian/.local/share/nvim/site/pack/packer/start/harpoon", + url = "https://github.com/ThePrimeagen/harpoon" + }, indentLine = { loaded = true, path = "/home/brian/.local/share/nvim/site/pack/packer/start/indentLine", @@ -190,6 +195,11 @@ _G.packer_plugins = { path = "/home/brian/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua", url = "https://github.com/norcalli/nvim-colorizer.lua" }, + ["nvim-lastplace"] = { + loaded = true, + path = "/home/brian/.local/share/nvim/site/pack/packer/start/nvim-lastplace", + url = "https://github.com/ethanholz/nvim-lastplace" + }, ["nvim-lspconfig"] = { loaded = true, path = "/home/brian/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", @@ -225,16 +235,36 @@ _G.packer_plugins = { path = "/home/brian/.local/share/nvim/site/pack/packer/start/playground", url = "https://github.com/nvim-treesitter/playground" }, + ["plenary.nvim"] = { + loaded = true, + path = "/home/brian/.local/share/nvim/site/pack/packer/start/plenary.nvim", + url = "https://github.com/nvim-lua/plenary.nvim" + }, rainbow = { loaded = true, path = "/home/brian/.local/share/nvim/site/pack/packer/start/rainbow", url = "https://github.com/luochen1990/rainbow" }, + ["telescope.nvim"] = { + loaded = true, + path = "/home/brian/.local/share/nvim/site/pack/packer/start/telescope.nvim", + url = "https://github.com/nvim-telescope/telescope.nvim" + }, + undotree = { + loaded = true, + path = "/home/brian/.local/share/nvim/site/pack/packer/start/undotree", + url = "https://github.com/mbbill/undotree" + }, ["vim-clang-format"] = { loaded = true, path = "/home/brian/.local/share/nvim/site/pack/packer/start/vim-clang-format", url = "https://github.com/rhysd/vim-clang-format" }, + ["vim-fugitive"] = { + loaded = true, + path = "/home/brian/.local/share/nvim/site/pack/packer/start/vim-fugitive", + url = "https://github.com/tpope/vim-fugitive" + }, ["vim-gitgutter"] = { loaded = true, path = "/home/brian/.local/share/nvim/site/pack/packer/start/vim-gitgutter", diff --git a/nvim_custom_keys.txt b/nvim_custom_keys.txt index cdd7da9e..daee4758 100644 --- a/nvim_custom_keys.txt +++ b/nvim_custom_keys.txt @@ -160,6 +160,7 @@ COMMAND MODE :wa - writes all files :wqa - writes all files and quits :e ./name_of_file_to_open - not as good as fzf, but is a decent native file finder in nvim +:100 - go to line 100 (any number) INSERT MODE tab - configured for four spaces in my case @@ -240,6 +241,23 @@ Custom shortcut: nv (opens up new vertical pane) # deprecated when OKLB acquired... ii - equivaent to key (return to normal mode from insert mode) +-- THE PRIMEAGEN AND HARPOON PLUGIN +note: my configuration is based off of the primeagens, with a lot more added +on, and a tiny bit taken out. The following is how I've set up his harpoon +plugin: + +notes on harpoon: harpoon essentially replaces tabs (up to four, although more +can be implemented). It has an interactive menu through telescope/plenary. Note +that harpoon is powerful, it will save a buffer of its own and remember the four +tabs you want for every project (no more re-opening tabs upon returning to your +project): + +a - Saves the page you are currently on and line you're on. +h - Go to your 1st saved page. +j - Go to your 2nd saved page. +k - Go to your 3rd saved page. +l - Go to your 4th saved page. + -- ESPANSO BASED commands NOTE: Espanso can be used in conjunction for some powerful aliases in neovim (as well as other applications) FURTHER NOTATION: Please note that espanso is capabale of a lot more than is featured here and I highly recommend coming up with further expamples as it has the potential to greatly increase workflow speed diff --git a/scripts/sdir b/scripts/sdir index 0b8c005b..e89a2edf 100755 --- a/scripts/sdir +++ b/scripts/sdir @@ -11,16 +11,16 @@ set +o noclobber # define and create .sdrc file sdrc="$HOME/".sdrc -if [[ ! -f "$sdrc" ]] ; then +if [[ ! -f "$sdrc" ]]; then /usr/bin/touch "$sdrc" fi -if [[ $# -gt 0 ]] ; then +if [[ $# -gt 0 ]]; then sdoc="$1" else sdoc="" fi -echo 'export sdir='"$sdir" > "$sdrc" -echo 'export sdoc='"$sdoc" >> "$sdrc" +echo 'export sdir='"$sdir" >"$sdrc" +echo 'export sdoc='"$sdoc" >>"$sdrc" diff --git a/the_primeagen_nvim_setup/after/plugin/harpoon.lua b/the_primeagen_nvim_setup/after/plugin/harpoon.lua index 70002eb0..37f4631e 100644 --- a/the_primeagen_nvim_setup/after/plugin/harpoon.lua +++ b/the_primeagen_nvim_setup/after/plugin/harpoon.lua @@ -2,7 +2,7 @@ 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", "", ui.toggle_quick_menu) vim.keymap.set("n", "", function() ui.nav_file(1) end) vim.keymap.set("n", "", function() ui.nav_file(2) end) diff --git a/the_primeagen_nvim_setup/lua/theprimeagen/packer.lua b/the_primeagen_nvim_setup/lua/theprimeagen/packer.lua index cc0715a8..0ae5ef76 100644 --- a/the_primeagen_nvim_setup/lua/theprimeagen/packer.lua +++ b/the_primeagen_nvim_setup/lua/theprimeagen/packer.lua @@ -1,46 +1,47 @@ -- This file can be loaded by calling `lua require('plugins')` from your init.vim -- Only required if you have packer configured as `opt` -vim.cmd [[packadd packer.nvim]] +vim.cmd([[packadd packer.nvim]]) -return require('packer').startup(function(use) - -- Packer can manage itself - use 'wbthomason/packer.nvim' - use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'} - use {'nvim-treesitter/playground'} - use { - 'nvim-telescope/telescope.nvim', tag = '0.1.0', - -- or , branch = '0.1.x', - requires = { {'nvim-lua/plenary.nvim'} } - } - use ({ - 'shaunsingh/nord.nvim', - config = function() - vim.cmd('colorscheme nord') - end - }) - use {'ThePrimeagen/harpoon'} - use {'mbbill/undotree'} - use {'tpope/vim-fugitive'} - use { - 'VonHeikemen/lsp-zero.nvim', - requires = { - -- LSP Support - {'neovim/nvim-lspconfig'}, - {'williamboman/mason.nvim'}, - {'williamboman/mason-lspconfig.nvim'}, +return require("packer").startup(function(use) + -- Packer can manage itself + use("wbthomason/packer.nvim") + use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) + use({ "nvim-treesitter/playground" }) + use({ + "nvim-telescope/telescope.nvim", + tag = "0.1.0", + -- or , branch = '0.1.x', + requires = { { "nvim-lua/plenary.nvim" } }, + }) + use({ + "shaunsingh/nord.nvim", + config = function() + vim.cmd("colorscheme nord") + end, + }) + use({ "ThePrimeagen/harpoon" }) + use({ "mbbill/undotree" }) + use({ "tpope/vim-fugitive" }) + use({ + "VonHeikemen/lsp-zero.nvim", + requires = { + -- LSP Support + { "neovim/nvim-lspconfig" }, + { "williamboman/mason.nvim" }, + { "williamboman/mason-lspconfig.nvim" }, - -- Autocompletion - {'hrsh7th/nvim-cmp'}, - {'hrsh7th/cmp-buffer'}, - {'hrsh7th/cmp-path'}, - {'saadparwaiz1/cmp_luasnip'}, - {'hrsh7th/cmp-nvim-lsp'}, - {'hrsh7th/cmp-nvim-lua'}, + -- Autocompletion + { "hrsh7th/nvim-cmp" }, + { "hrsh7th/cmp-buffer" }, + { "hrsh7th/cmp-path" }, + { "saadparwaiz1/cmp_luasnip" }, + { "hrsh7th/cmp-nvim-lsp" }, + { "hrsh7th/cmp-nvim-lua" }, - -- Snippets - {'L3MON4D3/LuaSnip'}, - {'rafamadriz/friendly-snippets'}, - } -} + -- Snippets + { "L3MON4D3/LuaSnip" }, + { "rafamadriz/friendly-snippets" }, + }, + }) end) diff --git a/updates.txt b/updates.txt index e1eda66e..68969c88 100644 --- a/updates.txt +++ b/updates.txt @@ -193,6 +193,7 @@ lowdown inotify-tools lynis socat diffstat paru dtach sherlock-git moar -Install moreutils package (pretty awesome) +Install moreutils package (pretty awesome), yapf (python formatter), shfmt +(shell formatter), stylua (lua formatter) -doas pacman -S moreutils +doas pacman -S moreutils yapf shfmt stylua