tidy
This commit is contained in:
parent
cc02e5cb2d
commit
4dcf6c4262
5 changed files with 146 additions and 36 deletions
|
@ -4,6 +4,7 @@
|
|||
-- NOTE: Must happen before plugins are loaded (otherwise wrong leader will be used)
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = ' '
|
||||
vim.opt.cmdheight = 0
|
||||
|
||||
-- Set to true if you have a Nerd Font installed and selected in the terminal
|
||||
vim.g.have_nerd_font = true
|
||||
|
@ -72,6 +73,24 @@ vim.opt.cursorline = true
|
|||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
vim.opt.scrolloff = 10
|
||||
|
||||
-- quickfix to search and replace
|
||||
vim.api.nvim_create_user_command('SearchAndReplace', function()
|
||||
-- Prompt for the first string (the one to replace)
|
||||
local stringOne = vim.fn.input('Enter the string to replace: ')
|
||||
-- Prompt for the second string (the replacement)
|
||||
local stringTwo = vim.fn.input('Enter the replacement string: ')
|
||||
|
||||
-- Perform the search and replace in the quickfix list
|
||||
vim.cmd('cfdo %s/' .. stringOne .. '/' .. stringTwo .. '/g | update')
|
||||
|
||||
-- Optionally close the buffers
|
||||
vim.cmd('bd')
|
||||
end, {})
|
||||
|
||||
-- Map <leader>R to the LadderR command
|
||||
vim.api.nvim_set_keymap('n', '<leader>R', ':SearchAndReplace<CR>', { noremap = true, silent = true })
|
||||
|
||||
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
|
@ -151,25 +170,6 @@ require('lazy').setup({
|
|||
-- keys can be used to configure plugin behavior/loading/etc.
|
||||
--
|
||||
-- Use `opts = {}` to force a plugin to be loaded.
|
||||
-- {
|
||||
-- 'akinsho/bufferline.nvim',
|
||||
-- opts = {
|
||||
-- options = {
|
||||
-- mode = "buffers",
|
||||
-- themable = true,
|
||||
-- color_icons = true,
|
||||
-- offsets = {
|
||||
-- {
|
||||
-- filetype = "neo-tree",
|
||||
-- text = "File Explorer",
|
||||
-- text_align = "left",
|
||||
-- separator = true,
|
||||
-- }
|
||||
-- },
|
||||
--
|
||||
-- },
|
||||
-- },
|
||||
-- },
|
||||
|
||||
-- Here is a more advanced example where we pass configuration
|
||||
-- options to `gitsigns.nvim`. This is equivalent to the following Lua:
|
||||
|
@ -861,10 +861,11 @@ require('lazy').setup({
|
|||
-- require 'kickstart.plugins.lint',
|
||||
require 'kickstart.plugins.autopairs',
|
||||
require 'kickstart.plugins.neo-tree',
|
||||
-- require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
||||
require 'kickstart.plugins.gitsigns', -- adds gitsigns recommend keymaps
|
||||
|
||||
-- My plugins
|
||||
require 'kickstart.plugins.bufferline',
|
||||
-- require 'kickstart.plugins.bottomline'
|
||||
|
||||
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||
-- This is the easiest way to modularize your config.
|
||||
|
|
|
@ -35,5 +35,6 @@
|
|||
"todo-comments.nvim": { "branch": "main", "commit": "ae0a2afb47cf7395dc400e5dc4e05274bf4fb9e0" },
|
||||
"tokyonight.nvim": { "branch": "main", "commit": "efd1417aa01af618426fe1cf507c5458090458f2" },
|
||||
"vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" }
|
||||
"which-key.nvim": { "branch": "main", "commit": "8badb359f7ab8711e2575ef75dfe6fbbd87e4821" },
|
||||
"winline.nvim": { "branch": "main", "commit": "3f9eb95237ef8c5e66944f27891608c12079b27c" }
|
||||
}
|
||||
|
|
45
nvim/lua/kickstart/plugins/bottomline.lua
Normal file
45
nvim/lua/kickstart/plugins/bottomline.lua
Normal file
|
@ -0,0 +1,45 @@
|
|||
-- bottomline
|
||||
|
||||
return {
|
||||
'mnjm/winline.nvim',
|
||||
dependencies = {
|
||||
'lewis6991/gitsigns.nvim',
|
||||
'nvim-tree/nvim-web-devicons'
|
||||
},
|
||||
config = function()
|
||||
require('winline').setup {
|
||||
-- Enable winline
|
||||
enable = true,
|
||||
|
||||
-- Minimal components for a status line that feels like a command line
|
||||
components = {
|
||||
left = {
|
||||
{'mode'}, -- Shows the current mode (Normal, Insert, etc.)
|
||||
},
|
||||
right = {
|
||||
{'line_col'}, -- Show line and column numbers
|
||||
},
|
||||
},
|
||||
|
||||
-- Disable separators and reduce padding for a minimal look
|
||||
options = {
|
||||
separators = true, -- No separators between components
|
||||
padding = 0, -- Minimal padding for a compact look
|
||||
},
|
||||
|
||||
-- Make it look cohesive with the command line
|
||||
colors = {
|
||||
active = '#282c34', -- Dark background for the active window
|
||||
inactive = '#3e4451', -- Slightly lighter background for inactive windows
|
||||
},
|
||||
}
|
||||
|
||||
-- Set Neovim options to make the command line always visible and match the style
|
||||
vim.opt.cmdheight = 0 -- Always show the command line
|
||||
vim.cmd [[
|
||||
highlight StatusLine guibg=#282c34 guifg=#abb2bf
|
||||
highlight CmdLine guibg=#282c34 guifg=#abb2bf
|
||||
]]
|
||||
end,
|
||||
}
|
||||
|
|
@ -1,27 +1,29 @@
|
|||
-- bufferline
|
||||
|
||||
|
||||
return {
|
||||
'akinsho/bufferline.nvim',
|
||||
version = '*',
|
||||
dependencies = {
|
||||
'nvim-tree/nvim-web-devicons',
|
||||
},
|
||||
opts = {
|
||||
options = {
|
||||
mode = "buffers",
|
||||
themable = true,
|
||||
color_icons = true,
|
||||
offsets = {
|
||||
{
|
||||
filetype = "neo-tree",
|
||||
text = "File Explorer",
|
||||
text_align = "left",
|
||||
separator = true,
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function()
|
||||
require('bufferline').setup {
|
||||
options = {
|
||||
mode = "buffers",
|
||||
themable = true,
|
||||
color_icons = true,
|
||||
offsets = {
|
||||
{
|
||||
filetype = "neo-tree",
|
||||
text = "File Explorer",
|
||||
text_align = "left",
|
||||
separator = true,
|
||||
}
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
-- Keymaps for bufferline
|
||||
vim.keymap.set('n', '<A-h>', '<cmd>BufferLineCyclePrev<CR>', { silent = true })
|
||||
vim.keymap.set('n', '<A-l>', '<cmd>BufferLineCycleNext<CR>', { silent = true })
|
||||
|
|
61
nvim/lua/kickstart/plugins/gitsigns.lua
Normal file
61
nvim/lua/kickstart/plugins/gitsigns.lua
Normal file
|
@ -0,0 +1,61 @@
|
|||
-- Adds git related signs to the gutter, as well as utilities for managing changes
|
||||
-- NOTE: gitsigns is already included in init.lua but contains only the base
|
||||
-- config. This will add also the recommended keymaps.
|
||||
|
||||
return {
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
opts = {
|
||||
on_attach = function(bufnr)
|
||||
local gitsigns = require 'gitsigns'
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { ']c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'next'
|
||||
end
|
||||
end, { desc = 'Jump to next git [c]hange' })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { '[c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'prev'
|
||||
end
|
||||
end, { desc = 'Jump to previous git [c]hange' })
|
||||
|
||||
-- Actions
|
||||
-- visual mode
|
||||
map('v', '<leader>hs', function()
|
||||
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'stage git hunk' })
|
||||
map('v', '<leader>hr', function()
|
||||
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'reset git hunk' })
|
||||
-- normal mode
|
||||
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
||||
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
||||
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
|
||||
map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' })
|
||||
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
||||
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
||||
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
|
||||
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
||||
map('n', '<leader>hD', function()
|
||||
gitsigns.diffthis '@'
|
||||
end, { desc = 'git [D]iff against last commit' })
|
||||
-- Toggles
|
||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
||||
map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' })
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
Loading…
Reference in a new issue