Skip to content

Commit

Permalink
feat: Add Lazygit (#54)
Browse files Browse the repository at this point in the history
  • Loading branch information
mpriscella authored Oct 30, 2024
1 parent 1b0d480 commit 1b015ae
Show file tree
Hide file tree
Showing 8 changed files with 82 additions and 32 deletions.
19 changes: 19 additions & 0 deletions .config/nvim/after/ftplugin/terraform.lua
Original file line number Diff line number Diff line change
@@ -1 +1,20 @@
vim.bo.commentstring = '# %s'

local function add_comment_header()
local line_number = vim.api.nvim_win_get_cursor(0)[1]
local line = vim.api.nvim_get_current_line()
local bookend = '################################################################################'

vim.api.nvim_buf_set_lines(0, line_number - 1, line_number, true, {
bookend,
'# ' .. line,
})
vim.api.nvim_buf_set_lines(0, line_number + 1, line_number + 1, true, { bookend })

if line == '' then
vim.api.nvim_win_set_cursor(0, { line_number + 1, 2 })
vim.cmd 'startinsert'
end
end

vim.keymap.set('n', 'gh', add_comment_header, { desc = 'Add Comment Header' })
17 changes: 8 additions & 9 deletions .config/nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -90,10 +90,10 @@ vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagn
vim.keymap.set('t', '<Esc><Esc>', '<C-\\><C-n>', { desc = 'Exit terminal mode' })

-- TIP: Disable arrow keys in normal mode
vim.keymap.set("n", "<left>", '<cmd>echo "Use h to move!!"<CR>')
vim.keymap.set("n", "<right>", '<cmd>echo "Use l to move!!"<CR>')
vim.keymap.set("n", "<up>", '<cmd>echo "Use k to move!!"<CR>')
vim.keymap.set("n", "<down>", '<cmd>echo "Use j to move!!"<CR>')
vim.keymap.set('n', '<left>', '<cmd>echo "Use h to move!!"<CR>')
vim.keymap.set('n', '<right>', '<cmd>echo "Use l to move!!"<CR>')
vim.keymap.set('n', '<up>', '<cmd>echo "Use k to move!!"<CR>')
vim.keymap.set('n', '<down>', '<cmd>echo "Use j to move!!"<CR>')

-- Keybinds to make split navigation easier.
-- Use CTRL+<hjkl> to switch between windows
Expand All @@ -105,13 +105,12 @@ vim.keymap.set('n', '<C-j>', '<C-w><C-j>', { desc = 'Move focus to the lower win
vim.keymap.set('n', '<C-k>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })

-- Tabs.
vim.keymap.set("n", "<Leader>t", ":tabnew<CR>", { silent = true })
vim.keymap.set("n", "<Leader>w", ":tabclose<CR>", { silent = true })
vim.keymap.set('n', '<Leader>t', ':tabnew<CR>', { silent = true })
vim.keymap.set('n', '<Leader>w', ':tabclose<CR>', { silent = true })

-- Map <Leader>[1-9] to switch between open tabs.
for i = 1,9,1
do
vim.keymap.set("n", string.format("<Leader>%d", i), string.format("%dgt<CR>", i), { noremap = true, silent = true })
for i = 1, 9, 1 do
vim.keymap.set('n', string.format('<Leader>%d', i), string.format('%dgt<CR>', i), { noremap = true, silent = true })
end

-- [[ Basic Autocommands ]]
Expand Down
29 changes: 15 additions & 14 deletions .config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
@@ -1,32 +1,33 @@
{
"LuaSnip": { "branch": "master", "commit": "e808bee352d1a6fcf902ca1a71cee76e60e24071" },
"LuaSnip": { "branch": "master", "commit": "2c08f32a570c07b8130144813266e21393da80d3" },
"cmp-nvim-lsp": { "branch": "main", "commit": "39e2eda76828d88b773cc27a3f61d2ad782c922d" },
"cmp-path": { "branch": "main", "commit": "91ff86cd9c29299a64f968ebb45846c485725f23" },
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
"conform.nvim": { "branch": "master", "commit": "40d4e98fcc3e6f485f0e8924c63734bc7e305967" },
"conform.nvim": { "branch": "master", "commit": "6a28c90082a67f62a323ab90d988e000a718a8c7" },
"diffview.nvim": { "branch": "main", "commit": "4516612fe98ff56ae0415a259ff6361a89419b0a" },
"fidget.nvim": { "branch": "main", "commit": "d855eed8a06531a7e8fd0684889b2943f373c469" },
"gitsigns.nvim": { "branch": "main", "commit": "863903631e676b33e8be2acb17512fdc1b80b4fb" },
"indent-blankline.nvim": { "branch": "master", "commit": "e7a4442e055ec953311e77791546238d1eaae507" },
"lazy.nvim": { "branch": "main", "commit": "077102c5bfc578693f12377846d427f49bc50076" },
"fidget.nvim": { "branch": "main", "commit": "e2a175c2abe2d4f65357da1c98c59a5cfb2b543f" },
"gitsigns.nvim": { "branch": "main", "commit": "2d725fdd7fe4a612fa3171ca0a965f455d8dc325" },
"indent-blankline.nvim": { "branch": "master", "commit": "04e44b09ee3ff189c69ab082edac1ef7ae2e256c" },
"lazy.nvim": { "branch": "main", "commit": "cf8ecc2c5e4332760431a33534240b0cbc6680ab" },
"lazydev.nvim": { "branch": "main", "commit": "491452cf1ca6f029e90ad0d0368848fac717c6d2" },
"lazygit.nvim": { "branch": "main", "commit": "56760339a81cd1540d5a72fd9d93010a2677b55d" },
"luvit-meta": { "branch": "main", "commit": "ce76f6f6cdc9201523a5875a4471dcfe0186eb60" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "25c11854aa25558ee6c03432edfa0df0217324be" },
"mason-lspconfig.nvim": { "branch": "main", "commit": "4d0e5b49363cac187326998b96aa6a2884e0e89b" },
"mason-nvim-dap.nvim": { "branch": "main", "commit": "8b9363d83b5d779813cdd2819b8308651cec2a09" },
"mason-tool-installer.nvim": { "branch": "main", "commit": "c5e07b8ff54187716334d585db34282e46fa2932" },
"mason.nvim": { "branch": "main", "commit": "e2f7f9044ec30067bc11800a9e266664b88cda22" },
"mini.nvim": { "branch": "main", "commit": "df1559e2ed7ece458e0a97a8bb9556d465d1c775" },
"mini.nvim": { "branch": "main", "commit": "0a8a1072137d916406507c941698a4bfa9dbbe7a" },
"neo-tree.nvim": { "branch": "main", "commit": "a77af2e764c5ed4038d27d1c463fa49cd4794e07" },
"nui.nvim": { "branch": "main", "commit": "b58e2bfda5cea347c9d58b7f11cf3012c7b3953f" },
"nvim-autopairs": { "branch": "master", "commit": "ee297f215e95a60b01fde33275cc3c820eddeebe" },
"nvim-cmp": { "branch": "main", "commit": "ae644feb7b67bf1ce4260c231d1d4300b19c6f30" },
"nvim-cmp": { "branch": "main", "commit": "29fb4854573355792df9e156cb779f0d31308796" },
"nvim-dap": { "branch": "master", "commit": "7ff6936010b7222fea2caea0f67ed77f1b7c60dd" },
"nvim-dap-go": { "branch": "main", "commit": "6aa88167ea1224bcef578e8c7160fe8afbb44848" },
"nvim-dap-ui": { "branch": "master", "commit": "ffa89839f97bad360e78428d5c740fdad9a0ff02" },
"nvim-lint": { "branch": "master", "commit": "f707b3ae50417067fa63fdfe179b0bff6b380da1" },
"nvim-lspconfig": { "branch": "master", "commit": "d141895d1d9f41048fff201d62a2d6e96d299e32" },
"nvim-lint": { "branch": "master", "commit": "16b21a7d04d06661f92f273a0744fd81fb19e09e" },
"nvim-lspconfig": { "branch": "master", "commit": "59a6766cbf32c7e4cf3ed685ccad7ffe1dde8c40" },
"nvim-nio": { "branch": "master", "commit": "a428f309119086dc78dd4b19306d2d67be884eee" },
"nvim-treesitter": { "branch": "master", "commit": "5a2ff8b7ca5470b1011ed82ef3fdd53139ffc467" },
"nvim-treesitter": { "branch": "master", "commit": "39016abc99853c3e9d70f1bec7e2fa661b9a81bf" },
"nvim-web-devicons": { "branch": "master", "commit": "19d257cf889f79f4022163c3fbb5e08639077bd8" },
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
"popup.nvim": { "branch": "master", "commit": "b7404d35d5d3548a82149238289fa71f7f6de4ac" },
Expand All @@ -35,8 +36,8 @@
"telescope.nvim": { "branch": "0.1.x", "commit": "a0bbec21143c7bc5f8bb02e0005fa0b982edc026" },
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
"toggleterm.nvim": { "branch": "main", "commit": "48be57eaba817f038d61bbf64d2c597f578c0827" },
"tokyonight.nvim": { "branch": "main", "commit": "2c85fad417170d4572ead7bf9fdd706057bd73d7" },
"tokyonight.nvim": { "branch": "main", "commit": "2e1daa1d164ad8cc3e99b44ca68e990888a66038" },
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
"vs-tasks.nvim": { "branch": "main", "commit": "5a5d9e5959c8abadb6f979e88a1366c7ac51b876" },
"vs-tasks.nvim": { "branch": "main", "commit": "33f8f5a53541cfff018863289353ba144a19fd54" },
"which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" }
}
22 changes: 22 additions & 0 deletions .config/nvim/lua/custom/plugins/lazygit.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
return {
{
'kdheepak/lazygit.nvim',
lazy = true,
cmd = {
'LazyGit',
'LazyGitConfig',
'LazyGitCurrentFile',
'LazyGitFilter',
'LazyGitFilterCurrentFile',
},
-- optional for floating window border decoration
dependencies = {
'nvim-lua/plenary.nvim',
},
-- setting the keybinding for LazyGit with 'keys' is recommended in
-- order to load the plugin when the command is run for the first time
keys = {
{ '<leader>lg', '<cmd>LazyGit<cr>', desc = 'LazyGit' },
},
},
}
6 changes: 3 additions & 3 deletions .config/nvim/lua/custom/plugins/lint.lua
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ return {
event = { 'BufReadPre', 'BufNewFile' },
config = function()
local lint = require 'lint'
lint.linters_by_ft = {
markdown = { 'markdownlint' },
}
-- lint.linters_by_ft = {
-- markdown = { 'markdownlint' },
-- }

-- To allow other plugins to add linters to require('lint').linters_by_ft,
-- instead set linters_by_ft like this:
Expand Down
3 changes: 2 additions & 1 deletion .config/nvim/lua/custom/plugins/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,8 @@ return {
local servers = {
bashls = {},
shellcheck = {},
markdownlint = {},
terraformls = {},
-- markdownlint = {},
-- clangd = {},
-- gopls = {},
-- pyright = {},
Expand Down
8 changes: 5 additions & 3 deletions .wezterm.lua
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
-- https://wezfurlong.org/wezterm/config/files.html

-- Pull in the wezterm API
local wezterm = require 'wezterm'
local wezterm = require("wezterm")

-- This will hold the configuration.
local config = wezterm.config_builder()

config.font = wezterm.font 'SpaceMono Nerd Font'
config.color_scheme = 'GitHub Dark'
config.font = wezterm.font("SpaceMono Nerd Font")
config.color_scheme = "GitHub Dark"

config.max_fps = 120

-- and finally, return the configuration to wezterm
return config
10 changes: 8 additions & 2 deletions dotfiles.sh
Original file line number Diff line number Diff line change
Expand Up @@ -117,12 +117,18 @@ install_dependencies() {
curl -fsSL https://deb.nodesource.com/setup_20.x | sudo -E bash -
check_packages nodejs
install_neovim >/dev/null 2>&1
LAZYGIT_VERSION=$(curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": "v\K[^"]*')
curl -Lo /tmp/lazygit.tar.gz "https://github.com/jesseduffield/lazygit/releases/latest/download/lazygit_${LAZYGIT_VERSION}_Linux_x86_64.tar.gz"
tar xf /tmp/lazygit.tar.gz lazygit
sudo install lazygit /usr/local/bin
rm lazygit
elif [ "${ADJUSTED_ID}" = "darwin" ]; then
brew tap homebrew/cask-fonts
brew install --casks dbeaver-community devtoys font-space-mono-nerd-font wezterm
check_packages ack atuin derailed/k9s/k9s dive fzf gh gnupg hadolint helm \
jordanbaird-ice jq k6 kind neovim node ripgrep shellcheck sslscan step \
terraform-ls tmux tree-sitter yq yt-dlp
jordanbaird-ice jq k6 kind jesseduffield/lazygit/lazygit neovim node \
ripgrep shellcheck sslscan step terraform-ls tmux tree-sitter yq \
yt-dlp
npm install -g @devcontainers/cli
fi
clean_up
Expand Down

0 comments on commit 1b015ae

Please sign in to comment.