Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 1 addition & 18 deletions dot_config/nvim/autoload/utils.vim
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ endfunction

" Used to set darker winhighlight for specific filetypes
function! utils#handle_win()
let l:sidebar = ['undotree', 'Outline', 'qf', 'DiffviewFiles', 'DiffviewFileHistory', 'aerial']
let l:sidebar = ['nvim-undotree', 'Outline', 'qf', 'DiffviewFiles', 'DiffviewFileHistory', 'aerial']
if index(l:sidebar, &filetype) >= 0
setlocal winhighlight=Normal:TabLineFill
endif
Expand All @@ -55,20 +55,3 @@ function! utils#setccol()
let &l:colorcolumn=&l:textwidth+1
endif
endfunction

function! utils#blank_up()
let cmd = 'put!=repeat(nr2char(10), v:count1)|silent '']+'
if &modifiable
let cmd .= '|silent! call repeat#set("\<Plug>(BlankUp)", v:count1)'
endif
return cmd
endfunction

function! utils#blank_down()
let cmd = 'put =repeat(nr2char(10), v:count1)|silent ''[-'
if &modifiable
let cmd .= '|silent! call repeat#set("\<Plug>(BlankDown)", v:count1)'
endif
return cmd
endfunction

1 change: 0 additions & 1 deletion dot_config/nvim/init.lua
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
local function disable_default_plugins()
-- FIXME: WSL register bug
vim.g.loaded_clipboard_provider = 1
vim.g.loaded_matchit = 1
vim.g.loaded_matchparen = 1
Expand Down
63 changes: 0 additions & 63 deletions dot_config/nvim/lua/modules/cmp.lua

This file was deleted.

3 changes: 1 addition & 2 deletions dot_config/nvim/lua/modules/feline/statusline.lua
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ local components = {
}

