Compare commits
6 Commits
538421c8ac
...
853bdc6306
Author | SHA1 | Date |
---|---|---|
hedy | 853bdc6306 | |
hedy | e271136459 | |
hedy | e7b0580631 | |
hedy | 3b09cef08f | |
hedy | a85cb6d753 | |
hedy | 430c6fc09f |
|
@ -1101,6 +1101,7 @@ Configuration below enables tree-sitter mode for each major language mode I want
|
|||
#+BEGIN_SRC elisp
|
||||
;; Open python files in tree-sitter mode.
|
||||
(add-to-list 'major-mode-remap-alist '(python-mode . python-ts-mode))
|
||||
(add-to-list 'major-mode-remap-alist '(c++-mode . c++-ts-mode))
|
||||
(add-to-list 'auto-mode-alist
|
||||
'("\\.go\\'" . (lambda ()
|
||||
(go-ts-mode)
|
||||
|
|
|
@ -27,6 +27,7 @@ inactive_tab_font_style normal
|
|||
# make use of these mappings in the specific TUIs instead.
|
||||
map ctrl+tab no_op
|
||||
map ctrl+shift+tab no_op
|
||||
map ctrl+shift+r no_op
|
||||
|
||||
# Source this last so it can override any settings above
|
||||
include local.conf
|
||||
|
|
|
@ -7,6 +7,10 @@ o.number = true
|
|||
o.relativenumber = true
|
||||
|
||||
o.mouse = "a"
|
||||
o.selectmode = "mouse" -- Use select mode when dragging with mouse
|
||||
-- Changes to default:
|
||||
-- - Use vertical in all of command mode
|
||||
o.guicursor = "n-v-sm:block,i-ci-ve-c:ver25,r-cr-o:hor20"
|
||||
|
||||
-- o.cursorline = true
|
||||
-- Cursor line is rather distracting when trying to focus on the code.
|
||||
|
@ -28,6 +32,7 @@ o.scrolloff = 6 -- screen lines to keep above and below cursor
|
|||
o.sidescrolloff = 8 -- screen columns to keep on left and right of cursor
|
||||
o.confirm = true
|
||||
o.showmatch = true
|
||||
o.showmode = false -- Don't show messages when switching modes
|
||||
|
||||
o.encoding = "utf-8"
|
||||
o.mat = 2
|
||||
|
@ -46,7 +51,8 @@ o.shiftwidth = 4 -- Put or remove 4 spaces with using < and >
|
|||
o.smarttab = true -- Delete spaces at tabstop width
|
||||
o.copyindent = true -- Copy indentation from previous line
|
||||
o.hidden = true -- Allows switching to another file while current is unsaved.
|
||||
o.cmdheight = 1
|
||||
o.cmdheight = 0
|
||||
o.laststatus = 0
|
||||
|
||||
-- Show LSP W/E hints on another column next to the line numbers
|
||||
o.signcolumn = "yes" -- Set to "number" will merge the LSP W/E hints with the number col
|
||||
|
@ -74,4 +80,6 @@ o.wildignore = { "*.o", "*~", "*.pyc", "*/.git/*", "*/.hg/*", "*/.svn/*", "*/.DS
|
|||
|
||||
-- Not too noisy visually, but visible enough as a reminder.
|
||||
-- Underlines trailing spaces.
|
||||
vim.cmd [[ match Underlined '\s\+$' ]]
|
||||
-- vim.cmd [[ match Underlined '\s\+$' ]]
|
||||
--
|
||||
-- mini.trailspace FTW
|
||||
|
|
|
@ -40,7 +40,7 @@ require("lazy").setup("plugin_spec", {
|
|||
loaded = "●",
|
||||
not_loaded = "○",
|
||||
plugin = " ",
|
||||
runtime = " ",
|
||||
runtime = "",
|
||||
require = " ",
|
||||
source = " ",
|
||||
start = "",
|
||||
|
|
|
@ -102,48 +102,21 @@ return {
|
|||
fold_closed = "", -- icon used for closed folds
|
||||
},
|
||||
},
|
||||
{ "simrat39/symbols-outline.nvim",
|
||||
{ dir = "~/projects/symbols-outline.nvim",
|
||||
-- Switched to this from tagbar because it does not require exctags, and it
|
||||
-- lists the items in order as defined in source code.
|
||||
enabled = vim.fn.has("nvim-0.7") == 1,
|
||||
cmd = "SymbolsOutline",
|
||||
keys = { "<leader>tt" },
|
||||
config = function()
|
||||
vim.keymap.set("n", "<leader>tt", "<cmd>SymbolsOutline<CR>",
|
||||
{ desc = "SymbolsOutline" })
|
||||
require("symbols-outline").setup {
|
||||
symbols = {
|
||||
File = { icon = "", hl = "@text.uri" },
|
||||
Module = { icon = "M", hl = "@namespace" },
|
||||
Namespace = { icon = "N", hl = "@namespace" },
|
||||
Package = { icon = "", hl = "@namespace" },
|
||||
Class = { icon = "c", hl = "@type" },
|
||||
Method = { icon = "m", hl = "@method" },
|
||||
Property = { icon = "", hl = "@method" },
|
||||
Field = { icon = "F", hl = "@field" },
|
||||
Constructor = { icon = "", hl = "@constructor" },
|
||||
Enum = { icon = "ℰ", hl = "@type" },
|
||||
Interface = { icon = "I", hl = "@type" },
|
||||
Function = { icon = "", hl = "@function" },
|
||||
Variable = { icon = "α", hl = "@constant" },
|
||||
Constant = { icon = "", hl = "@constant" },
|
||||
String = { icon = "\"", hl = "@string" },
|
||||
Number = { icon = "#", hl = "@number" },
|
||||
Boolean = { icon = "", hl = "@boolean" },
|
||||
Array = { icon = "A", hl = "@constant" },
|
||||
Object = { icon = "⦿", hl = "@type" },
|
||||
Key = { icon = "🔐", hl = "@type" },
|
||||
Null = { icon = "NULL", hl = "@type" },
|
||||
EnumMember = { icon = "", hl = "@field" },
|
||||
Struct = { icon = "𝓢", hl = "@type" },
|
||||
Event = { icon = "", hl = "@type" },
|
||||
Operator = { icon = "+", hl = "@operator" },
|
||||
TypeParameter = { icon = "𝙏", hl = "@parameter" },
|
||||
Component = { icon = "C", hl = "@function" },
|
||||
Fragment = { icon = "g", hl = "@constant" },
|
||||
},
|
||||
}
|
||||
end,
|
||||
cmd = { "SymbolsOutline", "SymbolsOutlineOpen" },
|
||||
keys = {
|
||||
{ "<leader>tt", "<cmd>SymbolsOutline<CR>", desc = "Toggle outline window" }
|
||||
},
|
||||
opts = {
|
||||
-- focus_on_open = false,
|
||||
open_hover_on_preview = false,
|
||||
keymaps = {
|
||||
close = "q",
|
||||
},
|
||||
},
|
||||
},
|
||||
-- "bling/vim-bufferline", -- I prefer this over taking over the tabline space thanks
|
||||
-- Fair well vim-bufferline! You have served my vim and nvim experience well.
|
||||
|
@ -178,7 +151,10 @@ return {
|
|||
config = true
|
||||
},
|
||||
{ 'nvim-telescope/telescope.nvim', tag = '0.1.4',
|
||||
dependencies = { 'nvim-lua/plenary.nvim' },
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
{ 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' },
|
||||
},
|
||||
enabled = vim.fn.has("nvim-0.9") == 1,
|
||||
config = function() require('plugins/telescope') end,
|
||||
},
|
||||
|
@ -246,13 +222,45 @@ return {
|
|||
silent = false,
|
||||
},
|
||||
},
|
||||
{ "echasnovski/mini.splitjoin",
|
||||
opts = {
|
||||
mappings = { -- both n/v modes
|
||||
toggle = 'gS',
|
||||
split = '',
|
||||
join = '',
|
||||
},
|
||||
detect = {
|
||||
-- Array of Lua patterns to detect region with arguments.
|
||||
-- Default: { '%b()', '%b[]', '%b{}' }
|
||||
brackets = nil,
|
||||
-- String Lua pattern defining argument separator
|
||||
separator = ',',
|
||||
-- Array of Lua patterns for sub-regions to exclude separators from.
|
||||
-- Enables correct detection in presence of nested brackets and quotes.
|
||||
-- Default: { '%b()', '%b[]', '%b{}', '%b""', "%b''" }
|
||||
exclude_regions = nil,
|
||||
},
|
||||
-- Split options
|
||||
split = {
|
||||
hooks_pre = {},
|
||||
hooks_post = {},
|
||||
},
|
||||
-- Join options
|
||||
join = {
|
||||
hooks_pre = {},
|
||||
hooks_post = {},
|
||||
},
|
||||
}
|
||||
},
|
||||
{ "echasnovski/mini.trailspace",
|
||||
config = true,
|
||||
},
|
||||
{ "lukas-reineke/indent-blankline.nvim",
|
||||
-- https://github.com/lukas-reineke/indent-blankline.nvim/wiki/Migrate-to-version-3
|
||||
-- Not documented but it appears new version requires nvim nightly.
|
||||
-- Upgraded to nvim 0.9.4 and the new version worked with showing context
|
||||
-- without needing treesitter! 🎉
|
||||
main = vim.fn.has("nvim-0.9") == 1 and "ibl",
|
||||
-- Use the 2 lines below if the nvim version is not supported
|
||||
version = vim.fn.has("nvim-0.9") == 0 and "2.20.8",
|
||||
pin = vim.fn.has("nvim-0.9") == 0,
|
||||
opts = {
|
||||
|
@ -356,7 +364,7 @@ return {
|
|||
close_timeout = 4000,
|
||||
fix_pos = false, -- don't auto-close the floating window all parameters finished
|
||||
hint_enable = true, -- virtual hint
|
||||
hint_prefix = ": ",
|
||||
hint_prefix = " ",
|
||||
hint_scheme = "String",
|
||||
hint_inline = function() return vim.fn.has('nvim-0.10') == 1 end,
|
||||
hi_parameter = "LspSignatureActiveParameter",
|
||||
|
@ -465,13 +473,39 @@ return {
|
|||
require("neorg").setup {
|
||||
load = {
|
||||
["core.defaults"] = {}, -- Loads default behaviour
|
||||
["core.concealer"] = {}, -- Adds pretty icons to your documents
|
||||
["core.concealer"] = {
|
||||
config = {
|
||||
folds = true,
|
||||
}
|
||||
},
|
||||
["core.dirman"] = { -- Manages Neorg workspaces
|
||||
config = {
|
||||
workspaces = { neorg = "~/neorg" },
|
||||
default_workspace = "neorg"
|
||||
},
|
||||
},
|
||||
["core.completion"] = {
|
||||
config = {
|
||||
engine = "nvim-cmp",
|
||||
name = " "
|
||||
},
|
||||
},
|
||||
["core.highlights"] = {
|
||||
config = {
|
||||
highlights = {
|
||||
tags = {
|
||||
ranged_verbatim = {
|
||||
parameters = "guifg=#9ca3af",
|
||||
begin = "guifg=#9ca3af",
|
||||
["end"] = "guifg=#9ca3af",
|
||||
name = {
|
||||
word = "guifg=#9ca3af",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
end,
|
||||
|
@ -572,4 +606,14 @@ return {
|
|||
}
|
||||
},
|
||||
"folke/neodev.nvim",
|
||||
-- TODO: check nvim version
|
||||
{ "mfussenegger/nvim-dap",
|
||||
config = function() require("plugins/dap") end,
|
||||
},
|
||||
{ "theHamsta/nvim-dap-virtual-text",
|
||||
dependencies = {"mfussenegger/nvim-dap"},
|
||||
},
|
||||
{ "rcarriga/nvim-dap-ui",
|
||||
dependencies = {"mfussenegger/nvim-dap"},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -148,6 +148,7 @@ require('competitest').setup {
|
|||
compile_directory = ".",
|
||||
compile_command = {
|
||||
c = { exec = "gcc", args = { "-Wall", "$(FNAME)", "-o", "$(FNOEXT).out" } },
|
||||
-- cpp = { exec = "clang++", args = { "-Wall", "$(FNAME)", "-o", "$(FNOEXT).out", "--include-directory=/opt/homebrew/Cellar/gcc/13.2.0/include/c++/13/aarch64-apple-darwin22" } },
|
||||
cpp = { exec = "g++", args = { "-Wall", "$(FNAME)", "-o", "$(FNOEXT).out" } },
|
||||
rust = { exec = "rustc", args = { "$(FNAME)" } },
|
||||
java = { exec = "javac", args = { "$(FNAME)" } },
|
||||
|
|
|
@ -114,6 +114,7 @@ cmp.setup({
|
|||
{ name = "latex_symbols" },
|
||||
{ name = 'path' },
|
||||
-- { name = 'calc' },
|
||||
{ name = 'neorg' },
|
||||
}),
|
||||
})
|
||||
|
||||
|
@ -139,6 +140,18 @@ cmp.setup.filetype('fish', {
|
|||
{ name = 'path' },
|
||||
})
|
||||
})
|
||||
cmp.setup.filetype('norg', {
|
||||
sources = cmp.config.sources({
|
||||
{ name = 'neorg' },
|
||||
}, {
|
||||
-- { name = 'buffer' },
|
||||
-- { name = 'calc' },
|
||||
{ name = 'emoji' },
|
||||
{ name = "latex_symbols" },
|
||||
-- { name = 'path' },
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
-- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't
|
||||
-- work anymore).
|
||||
|
|
|
@ -0,0 +1,81 @@
|
|||
local dap = require('dap')
|
||||
dap.adapters.python = function(cb, config)
|
||||
if config.request == 'attach' then
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local port = (config.connect or config).port
|
||||
---@diagnostic disable-next-line: undefined-field
|
||||
local host = (config.connect or config).host or '127.0.0.1'
|
||||
cb({
|
||||
type = 'server',
|
||||
port = assert(port, '`connect.port` is required for a python `attach` configuration'),
|
||||
host = host,
|
||||
options = {
|
||||
source_filetype = 'python',
|
||||
},
|
||||
})
|
||||
else
|
||||
cb({
|
||||
type = 'executable',
|
||||
command = '/Users/hedy/.config/nvim/.virtualenvs/debugpy/bin/python',
|
||||
args = { '-m', 'debugpy.adapter' },
|
||||
options = {
|
||||
source_filetype = 'python',
|
||||
},
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
dap.configurations.python = {
|
||||
{
|
||||
-- The first three options are required by nvim-dap
|
||||
type = 'python'; -- the type here established the link to the adapter definition: `dap.adapters.python`
|
||||
request = 'launch';
|
||||
name = "Launch file";
|
||||
|
||||
-- Options below are for debugpy, see https://github.com/microsoft/debugpy/wiki/Debug-configuration-settings for supported options
|
||||
|
||||
program = "${file}"; -- This configuration will launch the current file if used.
|
||||
pythonPath = function()
|
||||
-- debugpy supports launching an application with a different interpreter then the one used to launch debugpy itself.
|
||||
-- The code below looks for a `venv` or `.venv` folder in the current directly and uses the python within.
|
||||
-- You could adapt this - to for example use the `VIRTUAL_ENV` environment variable.
|
||||
local cwd = vim.fn.getcwd()
|
||||
if vim.fn.executable(cwd .. '/venv/bin/python') == 1 then
|
||||
return cwd .. '/venv/bin/python'
|
||||
elseif vim.fn.executable(cwd .. '/.venv/bin/python') == 1 then
|
||||
return cwd .. '/.venv/bin/python'
|
||||
else
|
||||
return '/usr/bin/python3'
|
||||
end
|
||||
end;
|
||||
},
|
||||
}
|
||||
|
||||
require("nvim-dap-virtual-text").setup({})
|
||||
|
||||
local dapui = require("dapui")
|
||||
dapui.setup({})
|
||||
|
||||
dap.listeners.after.event_initialized["dapui_config"] = function()
|
||||
dapui.open()
|
||||
end
|
||||
dap.listeners.before.event_terminated["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
dap.listeners.before.event_exited["dapui_config"] = function()
|
||||
dapui.close()
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command(
|
||||
'DuiToggle',
|
||||
function(opts)
|
||||
local a = nil
|
||||
if opts and #opts.args > 0 then
|
||||
a = opts.args[1]
|
||||
end
|
||||
require("dapui").toggle(a)
|
||||
end,
|
||||
{
|
||||
nargs = '?',
|
||||
complete = function() return {'sidebar', 'tray'} end,
|
||||
})
|
|
@ -4,37 +4,37 @@
|
|||
|
||||
-- https://github.com/nvim-tree/nvim-web-devicons
|
||||
require'nvim-web-devicons'.setup {
|
||||
-- your personnal icons can go here (to override)
|
||||
-- you can specify color or cterm_color instead of specifying both of them
|
||||
-- DevIcon will be appended to `name`
|
||||
--
|
||||
-- globally enable different highlight colors per icon (default to true)
|
||||
-- if set to false all icons will have the default icon's color
|
||||
color_icons = true;
|
||||
-- globally enable default icons (default to false)
|
||||
-- will get overriden by `get_icons` option
|
||||
-- default = true;
|
||||
-- globally enable "strict" selection of icons - icon will be looked up in
|
||||
-- different tables, first by filename, and if not found by extension; this
|
||||
-- prevents cases when file doesn't have any extension but still gets some icon
|
||||
-- because its name happened to match some extension (default to false)
|
||||
strict = true;
|
||||
-- same as `override` but specifically for overrides by filename
|
||||
-- takes effect when `strict` is true
|
||||
override_by_filename = {
|
||||
[".gitignore"] = {
|
||||
icon = "",
|
||||
color = "#f1502f", -- Add the color so it's readable
|
||||
name = "Gitignore"
|
||||
}
|
||||
};
|
||||
-- same as `override` but specifically for overrides by extension
|
||||
-- takes effect when `strict` is true
|
||||
-- override_by_extension = {
|
||||
-- ["log"] = {
|
||||
-- icon = "",
|
||||
-- color = "#81e043",
|
||||
-- name = "Log"
|
||||
-- }
|
||||
-- };
|
||||
-- your personnal icons can go here (to override)
|
||||
-- you can specify color or cterm_color instead of specifying both of them
|
||||
-- DevIcon will be appended to `name`
|
||||
--
|
||||
-- globally enable different highlight colors per icon (default to true)
|
||||
-- if set to false all icons will have the default icon's color
|
||||
color_icons = true;
|
||||
-- globally enable default icons (default to false)
|
||||
-- will get overriden by `get_icons` option
|
||||
-- default = true;
|
||||
-- globally enable "strict" selection of icons - icon will be looked up in
|
||||
-- different tables, first by filename, and if not found by extension; this
|
||||
-- prevents cases when file doesn't have any extension but still gets some icon
|
||||
-- because its name happened to match some extension (default to false)
|
||||
strict = true;
|
||||
-- same as `override` but specifically for overrides by filename
|
||||
-- takes effect when `strict` is true
|
||||
override_by_filename = {
|
||||
[".gitignore"] = {
|
||||
icon = "",
|
||||
color = "#f1502f",
|
||||
name = "Gitignore",
|
||||
},
|
||||
};
|
||||
-- same as `override` but specifically for overrides by extension
|
||||
-- takes effect when `strict` is true
|
||||
override_by_extension = {
|
||||
["norg"] = {
|
||||
icon = "",
|
||||
color = "#71a6e2",
|
||||
name = "norg",
|
||||
}
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,14 +1,38 @@
|
|||
--- Helpers for status line components ---
|
||||
local function lineinfo()
|
||||
-- return " "
|
||||
local total = tostring(vim.fn.line('$'))
|
||||
-- Left pad the current line count to max width of this value, to avoid jittering
|
||||
return string.format("%"..total:len().."d", vim.fn.line('.'))..'/'..total
|
||||
-- local function lineinfo()
|
||||
-- local total = tostring(vim.fn.line('$'))
|
||||
-- -- Left pad the current line count to max width of this value, to avoid jittering
|
||||
-- return string.format("%"..total:len().."d", vim.fn.line('.'))..'/'..total
|
||||
-- end
|
||||
|
||||
local function mode_fmt(str)
|
||||
if str == "NORMAL" then
|
||||
return "./"
|
||||
elseif str == "INSERT" then
|
||||
return "i "
|
||||
elseif str == "COMMAND" then
|
||||
return ":>"
|
||||
elseif str == "VISUAL" then
|
||||
return "v "
|
||||
elseif str == "V-BLOCK" then
|
||||
return "^v"
|
||||
elseif str == "V-LINE" then
|
||||
return "VL"
|
||||
elseif str == "TERMINAL" then
|
||||
return ":D"
|
||||
elseif str == "REPLACE" then
|
||||
return "R "
|
||||
elseif str == "SUBSTITUTE" then
|
||||
return "SB"
|
||||
elseif str == "SELECT" then
|
||||
return "SL"
|
||||
end
|
||||
return str
|
||||
end
|
||||
|
||||
local diagnostics_config = {
|
||||
'diagnostics',
|
||||
symbols = {error = 'E:', warn = 'W:', info = 'I:', hint = 'H:'},
|
||||
symbols = {error = '', warn = '', info = 'I:', hint = 'H:'},
|
||||
}
|
||||
|
||||
local competitest_line = {
|
||||
|
@ -50,9 +74,15 @@ local tundra_lualine = {
|
|||
a = { fg = cp.indigo._500, bg = cp.gray._600, gui = 'bold' },
|
||||
b = { fg = cp.gray._600, bg = cp.transparent, gui = 'bold' },
|
||||
},
|
||||
|
||||
-- visual_select = {
|
||||
-- a = { fg = cp.gray._200, bg = cp.sand._500, gui = 'bold' },
|
||||
-- b = { fg = cp.gray._600, bg = cp.transparent, gui = 'bold' },
|
||||
-- },
|
||||
}
|
||||
|
||||
require('lualine').setup {
|
||||
local lualine = require('lualine')
|
||||
lualine.setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
-- theme = 'auto',
|
||||
|
@ -73,28 +103,17 @@ require('lualine').setup {
|
|||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {{ 'mode', fmt = function(str)
|
||||
if str == "NORMAL" then
|
||||
return "./"
|
||||
elseif str == "INSERT" then
|
||||
return "i "
|
||||
elseif str == "COMMAND" then
|
||||
return ":>"
|
||||
elseif str == "VISUAL" then
|
||||
return "v "
|
||||
elseif str == "V-BLOCK" then
|
||||
return "^v"
|
||||
elseif str == "V-LINE" then
|
||||
return "VL"
|
||||
elseif str == "TERMINAL" then
|
||||
return ":D"
|
||||
elseif str == "REPLACE" then
|
||||
return "R "
|
||||
elseif str == "SUBSTITUTE" then
|
||||
return "S?"
|
||||
end
|
||||
return str
|
||||
end }},
|
||||
},
|
||||
inactive_sections = {
|
||||
-- lualine_a = {},
|
||||
-- lualine_b = {'branch', 'diff'},
|
||||
-- lualine_c = {'filename'},
|
||||
-- lualine_x = { diagnostics_config },
|
||||
-- lualine_y = {'searchcount'},
|
||||
-- lualine_z = {},
|
||||
},
|
||||
tabline = {
|
||||
lualine_a = {{ 'mode', fmt = mode_fmt }},
|
||||
lualine_b = {},
|
||||
lualine_c = {
|
||||
{ 'buffers',
|
||||
|
@ -116,36 +135,18 @@ require('lualine').setup {
|
|||
icons_enabled = true,
|
||||
-- symbols = { unix = 'LF', dos = 'CRLF', mac = 'CR', },
|
||||
}, 'filetype'},
|
||||
lualine_y = {diagnostics_config},
|
||||
lualine_z = {lineinfo},
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {'branch', 'diff'},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = { diagnostics_config },
|
||||
lualine_y = {'searchcount'},
|
||||
lualine_z = {lineinfo},
|
||||
},
|
||||
tabline = {
|
||||
-- lualine_a = {},
|
||||
-- lualine_b = {},
|
||||
-- lualine_c = {breadcrumb},
|
||||
-- lualine_x = {},
|
||||
-- lualine_y = {},
|
||||
-- lualine_z = {{
|
||||
-- 'tabs',
|
||||
-- mode = 2,
|
||||
-- show_modified_status = false,
|
||||
-- tabs_color = {
|
||||
-- active = "lualine_a_active",
|
||||
-- inactive = "lualine_a_inactive",
|
||||
-- }
|
||||
-- }},
|
||||
},
|
||||
winbar = {
|
||||
lualine_z = {diagnostics_config},
|
||||
},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {'nvim-tree', competitest_line, 'symbols-outline'},
|
||||
}
|
||||
|
||||
-- local map = function(...) vim.keymap.set(...) end
|
||||
-- local d = function(s) return { desc = s } end
|
||||
|
||||
-- map(
|
||||
-- "n", "<leader>mm",
|
||||
-- function() lualine.hide({ places = "statusline", unhide }) end
|
||||
-- )
|
||||
|
|
|
@ -8,30 +8,98 @@ map("n", "<leader>fb", "<cmd>Telescope buffers<cr>", d"Telescope buffers")
|
|||
map("n", "<leader>fh", "<cmd>Telescope help_tags<cr>", d"Telescope help_tags")
|
||||
map("n", "<leader>fR", "<cmd>Telescope registers<cr>", d"Telescope registers (also see <leader>rg)")
|
||||
|
||||
-- Go to dir of selected entry
|
||||
local goto_dir = function(prompt_bufnr)
|
||||
local selection = require("telescope.actions.state").get_selected_entry()
|
||||
if selection == nil then
|
||||
print("No selection!")
|
||||
return
|
||||
end
|
||||
local dir = vim.fn.fnamemodify(selection.path, ":p:h")
|
||||
require("telescope.actions").close(prompt_bufnr)
|
||||
local cmd = string.format("silent lcd %s", dir)
|
||||
vim.cmd(cmd)
|
||||
print(cmd)
|
||||
end
|
||||
|
||||
-- Open picker again but now in parent dir.
|
||||
-- Set noshowmode to prevent printed messages from being buried by "--INSERT--"
|
||||
local reprompt_from_parent_dir = function(picker, prompt_bufnr)
|
||||
-- local selection = require("telescope.actions.state").get_selected_entry()
|
||||
-- if selection == nil then
|
||||
-- print("No selection!")
|
||||
-- return
|
||||
-- end
|
||||
-- local dir = vim.fn.fnamemodify(selection.path, ":s?/.*$??:p:h:h")
|
||||
-- Let selection.path = ".config/nvim/init.lua"
|
||||
-- PWD = ~/.config/
|
||||
-- What fnamemodify does:
|
||||
-- Result After operation
|
||||
-- ------ ---------------
|
||||
-- "nvim/init.lua"
|
||||
-- "nvim" :s?/.*$??
|
||||
-- "/home/user/.config/nvim" :p
|
||||
-- "/home/user/.config" :h
|
||||
-- "/home/user" :h
|
||||
-- Hence it changes cwd of picker from ~/.config/ to ~/
|
||||
require("telescope.actions").close(prompt_bufnr)
|
||||
vim.cmd("cd ..")
|
||||
require("telescope.builtin")[picker]()
|
||||
print("Using "..vim.fn.getcwd())
|
||||
end
|
||||
|
||||
-- Open picker again but now in git root if available.
|
||||
-- Set noshowmode to prevent printed messages from being buried by "--INSERT--"
|
||||
local reprompt_from_git_root = function(picker, prompt_bufnr)
|
||||
vim.fn.system({"git", "rev-parse", "--is-inside-work-tree"})
|
||||
if vim.v.shell_error == 0 then
|
||||
local opts = {
|
||||
cwd = vim.fn.fnamemodify(vim.fn.finddir(".git", ".;"), ":h"),
|
||||
}
|
||||
require("telescope.actions").close(prompt_bufnr)
|
||||
require("telescope.builtin")[picker](opts)
|
||||
print("Using "..opts.cwd)
|
||||
else
|
||||
print("Failed to find git root")
|
||||
end
|
||||
end
|
||||
|
||||
require('telescope').setup({
|
||||
defaults = {
|
||||
layout_config = {
|
||||
-- layout_config = {
|
||||
-- vertical = { width = 0.3 },
|
||||
horizontal = { width = 0.5 },
|
||||
},
|
||||
preview = {
|
||||
filesize_limit = 0.1, -- MB
|
||||
-- horizontal = { width = 0.5 },
|
||||
-- },
|
||||
-- preview = {
|
||||
-- filesize_limit = 0.1, -- MB
|
||||
-- },
|
||||
-- theme = "dropdown",
|
||||
mappings = {
|
||||
n = {
|
||||
["cd"] = goto_dir,
|
||||
},
|
||||
i = {
|
||||
["<C-g>"] = "close",
|
||||
},
|
||||
},
|
||||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
theme = "dropdown",
|
||||
mappings = {
|
||||
n = {
|
||||
["<C-d>"] = function(...) return reprompt_from_parent_dir("find_files", ...) end,
|
||||
["<C-S-r>"] = function(...) return reprompt_from_git_root("find_files", ...) end,
|
||||
},
|
||||
},
|
||||
},
|
||||
live_grep = {
|
||||
mappings = {
|
||||
n = {
|
||||
["<C-d>"] = function(...) return reprompt_from_parent_dir("live_grep", ...) end,
|
||||
["<C-S-r>"] = function(...) return reprompt_from_git_root("live_grep", ...) end,
|
||||
},
|
||||
},
|
||||
},
|
||||
mappings = {
|
||||
n = {
|
||||
["<C-d>"] = function(prompt_bufnr)
|
||||
local selection = require("telescope.actions.state").get_selected_entry()
|
||||
local dir = vim.fn.fnamemodify(selection.path, ":p:h")
|
||||
require("telescope.actions").close(prompt_bufnr)
|
||||
-- Depending on what you want put `cd`, `lcd`, `tcd`
|
||||
vim.cmd(string.format("silent lcd %s", dir))
|
||||
end
|
||||
}
|
||||
}
|
||||
},
|
||||
})
|
||||
require('telescope').load_extension('fzf')
|
||||
|
|
|
@ -39,18 +39,21 @@ configs.setup({
|
|||
|
||||
-- TS context
|
||||
require("treesitter-context").setup {
|
||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||
max_lines = 0, -- How many lines the window should span. Values <= 0 mean no limit.
|
||||
min_window_height = 0, -- Minimum editor window height to enable context. Values <= 0 mean no limit.
|
||||
enable = true,
|
||||
max_lines = 5,
|
||||
min_window_height = 20,
|
||||
line_numbers = true,
|
||||
multiline_threshold = 20, -- Maximum number of lines to show for a single context
|
||||
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
||||
mode = 'topline', -- Line used to calculate context. Choices: 'cursor', 'topline'
|
||||
-- Separator between context and content. Should be a single character string, like '-'.
|
||||
-- When separator is set, the context will only show up when there are at least 2 lines above cursorline.
|
||||
-- Maximum number of lines to show for a single context
|
||||
multiline_threshold = 5,
|
||||
-- Which context lines to discard if `max_lines` is exceeded. inner/outer
|
||||
trim_scope = 'outer',
|
||||
mode = 'cursor', -- Line used to calculate context: cursor/topline
|
||||
-- Separator between context and content. Should be a single character
|
||||
-- string, like '-'. When separator is set, the context will only show up
|
||||
-- when there are at least 2 lines above cursorline.
|
||||
separator = nil,
|
||||
zindex = 20, -- The Z-index of the context window
|
||||
on_attach = nil, -- (fun(buf: integer): boolean) return false to disable attaching
|
||||
on_attach = nil, -- (fun(buf: integer): boolean)
|
||||
}
|
||||
|
||||
--- TS textobjects ---
|
||||
|
|
|
@ -11,19 +11,19 @@ s.bg.cursorline = s.cp.gray._700
|
|||
|
||||
require("nvim-tundra").setup {
|
||||
transparent_background = false,
|
||||
dim_inactive_windows = { enabled = true, color = nil, },
|
||||
sidebars = { enabled = true, color = nil, },
|
||||
dim_inactive_windows = { enabled = true },
|
||||
sidebars = { enabled = true },
|
||||
editor = { search = {}, substitute = {}, },
|
||||
syntax = {
|
||||
booleans = { bold = true, italic = true },
|
||||
comments = { bold = false, italic = false },
|
||||
booleans = {},
|
||||
comments = {},
|
||||
conditionals = {},
|
||||
constants = { bold = true },
|
||||
fields = {},
|
||||
functions = {},
|
||||
keywords = {},
|
||||
loops = {},
|
||||
numbers = { bold = true },
|
||||
numbers = {},
|
||||
operators = { bold = true },
|
||||
punctuation = {},
|
||||
strings = {},
|
||||
|
|
|
@ -0,0 +1,84 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
set -e
|
||||
|
||||
if [[ -z "$3" ]]; then
|
||||
echo "Usage: git pullpr <orguser/repo> <user:branch>[/repo] <prnumber>"
|
||||
echo
|
||||
echo " Merge an arbitrary GitHub PR from some arbitrary repo with an"
|
||||
echo " automated merge message mentioning that PR."
|
||||
echo
|
||||
echo " Make sure you're already in the correct git repo."
|
||||
echo
|
||||
echo "Options:"
|
||||
echo " None."
|
||||
echo
|
||||
echo "Example:"
|
||||
echo " > git pullpr main-repo-user/main-repo pr-user:pr-branch/pr-user-repo 123"
|
||||
echo
|
||||
echo " Merges PR #123 from main-repo-user/main-repo, which is written"
|
||||
echo " by pr-user on their pr-user-repo, on pr-branch."
|
||||
echo
|
||||
echo " The merge message will be:"
|
||||
echo
|
||||
echo " > Merge upstream PR #123"
|
||||
echo " >"
|
||||
echo " > main-repo-user/main-repo#123"
|
||||
echo
|
||||
echo " pr-user-repo can be omitted, in which case it will be assumed"
|
||||
echo " to be the same as main-repo name."
|
||||
echo
|
||||
echo "So to merge multiple PRs from the same repo you only need to change"
|
||||
echo "the last two arguments."
|
||||
exit
|
||||
fi
|
||||
|
||||
|
||||
userbranch="$2"
|
||||
|
||||
if [[ "$2" =~ "/" ]]; then
|
||||
prrepo=$(echo "$2" | sed "s_.*/__")
|
||||
userbranch=$(echo "$2" | sed "s_/.*__")
|
||||
fi
|
||||
|
||||
user=$(echo "$userbranch" | sed "s/:.*//")
|
||||
branch=$(echo "$userbranch" | sed "s/.*://")
|
||||
orguser=$(echo "$1" | sed "s_/.*__")
|
||||
repo=$(echo "$1" | sed "s_.*/__")
|
||||
prnumber="$3"
|
||||
|
||||
if [[ -z "$prrepo" ]]; then
|
||||
prrepo="$repo"
|
||||
fi
|
||||
|
||||
echo "PR: $user/$prrepo on $branch, PR #$prnumber"
|
||||
echo "Upstream: $orguser/$repo"
|
||||
echo -n "Press enter to continue..."
|
||||
read
|
||||
|
||||
git remote add "$user" git@github.com:"$user"/"$prrepo"
|
||||
echo "Added remote $user"\n
|
||||
echo "Fetching"
|
||||
git fetch "$user" "$branch"
|
||||
|
||||
echo
|
||||
echo "Merge:"
|
||||
echo " git merge $user/$branch -m \"Merge upstream PR $prnumber\" -m \"\" -m \"$orguser/$repo#$prnumber\""
|
||||
echo
|
||||
echo -n "Press enter to continue..."
|
||||
read
|
||||
|
||||
git merge $user/$branch -m "Merge upstream PR #$prnumber" -m "" -m "$orguser/$repo#$prnumber"
|
||||
|
||||
echo
|
||||
echo "Merge complete."
|
||||
git log -n1
|
||||
echo
|
||||
echo "Remove remote:"
|
||||
echo " git remote remove $user"
|
||||
echo
|
||||
echo -n "Press enter to continue..."
|
||||
read
|
||||
git remote remove $user
|
||||
echo "Remote removed."
|
||||
git remote -v
|
Loading…
Reference in New Issue