Added vim-fugitive and harpoon to nvim config

This commit is contained in:
z3rOR0ne 2022-12-18 22:48:30 -08:00
parent 1aa13410f3
commit 25c98539b9
22 changed files with 449 additions and 384 deletions

View file

@ -1 +1 @@
require('nvim-autopairs').setup() require("nvim-autopairs").setup()

View file

@ -1 +1 @@
require'colorizer'.setup() require("colorizer").setup()

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-o>", ui.toggle_quick_menu)
vim.keymap.set("n", "<leader>h", function() ui.nav_file(1) end)
vim.keymap.set("n", "<leader>j", function() ui.nav_file(2) end)
vim.keymap.set("n", "<leader>k", function() ui.nav_file(3) end)
vim.keymap.set("n", "<leader>l", function() ui.nav_file(4) end)

View file

@ -1 +1 @@
require'nvim-lastplace'.setup{} require("nvim-lastplace").setup({})

View file

@ -3,102 +3,64 @@ local lsp = require("lsp-zero")
lsp.preset("recommended") lsp.preset("recommended")
lsp.ensure_installed({ lsp.ensure_installed({
'tsserver', "tsserver",
'eslint', "eslint",
'sumneko_lua', "sumneko_lua",
'rust_analyzer', "rust_analyzer",
}) })
-- Fix Undefined global 'vim' -- Fix Undefined global 'vim'
lsp.configure('sumneko_lua', { lsp.configure("sumneko_lua", {
settings = { settings = {
Lua = { Lua = {
diagnostics = { diagnostics = {
globals = { 'vim' } globals = { "vim" },
} },
} },
} },
}) })
local cmp = require("cmp")
local cmp = require('cmp')
cmp.setup({ cmp.setup({
window = { window = {
completion = cmp.config.window.bordered(), completion = cmp.config.window.bordered(),
documentation = cmp.config.window.bordered(), documentation = cmp.config.window.bordered(),
} },
})
local cmp_select = {behavior = cmp.SelectBehavior.Select}
local cmp_mappings = lsp.defaults.cmp_mappings({
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
['<C-y>'] = cmp.mapping.confirm({ select = true }),
["<C-Space>"] = cmp.mapping.complete(),
})
-- disable completion with tab
-- this helps with copilot setup
cmp_mappings['<Tab>'] = nil
cmp_mappings['<S-Tab>'] = nil
lsp.setup_nvim_cmp({
mapping = cmp_mappings
}) })
lsp.set_preferences({ lsp.set_preferences({
suggest_lsp_servers = false, suggest_lsp_servers = false,
sign_icons = { sign_icons = {
error = 'E', error = "E",
warn = 'W', warn = "W",
hint = 'H', hint = "H",
info = 'I' 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", "<leader>vws", vim.lsp.buf.workspace_symbol, opts)
vim.keymap.set("n", "<leader>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", "<leader>vca", vim.lsp.buf.code_action, opts)
vim.keymap.set("n", "<leader>vrr", vim.lsp.buf.references, opts)
vim.keymap.set("n", "<leader>vrn", vim.lsp.buf.rename, opts)
vim.keymap.set("i", "<C-h>", vim.lsp.buf.signature_help, opts)
end)
-- function that is used with keybinding cm to toggle autocompletion -- 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) function SetAutoCmp(mode)
if mode then if mode then
cmp.setup({ cmp.setup({
completion = { completion = {
autocomplete = { Mode } autocomplete = { Mode },
} },
}) })
Mode = false Mode = false
else else
cmp.setup({ cmp.setup({
completion = { completion = {
autocomplete = Mode autocomplete = Mode,
} },
}) })
Mode = require('cmp.types').cmp.TriggerEvent.TextChanged Mode = require("cmp.types").cmp.TriggerEvent.TextChanged
end end
end end
SetAutoCmp(Mode) SetAutoCmp(Mode)
lsp.setup() lsp.setup()
vim.diagnostic.config({ vim.diagnostic.config({
virtual_text = true, virtual_text = true,
}) })

View file

@ -1,3 +1,3 @@
require('lualine').setup({ require("lualine").setup({
options = { them = 'nord' } options = { them = "nord" },
}) })

View file

@ -1,2 +1,2 @@
vim.g.mkdp_browser = 'librewolf' vim.g.mkdp_browser = "librewolf"
vim.g.mkdp_theme = 'dark' vim.g.mkdp_theme = "dark"

View file

@ -0,0 +1 @@
vim.cmd([[let g:shfmt_opt="-ci"]])

View file

@ -1,117 +1,117 @@
-- Nvim_Tree configuration: -- setup with all defaults -- Nvim_Tree configuration: -- setup with all defaults
-- each of these are documented in `:help nvim-tree.OPTION_NAME` -- each of these are documented in `:help nvim-tree.OPTION_NAME`
require'nvim-tree'.setup { -- BEGIN_DEFAULT_OPTS require("nvim-tree").setup({ -- BEGIN_DEFAULT_OPTS
auto_reload_on_write = true, auto_reload_on_write = true,
disable_netrw = false, disable_netrw = false,
-- hide_root_folder = false, -- hide_root_folder = false,
hijack_cursor = false, hijack_cursor = false,
hijack_netrw = true, hijack_netrw = true,
hijack_unnamed_buffer_when_opening = false, hijack_unnamed_buffer_when_opening = false,
ignore_buffer_on_setup = false, ignore_buffer_on_setup = false,
open_on_setup = false, open_on_setup = false,
open_on_setup_file = false, open_on_setup_file = false,
open_on_tab = false, open_on_tab = false,
sort_by = "name", sort_by = "name",
update_cwd = false, update_cwd = false,
view = { view = {
width = 25, width = 25,
-- height = 30, -- height = 30,
side = "right", side = "right",
preserve_window_proportions = true, preserve_window_proportions = true,
number = false, number = false,
relativenumber = false, relativenumber = false,
signcolumn = "yes", signcolumn = "yes",
mappings = { mappings = {
custom_only = false, custom_only = false,
list = { list = {
-- user mappings go here -- user mappings go here
}, },
}, },
}, },
renderer = { renderer = {
indent_markers = { indent_markers = {
enable = false, enable = false,
icons = { icons = {
corner = "", corner = "",
edge = "", edge = "",
none = " ", none = " ",
}, },
}, },
icons = { icons = {
webdev_colors = true, webdev_colors = true,
}, },
}, },
hijack_directories = { hijack_directories = {
enable = true, enable = true,
auto_open = true, auto_open = true,
}, },
update_focused_file = { update_focused_file = {
enable = false, enable = false,
update_cwd = false, update_cwd = false,
ignore_list = {}, ignore_list = {},
}, },
ignore_ft_on_setup = {}, ignore_ft_on_setup = {},
system_open = { system_open = {
cmd = nil, cmd = nil,
args = {}, args = {},
}, },
diagnostics = { diagnostics = {
enable = false, enable = false,
show_on_dirs = false, show_on_dirs = false,
icons = { icons = {
hint = "", hint = "",
info = "", info = "",
warning = "", warning = "",
error = "", error = "",
}, },
}, },
filters = { filters = {
dotfiles = false, dotfiles = false,
custom = {}, custom = {},
exclude = {}, exclude = {},
}, },
git = { git = {
enable = true, enable = true,
ignore = true, ignore = true,
timeout = 400, timeout = 400,
}, },
actions = { actions = {
use_system_clipboard = true, use_system_clipboard = true,
change_dir = { change_dir = {
enable = true, enable = true,
global = false, global = false,
restrict_above_cwd = false, restrict_above_cwd = false,
}, },
open_file = { open_file = {
quit_on_open = false, quit_on_open = false,
resize_window = false, resize_window = false,
window_picker = { window_picker = {
enable = true, enable = true,
chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890", chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890",
exclude = { exclude = {
filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" }, filetype = { "notify", "packer", "qf", "diff", "fugitive", "fugitiveblame" },
buftype = { "nofile", "terminal", "help" }, buftype = { "nofile", "terminal", "help" },
}, },
}, },
}, },
}, },
trash = { trash = {
cmd = "trash", cmd = "trash",
require_confirm = true, require_confirm = true,
}, },
log = { log = {
enable = false, enable = false,
truncate = false, truncate = false,
types = { types = {
all = false, all = false,
config = false, config = false,
copy_paste = false, copy_paste = false,
diagnostics = false, diagnostics = false,
git = false, git = false,
profile = false, profile = false,
}, },
}, },
} -- END_DEFAULT_OPTS for Nvim_Tree }) -- END_DEFAULT_OPTS for Nvim_Tree
-- Automatically closes Nvim tree if last window open -- Automatically closes Nvim tree if last window open
vim.cmd[[autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif]] vim.cmd([[autocmd BufEnter * ++nested if winnr('$') == 1 && bufname() == 'NvimTree_' . tabpagenr() | quit | endif]])

View file

@ -1,12 +1,12 @@
-- Enable use of ripgrep -- Enable use of ripgrep
require('nvim-ripgrep').setup{ require("nvim-ripgrep").setup({
runner = require('nvim-ripgrep.run').ripgrep, -- grep command runner = require("nvim-ripgrep.run").ripgrep, -- grep command
prompt = " ", -- prompt prompt = " ", -- prompt
window = { window = {
width = 0.8, width = 0.8,
border = "rounded", border = "rounded",
}; },
open_qf_fn = function() open_qf_fn = function()
return vim.api.nvim_command('copen') return vim.api.nvim_command("copen")
end, end,
} })

View file

@ -1,22 +1,53 @@
require'nvim-treesitter.configs'.setup { require("nvim-treesitter.configs").setup({
-- A list of parser names, or "all" -- 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",}, 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`) -- Install parsers synchronously (only applied to `ensure_installed`)
sync_install = false, sync_install = false,
-- Automatically install missing parsers when entering buffer -- Automatically install missing parsers when entering buffer
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally -- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
auto_install = true, auto_install = true,
highlight = { highlight = {
-- `false` will disable the whole extension -- `false` will disable the whole extension
enable = true, enable = true,
-- Setting this to true will run `:h syntax` and tree-sitter at the same time. -- 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). -- 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. -- 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 -- Instead of true it can also be a list of languages
additional_vim_regex_highlighting = false, additional_vim_regex_highlighting = false,
}, },
} })

View file

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

View file

@ -1 +1 @@
require('neovim') require("neovim")

View file

@ -1,64 +1,75 @@
-- This file can be loaded by calling `lua require('plugins')` from your init.vim -- This file can be loaded by calling `lua require('plugins')` from your init.vim
-- Only required if you have packer configured as `opt` -- 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) return require("packer").startup(function(use)
-- Packer can manage itself -- Packer can manage itself
use 'wbthomason/packer.nvim' use("wbthomason/packer.nvim")
use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'} use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" })
use {'nvim-treesitter/playground'} use({ "nvim-treesitter/playground" })
use ({ use({
'shaunsingh/nord.nvim', "shaunsingh/nord.nvim",
config = function() config = function()
vim.cmd('colorscheme nord') vim.cmd("colorscheme nord")
end end,
}) })
use {'preservim/nerdcommenter'} use({ "preservim/nerdcommenter" })
use {'nvim-lualine/lualine.nvim', requires = { 'kyazdani42/nvim-web-devicons', opt = true }} use({ "nvim-lualine/lualine.nvim", requires = { "kyazdani42/nvim-web-devicons", opt = true } })
use {'kyazdani42/nvim-web-devicons'} use({ "kyazdani42/nvim-web-devicons" })
use {'kyazdani42/nvim-tree.lua'} use({ "kyazdani42/nvim-tree.lua" })
use {'psliwka/vim-smoothie'} use({ "psliwka/vim-smoothie" })
use {'mg979/vim-visual-multi'} use({ "mg979/vim-visual-multi" })
use {'Yggdroot/indentLine'} use({ "Yggdroot/indentLine" })
use {'airblade/vim-gitgutter'} use({ "airblade/vim-gitgutter" })
use {'f-person/git-blame.nvim'} use({ "f-person/git-blame.nvim" })
use {'mattn/emmet-vim'} use({ "mattn/emmet-vim" })
use {'norcalli/nvim-colorizer.lua'} use({ "norcalli/nvim-colorizer.lua" })
use {'luochen1990/rainbow'} use({ "luochen1990/rainbow" })
use {'windwp/nvim-autopairs'} use({ "windwp/nvim-autopairs" })
use {'simeji/winresizer'} use({ "simeji/winresizer" })
use {'sbdchd/neoformat'} use({ "sbdchd/neoformat" })
use {'rhysd/vim-clang-format'} use({ "rhysd/vim-clang-format" })
use {'sangdol/mintabline.vim'} use({ "sangdol/mintabline.vim" })
use {'ethanholz/nvim-lastplace'} use({ "ThePrimeagen/harpoon" })
use({ use({
"iamcco/markdown-preview.nvim", "nvim-telescope/telescope.nvim",
run = function() vim.fn["mkdp#util#install"]() end, tag = "0.1.0",
}) -- or , branch = '0.1.x',
-- use({ "iamcco/markdown-preview.nvim", run = "cd app && npm install", setup = function() vim.g.mkdp_filetypes = { "markdown" } end, ft = { "markdown" }, }) requires = { { "nvim-lua/plenary.nvim" } },
use {'junegunn/fzf.vim'} })
use 'rinx/nvim-ripgrep' 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 { use({
'VonHeikemen/lsp-zero.nvim', "VonHeikemen/lsp-zero.nvim",
requires = { requires = {
-- LSP Support -- LSP Support
{'neovim/nvim-lspconfig'}, { "neovim/nvim-lspconfig" },
{'williamboman/mason.nvim'}, { "williamboman/mason.nvim" },
{'williamboman/mason-lspconfig.nvim'}, { "williamboman/mason-lspconfig.nvim" },
-- Autocompletion -- Autocompletion
{'hrsh7th/nvim-cmp'}, { "hrsh7th/nvim-cmp" },
{'hrsh7th/cmp-buffer'}, { "hrsh7th/cmp-buffer" },
{'hrsh7th/cmp-path'}, { "hrsh7th/cmp-path" },
{'saadparwaiz1/cmp_luasnip'}, { "saadparwaiz1/cmp_luasnip" },
{'hrsh7th/cmp-nvim-lsp'}, { "hrsh7th/cmp-nvim-lsp" },
{'hrsh7th/cmp-nvim-lua'}, { "hrsh7th/cmp-nvim-lua" },
-- Snippets -- Snippets
{'L3MON4D3/LuaSnip'}, { "L3MON4D3/LuaSnip" },
{'rafamadriz/friendly-snippets'}, { "rafamadriz/friendly-snippets" },
} },
} })
end) end)

View file

@ -4,10 +4,10 @@ vim.keymap.set("n", "<leader>pv", vim.cmd.Ex)
vim.keymap.set("n", "J", "mzJ`z") vim.keymap.set("n", "J", "mzJ`z")
-- remap for vim-smoothie -- remap for vim-smoothie
vim.cmd [[nnoremap <C-D> <cmd>call smoothie#do("\<C-D>zz")<CR>]] vim.cmd([[nnoremap <C-D> <cmd>call smoothie#do("\<C-D>zz")<CR>]])
vim.cmd [[nnoremap <C-U> <cmd>call smoothie#do("\<C-U>zz")<CR>]] vim.cmd([[nnoremap <C-U> <cmd>call smoothie#do("\<C-U>zz")<CR>]])
vim.cmd [[nnoremap gg <cmd>call smoothie#do("gg")<CR>]] vim.cmd([[nnoremap gg <cmd>call smoothie#do("gg")<CR>]])
vim.cmd [[nnoremap <S-g> <cmd>call smoothie#do("\<S-g>zz")<CR>]] vim.cmd([[nnoremap <S-g> <cmd>call smoothie#do("\<S-g>zz")<CR>]])
-- recenter on next/previous search -- recenter on next/previous search
vim.keymap.set("n", "n", "nzzzv") vim.keymap.set("n", "n", "nzzzv")
@ -31,64 +31,64 @@ vim.keymap.set("n", "<F11>", ":set spell!<cr>", { silent = true })
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true }) vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { silent = true })
-- Vimium Like Keybindings -- Vimium Like Keybindings
vim.keymap.set('n', 't', '<c-w>:tabnew<CR>', {}) vim.keymap.set("n", "t", "<c-w>:tabnew<CR>", {})
vim.keymap.set('n', '<S-tab>', '<c-w>:tabprevious<CR>', {}) vim.keymap.set("n", "<S-tab>", "<c-w>:tabprevious<CR>", {})
vim.keymap.set('n', '<S-j>', '<c-w>:tabprevious<CR>', {}) vim.keymap.set("n", "<S-j>", "<c-w>:tabprevious<CR>", {})
vim.keymap.set('n', '<A-left>', '<c-w>:tabprevious<CR>', {}) vim.keymap.set("n", "<A-left>", "<c-w>:tabprevious<CR>", {})
vim.keymap.set('n', '<A-tab>', '<c-w>:tabnext<CR>', {}) vim.keymap.set("n", "<A-tab>", "<c-w>:tabnext<CR>", {})
vim.keymap.set('n', '<A-k>', '<c-w>:tabnext<CR>', {}) vim.keymap.set("n", "<A-k>", "<c-w>:tabnext<CR>", {})
vim.keymap.set('n', '<A-right>', '<c-w>:tabnext<CR>', {}) vim.keymap.set("n", "<A-right>", "<c-w>:tabnext<CR>", {})
-- Use ctrl- [hl] to select the active split! -- Use ctrl- [hl] to select the active split!
vim.keymap.set('n', '<C-h>', '<c-w>:wincmd h<CR>', {}) vim.keymap.set("n", "<C-h>", "<c-w>:wincmd h<CR>", {})
vim.keymap.set('n', '<C-l>', '<c-w>:wincmd l<CR>', {}) vim.keymap.set("n", "<C-l>", "<c-w>:wincmd l<CR>", {})
-- remap Nvim_Tree toggle to CTRL+B -- remap Nvim_Tree toggle to CTRL+B
vim.keymap.set('n', '<C-b>', '<c-w>:NvimTreeToggle<CR>', {}) vim.keymap.set("n", "<C-b>", "<c-w>:NvimTreeToggle<CR>", {})
-- Use ctrl - [hl] to select the active split -- Use ctrl - [hl] to select the active split
vim.keymap.set('n', '<C-h>', '<c-w>:wincmd h<CR>', {}) vim.keymap.set("n", "<C-h>", "<c-w>:wincmd h<CR>", {})
vim.keymap.set('n', '<C-l>', '<c-w>:wincmd l<CR>', {}) vim.keymap.set("n", "<C-l>", "<c-w>:wincmd l<CR>", {})
-- nv creates new vertical split -- 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 -- shift + p invokes PackerSync
vim.keymap.set('n', '<S-p>', '<c-w>:PackerSync<CR>', {}) vim.keymap.set("n", "<S-p>", "<c-w>:PackerSync<CR>", {})
-- control + p enable transparency -- control + t enable transparency
vim.keymap.set('n', '<C-t>', '<c-w>:lua ColorMyPencils()<CR>', {}) vim.keymap.set("n", "<C-t>", "<c-w>:lua ColorMyPencils()<CR>", {})
-- open :Mason using msn -- 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 -- toggle relative line number with shift + x
vim.keymap.set('n', '<S-x>', ':set relativenumber! number<cr>', {}) vim.keymap.set("n", "<S-x>", ":set relativenumber! number<cr>", {})
-- toggle multi-corsor with control + j/k -- toggle multi-corsor with control + j/k
vim.cmd[[nmap <C-j> <C-Down>]] vim.cmd([[nmap <C-j> <C-Down>]])
vim.cmd[[nmap <C-k> <C-Up>]] vim.cmd([[nmap <C-k> <C-Up>]])
-- enable gitblame with ctrl + g -- enable gitblame with ctrl + g
vim.keymap.set('n', '<C-g>', '<c-w>:GitBlameToggle<CR>', { silent = true }) vim.keymap.set("n", "<C-g>", "<c-w>:GitBlameToggle<CR>", { silent = true })
-- shift + m brings up markdown previewer -- shift + m brings up markdown previewer
vim.keymap.set('n', '<S-m>', '<c-w>:MarkdownPreview<CR>', {}) vim.keymap.set("n", "<S-m>", "<c-w>:MarkdownPreview<CR>", {})
-- invoke neoformat with nf -- invoke neoformat with nf
vim.keymap.set('n', 'nf', ':Neoformat<cr>', { silent = true }) vim.keymap.set("n", "nf", ":Neoformat<cr>", { silent = true })
-- format C and C++ Code with cp -- format C and C++ Code with cp
vim.keymap.set('n', 'cp', ':ClangFormat<cr>', { silent = true }) vim.keymap.set("n", "cp", ":ClangFormat<cr>", { silent = true })
-- open fzf with ctrl + p -- open fzf with ctrl + p
vim.cmd[[nnoremap fzf :silent :FZFExplore]] vim.cmd([[nnoremap fzf :silent :FZFExplore]])
vim.keymap.set('n', '<C-p>', '<c-w>:FZFExplore<CR>', {}) vim.keymap.set("n", "<C-p>", "<c-w>:FZFExplore<CR>", {})
-- open ripgrep -- open ripgrep
vim.cmd[[nnoremap rg :silent :Rg]] vim.cmd([[nnoremap rg :silent :Rg]])
--toggle autocompletion --toggle autocompletion
vim.cmd[[nnoremap cmp :silent lua SetAutoCmp(Mode)]] vim.cmd([[nnoremap cmp :silent lua SetAutoCmp(Mode)]])

View file

@ -1,4 +1,5 @@
-- vim.opt.guicursor = "" -- fat cursor no matter what
vim.opt.guicursor = ""
-- --
vim.opt.nu = true vim.opt.nu = true
vim.opt.relativenumber = true vim.opt.relativenumber = true
@ -21,11 +22,11 @@ vim.opt.termguicolors = true
vim.opt.scrolloff = 8 vim.opt.scrolloff = 8
vim.opt.signcolumn = "yes" vim.opt.signcolumn = "yes"
vim.opt.isfname:append("@-@") --vim.opt.isfname:append("@-@")
vim.opt.updatetime = 50 vim.opt.updatetime = 50
vim.opt.mouse = 'a' vim.opt.mouse = "a"
vim.opt.autoindent = true vim.opt.autoindent = true
vim.opt.smarttab = true vim.opt.smarttab = true
vim.opt.ignorecase = true vim.opt.ignorecase = true
@ -39,37 +40,37 @@ vim.opt.splitbelow = true
vim.opt.splitright = true vim.opt.splitright = true
-- Removes trailing spaces -- Removes trailing spaces
vim.cmd[[function TrimWhiteSpace() vim.cmd([[function TrimWhiteSpace()
%s/\s*$// %s/\s*$//
'' ''
endfunction]] endfunction]])
--Removes trailing spaces on save --Removes trailing spaces on save
vim.cmd[[autocmd FileWritePre * call TrimWhiteSpace()]] vim.cmd([[autocmd FileWritePre * call TrimWhiteSpace()]])
vim.cmd[[autocmd FileAppendPre * call TrimWhiteSpace()]] vim.cmd([[autocmd FileAppendPre * call TrimWhiteSpace()]])
vim.cmd[[autocmd FilterWritePre * call TrimWhiteSpace()]] vim.cmd([[autocmd FilterWritePre * call TrimWhiteSpace()]])
vim.cmd[[autocmd BufWritePre * call TrimWhiteSpace()]] vim.cmd([[autocmd BufWritePre * call TrimWhiteSpace()]])
-- Marks end of line, space, and trailing space characters -- 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 vim.opt.list = true
-- git-blame disabled by default -- git-blame disabled by default
vim.g.gitblame_enabled = 0 vim.g.gitblame_enabled = 0
-- vertically center document when entering Insert mode -- vertically center document when entering Insert mode
vim.cmd[[autocmd InsertEnter * norm zz]] vim.cmd([[autocmd InsertEnter * norm zz]])
-- enable clipboard -- enable clipboard
vim.cmd[[set clipboard+=unnamedplus]] vim.cmd([[set clipboard+=unnamedplus]])
-- enable hard/soft wrap -- enable hard/soft wrap
vim.cmd[[set wrap linebreak textwidth=80]] vim.cmd([[set wrap linebreak textwidth=80]])
-- max tab characters -- 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 -- Search pattern across repository files using fzf
vim.cmd[[ vim.cmd([[
function! FzfExplore(...) function! FzfExplore(...)
let inpath = substitute(a:1, "'", '', 'g') let inpath = substitute(a:1, "'", '', 'g')
if inpath == "" || matchend(inpath, '/') == strlen(inpath) if inpath == "" || matchend(inpath, '/') == strlen(inpath)
@ -80,11 +81,9 @@ else
let file = getcwd() . '/' . inpath let file = getcwd() . '/' . inpath
execute "e" file execute "e" file
endif endif
endfunction]] endfunction]])
vim.cmd[[command! -nargs=* FZFExplore call FzfExplore(shellescape(<q-args>))]] vim.cmd([[command! -nargs=* FZFExplore call FzfExplore(shellescape(<q-args>))]])
-- fzf is on bottom of screen -- fzf is on bottom of screen
vim.cmd[[let g:fzf_layout = { 'down': '~30%' }]] vim.cmd([[let g:fzf_layout = { 'down': '~30%' }]])

View file

@ -124,6 +124,11 @@ _G.packer_plugins = {
path = "/home/brian/.local/share/nvim/site/pack/packer/start/git-blame.nvim", path = "/home/brian/.local/share/nvim/site/pack/packer/start/git-blame.nvim",
url = "https://github.com/f-person/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 = { indentLine = {
loaded = true, loaded = true,
path = "/home/brian/.local/share/nvim/site/pack/packer/start/indentLine", 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", path = "/home/brian/.local/share/nvim/site/pack/packer/start/nvim-colorizer.lua",
url = "https://github.com/norcalli/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"] = { ["nvim-lspconfig"] = {
loaded = true, loaded = true,
path = "/home/brian/.local/share/nvim/site/pack/packer/start/nvim-lspconfig", 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", path = "/home/brian/.local/share/nvim/site/pack/packer/start/playground",
url = "https://github.com/nvim-treesitter/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 = { rainbow = {
loaded = true, loaded = true,
path = "/home/brian/.local/share/nvim/site/pack/packer/start/rainbow", path = "/home/brian/.local/share/nvim/site/pack/packer/start/rainbow",
url = "https://github.com/luochen1990/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"] = { ["vim-clang-format"] = {
loaded = true, loaded = true,
path = "/home/brian/.local/share/nvim/site/pack/packer/start/vim-clang-format", path = "/home/brian/.local/share/nvim/site/pack/packer/start/vim-clang-format",
url = "https://github.com/rhysd/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"] = { ["vim-gitgutter"] = {
loaded = true, loaded = true,
path = "/home/brian/.local/share/nvim/site/pack/packer/start/vim-gitgutter", path = "/home/brian/.local/share/nvim/site/pack/packer/start/vim-gitgutter",

View file

@ -160,6 +160,7 @@ COMMAND MODE
:wa - writes all files :wa - writes all files
:wqa - writes all files and quits :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 :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 INSERT MODE
tab - configured for four spaces in my case tab - configured for four spaces in my case
@ -240,6 +241,23 @@ Custom shortcut: nv (opens up new vertical pane)
# deprecated when OKLB acquired... # deprecated when OKLB acquired...
ii - equivaent to <ESC> key (return to normal mode from insert mode) ii - equivaent to <ESC> 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):
<leader>a - Saves the page you are currently on and line you're on.
<leader>h - Go to your 1st saved page.
<leader>j - Go to your 2nd saved page.
<leader>k - Go to your 3rd saved page.
<leader>l - Go to your 4th saved page.
-- ESPANSO BASED commands -- ESPANSO BASED commands
NOTE: Espanso can be used in conjunction for some powerful aliases in neovim (as well as other applications) 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 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

View file

@ -11,16 +11,16 @@ set +o noclobber
# define and create .sdrc file # define and create .sdrc file
sdrc="$HOME/".sdrc sdrc="$HOME/".sdrc
if [[ ! -f "$sdrc" ]] ; then if [[ ! -f "$sdrc" ]]; then
/usr/bin/touch "$sdrc" /usr/bin/touch "$sdrc"
fi fi
if [[ $# -gt 0 ]] ; then if [[ $# -gt 0 ]]; then
sdoc="$1" sdoc="$1"
else else
sdoc="" sdoc=""
fi fi
echo 'export sdir='"$sdir" > "$sdrc" echo 'export sdir='"$sdir" >"$sdrc"
echo 'export sdoc='"$sdoc" >> "$sdrc" echo 'export sdoc='"$sdoc" >>"$sdrc"

View file

@ -2,7 +2,7 @@ local mark = require("harpoon.mark")
local ui = require("harpoon.ui") local ui = require("harpoon.ui")
vim.keymap.set("n", "<leader>a", mark.add_file) vim.keymap.set("n", "<leader>a", mark.add_file)
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu) vim.keymap.set("n", "<C-o>", ui.toggle_quick_menu)
vim.keymap.set("n", "<S-j>", function() ui.nav_file(1) end) vim.keymap.set("n", "<S-j>", function() ui.nav_file(1) end)
vim.keymap.set("n", "<S-k>", function() ui.nav_file(2) end) vim.keymap.set("n", "<S-k>", function() ui.nav_file(2) end)

View file

@ -1,46 +1,47 @@
-- This file can be loaded by calling `lua require('plugins')` from your init.vim -- This file can be loaded by calling `lua require('plugins')` from your init.vim
-- Only required if you have packer configured as `opt` -- 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) return require("packer").startup(function(use)
-- Packer can manage itself -- Packer can manage itself
use 'wbthomason/packer.nvim' use("wbthomason/packer.nvim")
use {'nvim-treesitter/nvim-treesitter', run = ':TSUpdate'} use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" })
use {'nvim-treesitter/playground'} use({ "nvim-treesitter/playground" })
use { use({
'nvim-telescope/telescope.nvim', tag = '0.1.0', "nvim-telescope/telescope.nvim",
-- or , branch = '0.1.x', tag = "0.1.0",
requires = { {'nvim-lua/plenary.nvim'} } -- or , branch = '0.1.x',
} requires = { { "nvim-lua/plenary.nvim" } },
use ({ })
'shaunsingh/nord.nvim', use({
config = function() "shaunsingh/nord.nvim",
vim.cmd('colorscheme nord') config = function()
end vim.cmd("colorscheme nord")
}) end,
use {'ThePrimeagen/harpoon'} })
use {'mbbill/undotree'} use({ "ThePrimeagen/harpoon" })
use {'tpope/vim-fugitive'} use({ "mbbill/undotree" })
use { use({ "tpope/vim-fugitive" })
'VonHeikemen/lsp-zero.nvim', use({
requires = { "VonHeikemen/lsp-zero.nvim",
-- LSP Support requires = {
{'neovim/nvim-lspconfig'}, -- LSP Support
{'williamboman/mason.nvim'}, { "neovim/nvim-lspconfig" },
{'williamboman/mason-lspconfig.nvim'}, { "williamboman/mason.nvim" },
{ "williamboman/mason-lspconfig.nvim" },
-- Autocompletion -- Autocompletion
{'hrsh7th/nvim-cmp'}, { "hrsh7th/nvim-cmp" },
{'hrsh7th/cmp-buffer'}, { "hrsh7th/cmp-buffer" },
{'hrsh7th/cmp-path'}, { "hrsh7th/cmp-path" },
{'saadparwaiz1/cmp_luasnip'}, { "saadparwaiz1/cmp_luasnip" },
{'hrsh7th/cmp-nvim-lsp'}, { "hrsh7th/cmp-nvim-lsp" },
{'hrsh7th/cmp-nvim-lua'}, { "hrsh7th/cmp-nvim-lua" },
-- Snippets -- Snippets
{'L3MON4D3/LuaSnip'}, { "L3MON4D3/LuaSnip" },
{'rafamadriz/friendly-snippets'}, { "rafamadriz/friendly-snippets" },
} },
} })
end) end)

View file

@ -193,6 +193,7 @@ lowdown inotify-tools lynis socat diffstat
paru dtach sherlock-git moar 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