force_inactive.filetypes = {
"packer",
"undotree",
"nvim-undotree",
"Outline",
"help",
"nnn",
Expand Down
2 changes: 1 addition & 1 deletion dot_config/nvim/lua/modules/feline/winbar.lua
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ local components = {

disable.filetypes = {
"Outline",
"undotree",
"nvim-undotree",
"DiffviewFileHistory",
"DiffviewFiles",
"TelescopePicker",
Expand Down
54 changes: 54 additions & 0 deletions dot_config/nvim/lua/modules/gitsigns/init.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
local gitsigns = require("gitsigns")

gitsigns.setup({
numhl = false,
linehl = false,
on_attach = function(bufnr)
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end

-- Navigation
map("n", "]g", function()
if vim.wo.diff then
return "]g"
end
vim.schedule(function()
gitsigns.next_hunk()
end)
return "<Ignore>"
end, { expr = true })
map("n", "[g", function()
if vim.wo.diff then
return "[g"
end
vim.schedule(function()
gitsigns.prev_hunk()
end)
return "<Ignore>"
end, { expr = true })

-- Text object
map({ "o", "x" }, "ig", ":<C-U>Gitsigns select_hunk<CR>")
end,
watch_gitdir = {
interval = 1000,
follow_files = true,
},
current_line_blame = false,
current_line_blame_opts = {
delay = 0,
},
sign_priority = 6,
update_debounce = 100,
status_formatter = nil,
word_diff = false,
diff_opts = {
algorithm = "myers",
internal = true,
indent_heuristic = true,
linematch = true,
},
})
42 changes: 42 additions & 0 deletions dot_config/nvim/lua/modules/hydra/debug.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
local hydra = require("hydra")
local dap = require("dap")

local hint = [[
^ ^Step^ ^ ^ ^ ^ Action
----^-^-^-^--^-^---- ^-^-------------------
^ ^back^ ^ ^ ^_t_: toggle breakpoint
^ ^ _K_^ ^ _T_: clear breakpoints
out _H_ ^ ^ _L_ into _c_: continue
^ ^ _J_ ^ ^ _x_: terminate
^ ^over ^ ^ ^^_r_: open repl

^ ^ _q_: exit
]]

local debug_hydra = hydra({
name = "Debug",
hint = hint,
config = {
color = "pink",
invoke_on_body = true,
hint = {
type = "window",
},
},
mode = { "n" },
body = "<leader>s",
heads = {
{ "H", dap.step_out, { desc = "step out" } },
{ "J", dap.step_over, { desc = "step over" } },
{ "K", dap.step_back, { desc = "step back" } },
{ "L", dap.step_into, { desc = "step into" } },
{ "t", dap.toggle_breakpoint, { desc = "toggle breakpoint" } },
{ "T", dap.clear_breakpoints, { desc = "clear breakpoints" } },
{ "c", dap.continue, { desc = "continue" } },
{ "x", dap.terminate, { desc = "terminate" } },
{ "r", dap.repl.open, { exit = true, desc = "open repl" } },
{ "q", nil, { exit = true, nowait = true, desc = "exit" } },
},
})

return debug_hydra
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
local gitsigns = require("gitsigns")

local Hydra = require("hydra")
local hydra = require("hydra")
local gitsigns = require("gitsigns")

local hint = [[
Expand All @@ -10,7 +8,8 @@ local hint = [[
^
^ ^ _q_: exit
]]
Hydra({

local gitsigns_hydra = hydra({
name = "Git",
hint = hint,
config = {
Expand All @@ -23,14 +22,18 @@ Hydra({
},
},
on_enter = function()
vim.cmd("mkview")
if vim.fn.bufname() ~= "" then
vim.cmd("mkview")
end
vim.cmd("silent! %foldopen!")
vim.bo.modifiable = true
gitsigns.toggle_linehl(true)
end,
on_exit = function()
local cursor_pos = vim.api.nvim_win_get_cursor(0)
vim.cmd("loadview")
if vim.fn.bufname() ~= "" then
vim.cmd("loadview")
end
vim.api.nvim_win_set_cursor(0, cursor_pos)
vim.cmd("normal zv")
gitsigns.toggle_linehl(false)
Expand Down Expand Up @@ -84,55 +87,4 @@ Hydra({
},
})

gitsigns.setup({
numhl = false,
linehl = false,
on_attach = function(bufnr)
local function map(mode, l, r, opts)
opts = opts or {}
opts.buffer = bufnr
vim.keymap.set(mode, l, r, opts)
end

-- Navigation
map("n", "]g", function()
if vim.wo.diff then
return "]g"
end
vim.schedule(function()
gitsigns.next_hunk()
end)
return "<Ignore>"
end, { expr = true })
map("n", "[g", function()
if vim.wo.diff then
return "[g"
end
vim.schedule(function()
gitsigns.prev_hunk()
end)
return "<Ignore>"
end, { expr = true })

-- Text object
map({ "o", "x" }, "ig", ":<C-U>Gitsigns select_hunk<CR>")
end,
watch_gitdir = {
interval = 1000,
follow_files = true,
},
current_line_blame = false,
current_line_blame_opts = {
delay = 0,
},
sign_priority = 6,
update_debounce = 100,
status_formatter = nil, -- Use default
word_diff = false,
diff_opts = {
algorithm = "myers",
internal = true,
indent_heuristic = true,
linematch = true,
},
})
return gitsigns_hydra
1 change: 0 additions & 1 deletion dot_config/nvim/lua/modules/hydra/init.lua

This file was deleted.

47 changes: 47 additions & 0 deletions dot_config/nvim/lua/modules/hydra/telescope.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
local hydra = require("hydra")
local tscope = require("modules.telescope.functions")

local function cmd(command)
return table.concat({ "<cmd>", command, "<CR>" })
end

local hint = [[
_g_: git status _l_: live grep _h_: highlights _r_: old files
_s_: spell suggest _c_: commands _k_: keymaps _b_: buffers
_o_: live grep open _a_: autocommands _m_: help tags
^
^ ^ _<Enter>_: Resume ^ ^ _?_: all ^ ^ _<Esc>_
]]

local telescope_hydra = hydra({
hint = hint,
config = {
invoke_on_body = true,
color = "teal",
hint = {
float_opts = {
border = "rounded",
},
},
},
mode = "n",
body = "<Leader>p",
heads = {
{ "g", cmd("Telescope git_status") },
{ "l", cmd("Telescope live_grep") },
{ "h", cmd("Telescope highlights") },
{ "r", cmd("Telescope oldfiles") },
{ "s", cmd("Telescope spell_suggest theme=get_cursor layout_config={height=6}"), desc = "Spell suggest" },
{ "c", tscope.commands },
{ "k", tscope.keymaps },
{ "b", cmd("Telescope buffers") },
{ "o", cmd("Telescope live_grep grep_open_files=true"), desc = "Grep only open files" },
{ "a", cmd("Telescope autocommands") },
{ "m", cmd("Telescope help_tags") },
{ "<Enter>", cmd("Telescope resume") },
{ "?", cmd("Telescope"), desc = "List all pickers" },
{ "<Esc>", nil, { nowait = true } },
},
})

return telescope_hydra
Loading