-
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
Showing
39 changed files
with
1,137 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
# Compiled Lua sources | ||
luac.out | ||
|
||
|
||
# luarocks build files | ||
*.src.rock | ||
*.zip | ||
*.tar.gz | ||
|
||
# Object files | ||
*.o | ||
*.os | ||
*.ko | ||
*.obj | ||
*.elf | ||
|
||
# Precompiled Headers | ||
*.gch | ||
*.pch | ||
|
||
# Libraries | ||
*.lib | ||
*.a | ||
*.la | ||
*.lo | ||
*.def | ||
*.exp | ||
|
||
# Shared objects (inc. Windows DLLs) | ||
*.dll | ||
*.so | ||
*.so.* | ||
*.dylib | ||
|
||
# Executables | ||
*.exe | ||
*.out | ||
*.app | ||
*.i*86 | ||
*.x86_64 | ||
*.hex | ||
|
||
|
||
plugin/packer_compiled.lua |
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,22 @@ | ||
local alpha = require 'alpha' | ||
local theme = require 'alpha.themes.startify' | ||
|
||
local query = require 'possession.query' | ||
local get_layout = function() | ||
return query.alpha_workspace_layout( | ||
{}, | ||
theme.button, | ||
{ others_name = 'ﮛ Sessions', } | ||
) | ||
end | ||
local utils = require('possession.utils') | ||
local function session() | ||
return { | ||
type = 'group', | ||
val = utils.throttle(get_layout, 5000), | ||
} | ||
end | ||
|
||
table.insert(theme.config.layout, 5, session()) | ||
|
||
alpha.setup(theme.config) |
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,74 @@ | ||
require('bufferline').setup { | ||
highlights = { | ||
buffer_selected = { italic = true }, | ||
}, | ||
options = { | ||
separator_style = 'slant', | ||
modified_icon = '', | ||
show_buffer_close_icons = false, | ||
show_close_icon = false, | ||
offsets = { | ||
{ | ||
filetype = 'NvimTree', | ||
text = function() | ||
return ' ' .. vim.fn.fnamemodify(vim.fn.getcwd(), ':t') | ||
end, | ||
separator = true, -- uses offset_separator colors | ||
highlight = 'BufferLineFill', | ||
} | ||
}, | ||
} | ||
} | ||
|
||
-- NOTE: we have to call this a second time (after colors.lua), otherwise stuff | ||
-- is broken :-/ | ||
vim.cmd('colorscheme nightfox') | ||
|
||
vim.keymap.set('n', '<leader>bb', '<cmd>BufferLinePick<cr>', | ||
{ noremap = true, silent = true, desc = 'Jump to buffer' } | ||
) | ||
vim.keymap.set('n', '<leader>bj', '<cmd>BufferLineCycleNext<cr>', | ||
{ noremap = true, silent = true, desc = 'Next buffer' } | ||
) | ||
vim.keymap.set('n', '<leader>bk', '<cmd>BufferLineCyclePrev<cr>', | ||
{ noremap = true, silent = true, desc = 'Previous buffer' } | ||
) | ||
vim.keymap.set('n', '<leader>bl', '<cmd>BufferLineMoveNext<cr>', | ||
{ noremap = true, silent = true, desc = 'Move buffer right' } | ||
) | ||
vim.keymap.set('n', '<leader>bh', '<cmd>BufferLineMovePrev<cr>', | ||
{ noremap = true, silent = true, desc = 'Move buffer left' } | ||
) | ||
vim.keymap.set('n', '<leader>bp', '<cmd>BufferLineTogglePin<cr>', | ||
{ noremap = true, silent = true, desc = 'Pin/unpin buffer' } | ||
) | ||
vim.keymap.set('n', '<leader>bc', '<cmd>BufferLinePickClose<cr>', | ||
{ noremap = true, silent = true, desc = 'Close buffer' } | ||
) | ||
|
||
local close_buffers = require('close_buffers') | ||
|
||
close_buffers.setup { | ||
preserve_window_layout = { 'this' }, | ||
next_buffer_cmd = function(windows) | ||
require('bufferline').cycle(1) | ||
local bufnr = vim.api.nvim_get_current_buf() | ||
|
||
for _, window in ipairs(windows) do | ||
vim.api.nvim_win_set_buf(window, bufnr) | ||
end | ||
end, | ||
} | ||
|
||
vim.keymap.set('n', '<leader>bH', | ||
function() close_buffers.delete { type = 'hidden' } end, | ||
{ noremap = true, silent = true, desc = 'Close hidden buffers' } | ||
) | ||
vim.keymap.set('n', '<leader>bU', | ||
function() close_buffers.delete { type = 'nameless' } end, | ||
{ noremap = true, silent = true, desc = 'Close unnamed buffers' } | ||
) | ||
vim.keymap.set('n', '<leader>bC', | ||
function() close_buffers.delete { type = 'this' } end, | ||
{ noremap = true, silent = true, desc = 'Close current buffer' } | ||
) |
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,31 @@ | ||
require('nightfox').setup { | ||
options = { | ||
transparent = false, -- Disable setting background | ||
dim_inactive = true, -- Non focused panes set to alternative background | ||
styles = { | ||
comments = 'italic', | ||
-- keywords = 'italic', | ||
-- functions = 'italic', | ||
-- strings = 'italic', | ||
-- variables = 'italic', | ||
}, | ||
}, | ||
groups = { | ||
nightfox = { | ||
ColorColumn = { bg = 'bg0' }, | ||
CursorLine = { bg = 'bg2' }, | ||
LineNr = { fg = 'bg4', bg = 'bg0' }, | ||
Substitute = { bg = 'palette.yellow.dim' }, | ||
NvimTreeSpecialFile = { fg = 'palette.green.dim' }, | ||
}, | ||
}, | ||
} | ||
|
||
-- Setting a dimmed red (taken from color scheme) as backgroud for trailing | ||
-- whitespace. Needs to be at the very end, any further call to 'colorscheme' | ||
-- resets to the default full bright red. :-/ | ||
local spec = require('nightfox.spec').load('nightfox') | ||
-- print(vim.inspect(spec.palette)) -- for finding stuff | ||
vim.g.better_whitespace_guicolor = spec.palette.red.dim | ||
|
||
vim.cmd('colorscheme nightfox') |
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,18 @@ | ||
-- https://github.com/JoosepAlviste/nvim-ts-context-commentstring#commentnvim | ||
|
||
require('Comment').setup { | ||
pre_hook = require('ts_context_commentstring.integrations.comment_nvim') | ||
.create_pre_hook(), | ||
} | ||
|
||
local ft = require('Comment.ft') | ||
ft.set('gitconfig', '# %s') -- default is ; but all my stuff uses # (both work) | ||
|
||
if vim.g.neovide then | ||
vim.keymap.set('n', '<C-/>', '<Plug>(comment_toggle_linewise_current)') | ||
vim.keymap.set('v', '<C-/>', '<Plug>(comment_toggle_linewise_visual)') | ||
else | ||
-- Ctrl+/ is <C-_>, see https://vi.stackexchange.com/a/26617 | ||
vim.keymap.set('n', '<C-_>', '<Plug>(comment_toggle_linewise_current)') | ||
vim.keymap.set('v', '<C-_>', '<Plug>(comment_toggle_linewise_visual)') | ||
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,34 @@ | ||
vim.g.copilot_filetypes = { | ||
['*'] = false, | ||
['bash'] = true, | ||
['c'] = true, | ||
['cpp'] = true, | ||
['cs'] = true, | ||
['css'] = true, | ||
['elixir'] = true, | ||
['fish'] = true, | ||
['fortran'] = true, | ||
['go'] = true, | ||
['html'] = true, | ||
['nim'] = true, | ||
['java'] = true, | ||
['javascript'] = true, | ||
['javascriptreact'] = true, | ||
['json'] = true, | ||
['jsx'] = true, | ||
['lua'] = true, | ||
['markdown'] = true, | ||
['perl'] = true, | ||
['php'] = true, | ||
['python'] = true, | ||
['ruby'] = true, | ||
['rust'] = true, | ||
['scss'] = true, | ||
['sh'] = true, | ||
['sql'] = true, | ||
['toml'] = true, | ||
['typescript'] = true, | ||
['typescriptreact'] = true, | ||
['vim'] = true, | ||
['yaml'] = true, | ||
} |
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,42 @@ | ||
require('gitsigns').setup { | ||
on_attach = function(bufnr) | ||
local gs = package.loaded.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 return ']c' end | ||
vim.schedule(function() gs.next_hunk() end) | ||
return '<Ignore>' | ||
end, { expr = true, desc = 'Next git change' }) | ||
|
||
map('n', '[c', function() | ||
if vim.wo.diff then return '[c' end | ||
vim.schedule(function() gs.prev_hunk() end) | ||
return '<Ignore>' | ||
end, { expr = true, desc = 'Previous git change' }) | ||
|
||
-- Actions | ||
map({ 'n', 'v' }, '<leader>gs', ':Gitsigns stage_hunk<CR>', { desc = 'git: stage hunk' }) | ||
map({ 'n', 'v' }, '<leader>gr', ':Gitsigns reset_hunk<CR>', { desc = 'git: reset hunk' }) | ||
map('n', '<leader>gu', gs.undo_stage_hunk, { desc = 'git: undo stage hunk' }) | ||
map('n', '<leader>gS', gs.stage_buffer, { desc = 'git: stage file' }) | ||
map('n', '<leader>gR', gs.reset_buffer, { desc = 'git: reset file' }) | ||
map('n', '<leader>gp', gs.preview_hunk, { desc = 'git: diff hunk' }) | ||
map('n', '<leader>gd', gs.diffthis, { desc = 'git: diff file' }) | ||
map('n', '<leader>gD', function() gs.diffthis('~') end, { desc = 'git: diff file (staged)' }) | ||
map('n', '<leader>gB', function() gs.blame_line { full = true } end, { desc = 'git: blame popup' }) | ||
|
||
-- Toggles | ||
map('n', '<leader>tb', gs.toggle_current_line_blame, { desc = 'git: toggle blame' }) | ||
map('n', '<leader>td', gs.toggle_deleted, { desc = 'git: toggle deleted' }) | ||
|
||
-- Text object (e.g. vig -> select current hunk) | ||
map({ 'o', 'x' }, 'ig', ':<C-U>Gitsigns select_hunk<CR>', { desc = 'git: select hunk' }) | ||
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,3 @@ | ||
require('guess-indent').setup { | ||
filetype_exclude = { 'gitcommit', 'markdown', 'text' } | ||
} |
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,17 @@ | ||
local mark = require('harpoon.mark') | ||
local ui = require('harpoon.ui') | ||
|
||
vim.keymap.set('n', '<leader>ha', mark.add_file) | ||
|
||
vim.keymap.set('n', '<leader>h1', function() ui.nav_file(1) end) | ||
vim.keymap.set('n', '<leader>h2', function() ui.nav_file(2) end) | ||
vim.keymap.set('n', '<leader>h3', function() ui.nav_file(3) end) | ||
vim.keymap.set('n', '<leader>h4', function() ui.nav_file(4) end) | ||
|
||
vim.keymap.set('n', '<leader>hh', ui.toggle_quick_menu) | ||
|
||
local telescope_ok, telescope = pcall(require, 'telescope') | ||
if telescope_ok then | ||
telescope.load_extension('harpoon') | ||
vim.keymap.set('n', '<leader>hm', ':Telescope harpoon marks<cr>') | ||
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,6 @@ | ||
require('ibl').setup { | ||
scope = { | ||
show_start = false, -- do not underline first line of scope | ||
show_end = false, -- do not underline last line of scope | ||
}, | ||
} |
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,46 @@ | ||
require('leap').add_default_mappings() | ||
|
||
-- grey out search area | ||
-- vim.api.nvim_set_hl(0, 'LeapBackdrop', { link = 'Comment' }) | ||
|
||
local function get_line_starts(winid) | ||
local wininfo = vim.fn.getwininfo(winid)[1] | ||
local cur_line = vim.fn.line('.') | ||
|
||
-- Get targets. | ||
local targets = {} | ||
local lnum = wininfo.topline | ||
while lnum <= wininfo.botline do | ||
local fold_end = vim.fn.foldclosedend(lnum) | ||
-- Skip folded ranges. | ||
if fold_end ~= -1 then | ||
lnum = fold_end + 1 | ||
else | ||
if lnum ~= cur_line then table.insert(targets, { pos = { lnum, 1 } }) end | ||
lnum = lnum + 1 | ||
end | ||
end | ||
-- Sort them by vertical screen distance from cursor. | ||
local cur_screen_row = vim.fn.screenpos(winid, cur_line, 1)['row'] | ||
local function screen_rows_from_cur(t) | ||
local t_screen_row = vim.fn.screenpos(winid, t.pos[1], t.pos[2])['row'] | ||
return math.abs(cur_screen_row - t_screen_row) | ||
end | ||
table.sort(targets, function (t1, t2) | ||
return screen_rows_from_cur(t1) < screen_rows_from_cur(t2) | ||
end) | ||
|
||
if #targets >= 1 then | ||
return targets | ||
end | ||
end | ||
|
||
-- <leader>l = go line | ||
vim.keymap.set('n', '<leader>l', function() | ||
local winid = vim.api.nvim_get_current_win() | ||
require('leap').leap { | ||
target_windows = { winid }, | ||
targets = get_line_starts(winid), | ||
} | ||
vim.api.nvim_input('^') | ||
end, { desc = 'Leap to line start (non-blank character)' }) |
Oops, something went wrong.