-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
fgoncalves
committed
Apr 2, 2024
1 parent
da820b4
commit 8645c03
Showing
11 changed files
with
425 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,9 @@ | ||
return { | ||
"ThePrimeagen/harpoon", | ||
event = "VeryLazy", | ||
dependencies = { "nvim-lua/plenary.nvim" }, | ||
branch = "harpoon2", | ||
config = function () | ||
local harpoon = require("harpoon") | ||
harpoon:setup({}) | ||
end | ||
} |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
return { | ||
"ThePrimeagen/harpoon", | ||
dependencies = { "nvim-lua/plenary.nvim" }, | ||
branch = "harpoon2", | ||
config = function () | ||
local harpoon = require("harpoon") | ||
harpoon:setup({}) | ||
end | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
-- Plugin sources | ||
return { | ||
|
||
{ import = "min.plugins.core" }, | ||
--{ import = "min.plugins.lsp" }, | ||
{ import = "min.plugins.ui" }, | ||
--{ import = "min.plugins.git" }, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
return { | ||
"folke/which-key.nvim", | ||
event = "VeryLazy", | ||
init = function() | ||
vim.o.timeout = true | ||
vim.o.timeoutlen = 300 | ||
end, | ||
config = function() | ||
-- Initialize which-key | ||
local wk = require("which-key") | ||
local opts = { | ||
plugins = { | ||
marks = true, -- shows a list of your marks on ' and ` | ||
registers = true, -- shows your registers on " in NORMAL or <C-r> in INSERT mode | ||
-- the presets plugin, adds help for a bunch of default keybindings in Neovim | ||
-- No actual key bindings are created | ||
spelling = { | ||
enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions | ||
suggestions = 20, -- how many suggestions should be shown in the list? | ||
}, | ||
presets = { | ||
operators = true, -- adds help for operators like d, y, ... | ||
motions = true, -- adds help for motions | ||
text_objects = true, -- help for text objects triggered after entering an operator | ||
windows = true, -- default bindings on <c-w> | ||
nav = true, -- misc bindings to work with windows | ||
z = true, -- bindings for folds, spelling and others prefixed with z | ||
g = true, -- bindings for prefixed with g | ||
}, | ||
}, | ||
-- add operators that will trigger motion and text object completion | ||
-- to enable all native operators, set the preset / operators plugin above | ||
operators = { gc = "Comments" }, | ||
key_labels = { | ||
-- override the label used to display some keys. It doesn't effect WK in any other way. | ||
-- For example: | ||
-- ["<space>"] = "SPC", | ||
-- ["<cr>"] = "RET", | ||
-- ["<tab>"] = "TAB", | ||
}, | ||
motions = { | ||
count = true, | ||
}, | ||
icons = { | ||
breadcrumb = "»", -- symbol used in the command line area that shows your active key combo | ||
separator = "➜", -- symbol used between a key and it's label | ||
group = "+", -- symbol prepended to a group | ||
}, | ||
popup_mappings = { | ||
scroll_down = "<c-d>", -- binding to scroll down inside the popup | ||
scroll_up = "<c-u>", -- binding to scroll up inside the popup | ||
}, | ||
window = { | ||
border = "none", -- none, single, double, shadow | ||
position = "bottom", -- bottom, top | ||
margin = { 1, 0, 1, 0 }, -- extra window margin [top, right, bottom, left]. When between 0 and 1, will be treated as a percentage of the screen size. | ||
padding = { 1, 2, 1, 2 }, -- extra window padding [top, right, bottom, left] | ||
winblend = 0, -- value between 0-100 0 for fully opaque and 100 for fully transparent | ||
zindex = 1000, -- positive value to position WhichKey above other floating windows. | ||
}, | ||
layout = { | ||
height = { min = 4, max = 25 }, -- min and max height of the columns | ||
width = { min = 20, max = 50 }, -- min and max width of the columns | ||
spacing = 3, -- spacing between columns | ||
align = "left", -- align columns left, center or right | ||
}, | ||
ignore_missing = false, -- enable this to hide mappings for which you didn't specify a label | ||
hidden = { "<silent>", "<cmd>", "<Cmd>", "<CR>", "^:", "^ ", "^call ", "^lua " }, -- hide mapping boilerplate | ||
show_help = true, -- show a help message in the command line for using WhichKey | ||
show_keys = true, -- show the currently pressed key and its label as a message in the command line | ||
triggers = "auto", -- automatically setup triggers | ||
-- triggers = {"<leader>"} -- or specifiy a list manually | ||
-- list of triggers, where WhichKey should not wait for timeoutlen and show immediately | ||
triggers_nowait = { | ||
-- marks | ||
"`", | ||
"'", | ||
"g`", | ||
"g'", | ||
-- registers | ||
'"', | ||
"<c-r>", | ||
-- spelling | ||
"z=", | ||
}, | ||
triggers_blacklist = { | ||
-- list of mode / prefixes that should never be hooked by WhichKey | ||
-- this is mostly relevant for keymaps that start with a native binding | ||
i = { "j", "k" }, | ||
v = { "j", "k" }, | ||
}, | ||
-- disable the WhichKey popup for certain buf types and file types. | ||
-- Disabled by default for Telescope | ||
disable = { | ||
buftypes = {}, | ||
filetypes = {}, | ||
}, | ||
} | ||
wk.setup(opts) | ||
|
||
-- Register keybinds | ||
wk.register(require("min.preferences.keybinds")) | ||
end | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
-- This file will always run on startup | ||
-- Disable netrw | ||
-- vim.g.loaded_netrw = 1 | ||
-- vim.g.loaded_netrwPlugin = 1 | ||
|
||
-- Cmd commands | ||
vim.cmd "set whichwrap+=<,>,[,],h,l" | ||
vim.cmd [[set iskeyword+=-]] | ||
vim.cmd [[set formatoptions-=cro]] -- TODO: this doesn't seem to work | ||
|
||
-- Disable command line history | ||
vim.cmd [[nnoremap q: <nop>]] | ||
|
||
-- Disable mouse | ||
vim.cmd [[set mouse=]] | ||
|
||
-- Remap capital wq's to wq | ||
vim.cmd [[command! W w]] | ||
vim.cmd [[command! WQ wq]] | ||
vim.cmd [[command! Wq wq]] | ||
vim.cmd [[command! WA wa]] | ||
vim.cmd [[command! Wa wa]] | ||
vim.cmd [[command! WQA wqa]] | ||
vim.cmd [[command! WQa wqa]] | ||
vim.cmd [[command! Wqa wqa]] | ||
vim.cmd [[command! Q q]] | ||
|
||
-- Netrw usage tweaks | ||
vim.cmd [[ au FileType netrw nmap <buffer> h -<esc>]] | ||
vim.cmd [[ au FileType netrw nmap <buffer> l <CR>]] | ||
vim.cmd [[ au FileType netrw nmap <buffer> q :bd<CR>]] | ||
|
||
-- Fugitive usage tweaks | ||
vim.cmd [[ au FileType fugitive nmap <buffer> q :bd<CR>]] | ||
|
||
-- Custom commands | ||
vim.api.nvim_create_user_command("Update", function() | ||
vim.cmd [[MasonUpdate]] | ||
vim.cmd [[TSUpdate]] | ||
vim.cmd [[UpdateRemotePlugins]] | ||
end, {}) | ||
|
||
vim.api.nvim_create_autocmd({ "CmdWinEnter" }, { | ||
callback = function() | ||
vim.cmd "quit" | ||
end, | ||
}) | ||
|
||
vim.api.nvim_create_user_command("Reload", function() | ||
vim.cmd [[LspRestart]] | ||
end, {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
local harpoon = require("harpoon") | ||
|
||
-- Mapping of keybinds | ||
local function _cmd(command) | ||
return "<cmd>" .. command .. "<cr>" | ||
end | ||
|
||
-- abcdefghijklmnopqrstuvxyz | ||
return { | ||
["<leader>"] = { | ||
|
||
-- Buffer actions | ||
b = { | ||
name = "+Buffer", | ||
["d"] = { _cmd("bd"), "Delete current buffer" }, | ||
["D"] = { _cmd("%bd|e#"), "Delete every other buffer" }, | ||
["l"] = { _cmd("Telescope buffers"), "List Buffers" }, | ||
}, | ||
|
||
["e"] = { _cmd("Ex"), "Netrw Toggle" }, | ||
|
||
-- Git | ||
g = { | ||
name = "+Git", | ||
a = { _cmd("Git add ."), "Add" }, | ||
b = { _cmd("Gitsigns blame_line"), "Blame" }, | ||
c = { _cmd("Git commit"), "Commit" }, | ||
l = { _cmd("Git log"), "Log" }, | ||
g = { _cmd("LazyGit"), "LazyGit" }, | ||
s = { _cmd("Git"), "Status" }, | ||
}, | ||
|
||
-- Harpoon | ||
["h"] = { | ||
name = "+Harpoon", | ||
["a"] = { function() harpoon:list():append() end, "Add file" }, | ||
["e"] = { function() harpoon.ui:toggle_quick_menu(harpoon:list()) end, "Menu" }, | ||
}, | ||
|
||
-- Help | ||
["H"] = { | ||
name = "+Help", | ||
["k"] = { _cmd("Telescope keymaps"), "Keymaps" }, | ||
["t"] = { _cmd("Telescope builtin"), "Telescope" }, | ||
["T"] = { _cmd("Telescope help_tags"), "Tags" }, | ||
}, | ||
|
||
-- LSP | ||
["l"] = { | ||
name = "+LSP", | ||
["f"] = { _cmd("lua vim.lsp.buf.format{ async = true }"), "Format" }, | ||
["r"] = { _cmd("lua vim.lsp.buf.rename()"), "Rename" }, | ||
["i"] = { _cmd("LspInfo"), "Info" }, | ||
["a"] = { _cmd("lua vim.lsp.buf.code_action()"), "Code Actions" }, | ||
["n"] = { _cmd("lua vim.diagnostic.goto_next({buffer=, opts0})"), "Diagnostics Next" }, | ||
["p"] = { _cmd("lua vim.diagnostic.goto_prev({buffer=, opts0})"), "Diagnostics Prev" }, | ||
["s"] = { _cmd("lua vim.lsp.buf.signature_help()"), "Signature Help" }, | ||
["t"] = { _cmd("TroubleToggle"), "Trouble" }, | ||
["q"] = { _cmd("lua vim.diagnostic.setloclist()"), "Loc List" }, | ||
}, | ||
|
||
-- Lazy | ||
["L"] = { _cmd("Lazy"), "Lazy" }, | ||
|
||
-- Mason | ||
["M"] = { _cmd("Mason"), "Mason" }, | ||
|
||
-- Telescope | ||
["t"] = { | ||
name = "+Telescope", | ||
f = { _cmd("Telescope find_files"), "Find File" }, | ||
r = { _cmd("Telescope oldfiles"), "Recent Files" }, | ||
B = { _cmd("Telescope file_browser"), "File Browser" }, | ||
b = { _cmd("Telescope buffers"), "Buffers" }, | ||
c = { _cmd("Telescope neoclip"), "Clipboard" }, | ||
g = { _cmd("Telescope live_grep"), "Grep" } | ||
}, | ||
|
||
-- Trouble | ||
["T"] = { _cmd("Trouble"), "Trouble" }, | ||
|
||
["U"] = { _cmd("UndotreeToggle"), "Undotree" }, | ||
|
||
["z"] = { _cmd("ZenMode"), "Zen Mode" }, | ||
}, | ||
|
||
-- Non-Leader lsp bindings | ||
["<C-space>"] = { _cmd("lua vim.lsp.buf.hover()"), "Lsp Hover Info" }, | ||
["gd"] = { _cmd("lua vim.lsp.buf.definition()"), "Go Definition" }, | ||
["gD"] = { _cmd("lua vim.lsp.buf.declaration()"), "Go Declaration" }, | ||
["gI"] = { _cmd("lua vim.lsp.buf.implementation()"), "Go Implementation" }, | ||
["gr"] = { _cmd("lua vim.lsp.buf.references()"), "Go References" }, | ||
-- ["gl"] = { _cmd("lua vim.diagnostic.open_float()"), "Go Diagnostics" }, | ||
|
||
-- Harpoon | ||
["<A-1>"] = { function() harpoon:list():select(1) end, "Harpoon file 1" }, | ||
["<A-2>"] = { function() harpoon:list():select(2) end, "Harpoon file 2" }, | ||
["<A-3>"] = { function() harpoon:list():select(3) end, "Harpoon file 3" }, | ||
["<A-4>"] = { function() harpoon:list():select(4) end, "Harpoon file 4" }, | ||
["<A-5>"] = { function() harpoon:list():select(5) end, "Harpoon file 5" }, | ||
|
||
-- ToggleTerm | ||
["<C-\\>"] = { _cmd("ToggleTerm"), "Terminal" }, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,45 @@ | ||
-- :help options | ||
local options = { | ||
backup = false, -- creates a backup file | ||
clipboard = "unnamedplus", -- allows neovim to access the system clipboard | ||
cmdheight = 1, -- more space in the neovim command line for displaying messages | ||
completeopt = { "menuone", "noselect" }, -- mostly just for cmp | ||
conceallevel = 0, -- so that `` is visible in markdown files | ||
fileencoding = "utf-8", -- the encoding written to a file | ||
hlsearch = true, -- highlight all matches on previous search pattern | ||
incsearch = true, -- Incremental search | ||
ignorecase = true, -- ignore case in search patterns | ||
mouse = "a", -- allow the mouse to be used in neovim | ||
pumheight = 10, -- pop up menu height | ||
showmode = false, -- we don't need to see things like -- INSERT -- anymore | ||
showtabline = 0, -- always show tabs | ||
smartcase = true, -- smart case | ||
smartindent = true, -- make indenting smarter again | ||
splitbelow = true, -- force all horizontal splits to go below current window | ||
splitright = true, -- force all vertical splits to go to the right of current window | ||
swapfile = false, -- creates a swapfile | ||
undodir = os.getenv("HOME") .. "/.vim/undodir", -- Undotree memo directory | ||
termguicolors = true, -- set term gui colors (most terminals support this) | ||
timeoutlen = 1000, -- time to wait for a mapped sequence to complete (in milliseconds) | ||
undofile = true, -- enable persistent undo | ||
updatetime = 50, -- faster completion (4000ms default) | ||
colorcolumn = "120", -- 120 char lines | ||
writebackup = false, -- if a file is being edited by another program (or was written to file while editing with another program), it is not allowed to be edited | ||
expandtab = true, -- convert tabs to spaces | ||
shiftwidth = 2, -- the number of spaces inserted for each indentation | ||
tabstop = 2, -- insert 2 spaces for a tab | ||
cursorline = true, -- highlight the current line | ||
number = true, -- set numbered lines | ||
relativenumber = true, -- set relative numbered lines | ||
numberwidth = 4, -- set number column width to 2 {default 4} | ||
signcolumn = "yes", -- always show the sign column, otherwise it would shift the text each time | ||
wrap = false, -- display lines as one long line | ||
scrolloff = 8, -- is one of my fav | ||
sidescrolloff = 8, | ||
guifont = "monospace:h17", -- the font used in graphical neovim applications | ||
} | ||
vim.opt.shortmess:append "c" | ||
|
||
for option, value in pairs(options) do | ||
vim.opt[option] = value | ||
end |
Oops, something went wrong.