Many updates
This commit is contained in:
@@ -1,12 +0,0 @@
|
||||
local default_color = "sonokai"
|
||||
|
||||
function ColorMyTerminal(color)
|
||||
color = color or default_color
|
||||
vim.cmd.colorscheme(color)
|
||||
|
||||
vim.cmd("hi ColorColumn ctermbg=0 guibg=purple")
|
||||
vim.api.nvim_set_hl(0, "Normal", {bg = "none"})
|
||||
vim.api.nvim_set_hl(0, "NormalFloat", {bg = "none"})
|
||||
end
|
||||
|
||||
vim.cmd.colorscheme(default_color)
|
||||
@@ -1,105 +0,0 @@
|
||||
local dapui = require('dapui')
|
||||
local dap = require("dap")
|
||||
|
||||
-- DAP UI setup
|
||||
dapui.setup()
|
||||
|
||||
-- Basic DAP UI event listeners
|
||||
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
|
||||
|
||||
-- DAP for C
|
||||
|
||||
dap.adapters.gdb = {
|
||||
type = "executable",
|
||||
command = "gdb",
|
||||
args = { "--interpreter=dap", "--eval-command", "set print pretty on" }
|
||||
}
|
||||
|
||||
dap.adapters.lldb = {
|
||||
type = 'executable',
|
||||
command = 'lldb-dap',
|
||||
name = 'lldb'
|
||||
}
|
||||
|
||||
dap.configurations.c = {
|
||||
{
|
||||
name = "Launch",
|
||||
type = "gdb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
stopOnEntry = false,
|
||||
},
|
||||
{
|
||||
name = "Select and attach to process",
|
||||
type = "gdb",
|
||||
request = "attach",
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end,
|
||||
pid = function()
|
||||
local name = vim.fn.input('Executable name (filter): ')
|
||||
return require("dap.utils").pick_process({ filter = name })
|
||||
end,
|
||||
cwd = '${workspaceFolder}'
|
||||
},
|
||||
{
|
||||
name = 'Attach to process',
|
||||
type = 'gdb',
|
||||
request = 'attach',
|
||||
pid = function ()
|
||||
return vim.fn.input('Enter PID: ')
|
||||
end,
|
||||
args = {},
|
||||
},
|
||||
{
|
||||
name = 'Attach to gdbserver :1234',
|
||||
type = 'gdb',
|
||||
request = 'attach',
|
||||
target = 'localhost:1234',
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/', 'file')
|
||||
end,
|
||||
cwd = '${workspaceFolder}'
|
||||
},
|
||||
}
|
||||
|
||||
dap.configurations.zig = {
|
||||
{
|
||||
name = "Debug Zig Executable",
|
||||
type = "lldb",
|
||||
request = "launch",
|
||||
program = function()
|
||||
return vim.fn.input('Path to executable: ', vim.fn.getcwd() .. '/zig-out/bin/', 'file')
|
||||
end,
|
||||
cwd = "${workspaceFolder}",
|
||||
args = {},
|
||||
stopOnEntry = false,
|
||||
},
|
||||
{
|
||||
name = 'Attach to Zig Process',
|
||||
type = 'lldb',
|
||||
request = 'attach',
|
||||
pid = require('dap.ui.widgets').hover,
|
||||
args = {},
|
||||
}
|
||||
}
|
||||
|
||||
-- DAP Keybinds
|
||||
vim.keymap.set('n', '<F5>', function() dap.continue() end)
|
||||
vim.keymap.set('n', '<F10>', function() dap.step_over() end)
|
||||
vim.keymap.set('n', '<F11>', function() dap.step_into() end)
|
||||
vim.keymap.set('n', '<F12>', function() dap.step_out() end)
|
||||
vim.keymap.set('n', '<Leader>bp', function() dap.toggle_breakpoint() end)
|
||||
vim.keymap.set('n', '<Leader>dr', function() dap.repl.open() end)
|
||||
|
||||
@@ -1,221 +0,0 @@
|
||||
-- Eviline config for lualine
|
||||
-- Author: shadmansaleh
|
||||
-- Credit: glepnir
|
||||
local lualine = require('lualine')
|
||||
|
||||
-- Color table for highlights
|
||||
-- stylua: ignore
|
||||
local colors = {
|
||||
bg = '#202328',
|
||||
fg = '#bbc2cf',
|
||||
yellow = '#ECBE7B',
|
||||
cyan = '#008080',
|
||||
darkblue = '#081633',
|
||||
green = '#98be65',
|
||||
orange = '#FF8800',
|
||||
violet = '#a9a1e1',
|
||||
magenta = '#c678dd',
|
||||
blue = '#51afef',
|
||||
red = '#ec5f67',
|
||||
}
|
||||
|
||||
local conditions = {
|
||||
buffer_not_empty = function()
|
||||
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
|
||||
end,
|
||||
hide_in_width = function()
|
||||
return vim.fn.winwidth(0) > 80
|
||||
end,
|
||||
check_git_workspace = function()
|
||||
local filepath = vim.fn.expand('%:p:h')
|
||||
local gitdir = vim.fn.finddir('.git', filepath .. ';')
|
||||
return gitdir and #gitdir > 0 and #gitdir < #filepath
|
||||
end,
|
||||
}
|
||||
|
||||
-- Config
|
||||
local config = {
|
||||
options = {
|
||||
-- Disable sections and component separators
|
||||
component_separators = '',
|
||||
section_separators = '',
|
||||
theme = {
|
||||
-- We are going to use lualine_c an lualine_x as left and
|
||||
-- right section. Both are highlighted by c theme . So we
|
||||
-- are just setting default looks o statusline
|
||||
normal = { c = { fg = colors.fg, bg = colors.bg } },
|
||||
inactive = { c = { fg = colors.fg, bg = colors.bg } },
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
-- These will be filled later
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
},
|
||||
inactive_sections = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
},
|
||||
}
|
||||
|
||||
-- Inserts a component in lualine_c at left section
|
||||
local function ins_left(component)
|
||||
table.insert(config.sections.lualine_c, component)
|
||||
end
|
||||
|
||||
-- Inserts a component in lualine_x at right section
|
||||
local function ins_right(component)
|
||||
table.insert(config.sections.lualine_x, component)
|
||||
end
|
||||
|
||||
ins_left {
|
||||
function()
|
||||
return '▊'
|
||||
end,
|
||||
color = { fg = colors.blue }, -- Sets highlighting of component
|
||||
padding = { left = 0, right = 1 }, -- We don't need space before this
|
||||
}
|
||||
|
||||
ins_left {
|
||||
-- mode component
|
||||
function()
|
||||
return ''
|
||||
end,
|
||||
color = function()
|
||||
-- auto change color according to neovims mode
|
||||
local mode_color = {
|
||||
n = colors.red,
|
||||
i = colors.green,
|
||||
v = colors.blue,
|
||||
[''] = colors.blue,
|
||||
V = colors.blue,
|
||||
c = colors.magenta,
|
||||
no = colors.red,
|
||||
s = colors.orange,
|
||||
S = colors.orange,
|
||||
[''] = colors.orange,
|
||||
ic = colors.yellow,
|
||||
R = colors.violet,
|
||||
Rv = colors.violet,
|
||||
cv = colors.red,
|
||||
ce = colors.red,
|
||||
r = colors.cyan,
|
||||
rm = colors.cyan,
|
||||
['r?'] = colors.cyan,
|
||||
['!'] = colors.red,
|
||||
t = colors.red,
|
||||
}
|
||||
return { fg = mode_color[vim.fn.mode()] }
|
||||
end,
|
||||
padding = { right = 1 },
|
||||
}
|
||||
|
||||
ins_left {
|
||||
-- filesize component
|
||||
'filesize',
|
||||
cond = conditions.buffer_not_empty,
|
||||
}
|
||||
|
||||
ins_left {
|
||||
'filename',
|
||||
cond = conditions.buffer_not_empty,
|
||||
color = { fg = colors.magenta, gui = 'bold' },
|
||||
}
|
||||
|
||||
ins_left { 'location' }
|
||||
|
||||
ins_left { 'progress', color = { fg = colors.fg, gui = 'bold' } }
|
||||
|
||||
ins_left {
|
||||
'diagnostics',
|
||||
sources = { 'nvim_diagnostic' },
|
||||
symbols = { error = ' ', warn = ' ', info = ' ' },
|
||||
diagnostics_color = {
|
||||
color_error = { fg = colors.red },
|
||||
color_warn = { fg = colors.yellow },
|
||||
color_info = { fg = colors.cyan },
|
||||
},
|
||||
}
|
||||
|
||||
-- Insert mid section. You can make any number of sections in neovim :)
|
||||
-- for lualine it's any number greater then 2
|
||||
ins_left {
|
||||
function()
|
||||
return '%='
|
||||
end,
|
||||
}
|
||||
|
||||
ins_left {
|
||||
-- Lsp server name .
|
||||
function()
|
||||
local msg = 'No Active Lsp'
|
||||
local buf_ft = vim.api.nvim_buf_get_option(0, 'filetype')
|
||||
local clients = vim.lsp.get_active_clients()
|
||||
if next(clients) == nil then
|
||||
return msg
|
||||
end
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
return client.name
|
||||
end
|
||||
end
|
||||
return msg
|
||||
end,
|
||||
icon = ' LSP:',
|
||||
color = { fg = '#ffffff', gui = 'bold' },
|
||||
}
|
||||
|
||||
-- Add components to right sections
|
||||
ins_right {
|
||||
'o:encoding', -- option component same as &encoding in viml
|
||||
fmt = string.upper, -- I'm not sure why it's upper case either ;)
|
||||
cond = conditions.hide_in_width,
|
||||
color = { fg = colors.green, gui = 'bold' },
|
||||
}
|
||||
|
||||
ins_right {
|
||||
'fileformat',
|
||||
fmt = string.upper,
|
||||
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
|
||||
color = { fg = colors.green, gui = 'bold' },
|
||||
}
|
||||
|
||||
ins_right {
|
||||
'branch',
|
||||
icon = '',
|
||||
color = { fg = colors.violet, gui = 'bold' },
|
||||
}
|
||||
|
||||
ins_right {
|
||||
'diff',
|
||||
-- Is it me or the symbol for modified us really weird
|
||||
symbols = { added = ' ', modified = '柳 ', removed = ' ' },
|
||||
diff_color = {
|
||||
added = { fg = colors.green },
|
||||
modified = { fg = colors.orange },
|
||||
removed = { fg = colors.red },
|
||||
},
|
||||
cond = conditions.hide_in_width,
|
||||
}
|
||||
|
||||
ins_right {
|
||||
function()
|
||||
return '▊'
|
||||
end,
|
||||
color = { fg = colors.blue },
|
||||
padding = { left = 1 },
|
||||
}
|
||||
|
||||
-- Now don't forget to initialize lualine
|
||||
lualine.setup(config)
|
||||
@@ -1,5 +0,0 @@
|
||||
vim.keymap.set("n", "<leader>gs", vim.cmd.Git)
|
||||
|
||||
|
||||
vim.keymap.set("n", "gf", "<cmd>diffget //2<CR>")
|
||||
vim.keymap.set("n", "gj", "<cmd>diffget //3<CR>")
|
||||
@@ -1,10 +0,0 @@
|
||||
local mark = require("harpoon.mark")
|
||||
local ui = require("harpoon.ui")
|
||||
|
||||
vim.keymap.set("n", "<leader>a", mark.add_file)
|
||||
vim.keymap.set("n", "<C-e>", ui.toggle_quick_menu)
|
||||
|
||||
vim.keymap.set("n", "<C-h>", function() ui.nav_file(1) end)
|
||||
vim.keymap.set("n", "<C-j>", function() ui.nav_file(2) end)
|
||||
vim.keymap.set("n", "<C-k>", function() ui.nav_file(3) end)
|
||||
vim.keymap.set("n", "<C-l>", function() ui.nav_file(4) end)
|
||||
@@ -1,135 +0,0 @@
|
||||
local lsp_zero = require('lsp-zero')
|
||||
|
||||
local lsp_attach = function(client, bufnr)
|
||||
-- see :help lsp-zero-keybindings
|
||||
-- to learn the available actions
|
||||
-- lsp_zero.default_keymaps({buffer = bufnr})
|
||||
--
|
||||
local opts = {buffer = bufnr, remap = false}
|
||||
|
||||
vim.keymap.set('n', 'gD', vim.lsp.buf.declaration, opts)
|
||||
vim.keymap.set("n", "gd", function() vim.lsp.buf.definition() end, opts)
|
||||
vim.keymap.set("n", "K", function() vim.lsp.buf.hover() end, opts)
|
||||
vim.keymap.set("n", "<leader>vws", function() vim.lsp.buf.workspace_symbol() end, opts)
|
||||
vim.keymap.set("n", "<leader>vd", function() vim.diagnostic.open_float() end, opts)
|
||||
vim.keymap.set("n", "[d", function() vim.diagnostic.goto_next() end, opts)
|
||||
vim.keymap.set("n", "]d", function() vim.diagnostic.goto_prev() end, opts)
|
||||
vim.keymap.set("n", "<leader>vca", function() vim.lsp.buf.code_action() end, opts)
|
||||
vim.keymap.set("n", "<leader>vrr", function() vim.lsp.buf.references() end, opts)
|
||||
vim.keymap.set("n", "<leader>vrn", function() vim.lsp.buf.rename() end, opts)
|
||||
vim.keymap.set("i", "<C-h>", function() vim.lsp.buf.signature_help() end, opts)
|
||||
end
|
||||
|
||||
lsp_zero.extend_lspconfig({
|
||||
capabilities = require('cmp_nvim_lsp').default_capabilities(),
|
||||
lsp_attach = lsp_attach,
|
||||
float_border = 'rounded',
|
||||
sign_text = true,
|
||||
})
|
||||
|
||||
local lspconfig = require('lspconfig')
|
||||
|
||||
require('mason').setup({})
|
||||
|
||||
require('mason-lspconfig').setup({
|
||||
ensure_installed = {
|
||||
'lua_ls',
|
||||
'jdtls',
|
||||
'clangd',
|
||||
'zls',
|
||||
},
|
||||
handlers = {
|
||||
function(server_name)
|
||||
require('lspconfig')[server_name].setup({})
|
||||
end,
|
||||
|
||||
-- noop is an empty function that doesn't do anything
|
||||
clangd = function()
|
||||
-- lspconfig.clangd.setup({
|
||||
-- cmd = {
|
||||
-- 'clangd',
|
||||
-- '--background-index',
|
||||
-- '--clang-tidy',
|
||||
-- '--log=verbose',
|
||||
-- '--header-interpolation=false', -- clangd doesn't find the files, annoying and unnecessary noise as a result
|
||||
-- },
|
||||
-- init_options = {
|
||||
-- fallbackFlags = {
|
||||
-- '-std=c23',
|
||||
-- '-std=c++20'
|
||||
-- },
|
||||
-- },
|
||||
-- })
|
||||
end,
|
||||
jdtls = function()
|
||||
lspconfig.jdtls.setup{}
|
||||
end,
|
||||
zls = function()
|
||||
lspconfig.zls.setup({})
|
||||
end,
|
||||
lua_ls = function()
|
||||
lspconfig.lua_ls.setup({
|
||||
on_init = function(client)
|
||||
if client.workspace_folders then
|
||||
local path = client.workspace_folders[1].name
|
||||
if vim.uv.fs_stat(path..'/.luarc.json') or vim.uv.fs_stat(path..'/.luarc.jsonc') then
|
||||
return
|
||||
end
|
||||
end
|
||||
|
||||
client.config.settings.Lua = vim.tbl_deep_extend('force', client.config.settings.Lua, {
|
||||
runtime = {
|
||||
-- Tell the language server which version of Lua you're using
|
||||
-- (most likely LuaJIT in the case of Neovim)
|
||||
|
||||
version = 'LuaJIT'
|
||||
},
|
||||
-- Make the server aware of Neovim runtime files
|
||||
workspace = {
|
||||
checkThirdParty = false,
|
||||
library = {
|
||||
vim.env.VIMRUNTIME
|
||||
}
|
||||
}
|
||||
})
|
||||
end,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = {
|
||||
globals = { 'turtle' },
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
end,
|
||||
ols = function()
|
||||
lspconfig.ols.setup({
|
||||
single_file_support = true,
|
||||
on_attach = function (client, buffer)
|
||||
print('reached ols')
|
||||
end
|
||||
})
|
||||
end,
|
||||
}
|
||||
})
|
||||
|
||||
|
||||
local cmp = require('cmp')
|
||||
local cmp_select = {behaviour = cmp.SelectBehavior.Select}
|
||||
cmp.setup({
|
||||
sources = {
|
||||
{ name = 'nvim_lsp' },
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require('luasnip').lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-p>'] = cmp.mapping.select_prev_item(cmp_select),
|
||||
['<C-n>'] = cmp.mapping.select_next_item(cmp_select),
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = true }),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
}),
|
||||
formatting = lsp_zero.cmp_format(),
|
||||
})
|
||||
@@ -1,61 +0,0 @@
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'auto',
|
||||
component_separators = { left = '|', right = '|'},
|
||||
section_separators = { left = '', right = ''},
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 75,
|
||||
tabline = 10000,
|
||||
winbar = 10000,
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = {
|
||||
'branch',
|
||||
'diff',
|
||||
{
|
||||
'diagnostics',
|
||||
--sources = 'nvim_diagnostic'
|
||||
sources = { 'nvim_diagnostic' },
|
||||
|
||||
-- Displays diagnostics for the defined severity types
|
||||
sections = { 'error', 'warn', 'info', 'hint' },
|
||||
diagnostics_color = {
|
||||
-- Same values as the general color option can be used here.
|
||||
error = 'DiagnosticError', -- Changes diagnostics' error color.
|
||||
warn = 'DiagnosticWarn', -- Changes diagnostics' warn color.
|
||||
info = 'DiagnosticInfo', -- Changes diagnostics' info color.
|
||||
hint = 'DiagnosticHint', -- Changes diagnostics' hint color.
|
||||
},
|
||||
symbols = { error = ' ', warn = ' ', info = ' ', hint = 'H' },
|
||||
colored = true, -- Displays diagnostics status in color if set to true.
|
||||
update_in_insert = false, -- Update diagnostics in insert mode.
|
||||
always_visible = false, -- Show diagnostics even if there are none.
|
||||
},
|
||||
},
|
||||
lualine_x = {'encoding', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
local builtin = require('telescope.builtin')
|
||||
|
||||
vim.keymap.set('n', '<C-p>', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<leader>gf', builtin.git_files, {})
|
||||
vim.keymap.set('n', '<leader>ps', function()
|
||||
builtin.grep_string({ search = vim.fn.input("Grep > ") });
|
||||
end)
|
||||
@@ -1,16 +0,0 @@
|
||||
require'nvim-treesitter.configs'.setup {
|
||||
-- A list of parser names, or "all" (the five listed parsers should always be installed)
|
||||
ensure_installed = { "c", "lua", "vim", "query" },
|
||||
|
||||
-- Install parsers synchronously (only applied to `ensure_installed`)
|
||||
sync_install = false,
|
||||
|
||||
-- Automatically install missing parsers when entering buffer
|
||||
-- Recommendation: set to false if you don't have `tree-sitter` CLI installed locally
|
||||
auto_install = false,
|
||||
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = false,
|
||||
},
|
||||
}
|
||||
@@ -1,14 +0,0 @@
|
||||
require'treesitter-context'.setup{
|
||||
enable = true, -- Enable this plugin (Can be enabled/disabled later via commands)
|
||||
multiwindow = false,
|
||||
max_lines = 4, -- 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.
|
||||
line_numbers = true,
|
||||
multiline_threshold = 10, -- Maximum number of lines to collapse for a single context line
|
||||
trim_scope = 'outer', -- Which context lines to discard if `max_lines` is exceeded. Choices: 'inner', 'outer'
|
||||
mode = 'cursor', -- 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.
|
||||
separator = nil,
|
||||
zindex = 20, -- The Z-index of the context window
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||||
@@ -1 +1,2 @@
|
||||
require("liamm")
|
||||
require("liamm.lazy")
|
||||
require("liamm.core")
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
local remap = require("liamm.core.keymap")
|
||||
local nnoremap = remap.nnoremap
|
||||
local vnoremap = remap.vnoremap
|
||||
|
||||
-- Normal Mode Mappings
|
||||
nnoremap("<leader>pv", "<cmd>Ex<CR>")
|
||||
nnoremap("<leader>tt", "<cmd>TSContextToggle<CR>")
|
||||
nnoremap("J", "mzJ`z")
|
||||
nnoremap("<C-d>", "<C-d>zz")
|
||||
nnoremap("<C-u>", "<C-u>zz")
|
||||
nnoremap("n", "nzzzv")
|
||||
nnoremap("N", "Nzzzv")
|
||||
nnoremap("<leader>bg", "<C-z>")
|
||||
nnoremap("<leader>y", "\"+y")
|
||||
nnoremap("<leader>Y", "\"+Y")
|
||||
nnoremap("<leader>x", "<cmd>!chmod +x %<CR>", {silent = true})
|
||||
|
||||
nnoremap("<leader>w", "<C-w>")
|
||||
|
||||
nnoremap("<leader>qq", ":x<CR>")
|
||||
nnoremap("<leader>.", ":find ~/")
|
||||
nnoremap("<leader>oc", ":find ~/.config/nvim/lua/liamm/core/binds.lua<CR>")
|
||||
nnoremap("<leader>bs", ":lua Build()<CR>")
|
||||
|
||||
-- Visual Mode Mappings
|
||||
vnoremap("K", ":m '<-2<CR>gv=gv")
|
||||
vnoremap("J", ":m '>+1<CR>gv=gv")
|
||||
vnoremap("<leader>y", "\"+y")
|
||||
|
||||
-- BUILD SCRIPT INVOKATIONS
|
||||
-- generic build function
|
||||
local function set(list)
|
||||
local _set = {}
|
||||
for _, l in ipairs(list) do
|
||||
_set[l] = true
|
||||
end
|
||||
return _set
|
||||
end
|
||||
|
||||
-- TODO: add support for passing flags
|
||||
function Build()
|
||||
local out_buf = vim.api.nvim_create_buf(false, true)
|
||||
|
||||
local build_scripts = set(vim.fs.find({ "build.sh", "build.zig", "build.bat" }, { upward = true, type = "file", path = "." }))
|
||||
local output = "[No Build Output]"
|
||||
|
||||
if build_scripts['build.zig'] then
|
||||
vim.cmd('echo "Running build.zig"')
|
||||
output = vim.fn.system({ 'zig', 'build' })
|
||||
else
|
||||
if jit.os == 'Windows' and build_scripts['build.bat'] then
|
||||
output = vim.fn.system({ 'build', '' })
|
||||
elseif build_scripts['build.sh'] then
|
||||
output = vim.fn.system({ './build.sh', '' })
|
||||
else
|
||||
end
|
||||
end
|
||||
vim.api.nvim_buf_set_lines(out_buf, -1, -1, true, {"[ Build Output ]"})
|
||||
vim.api.nvim_buf_set_lines(out_buf, -1, -1, true, vim.split(output, '\n'))
|
||||
|
||||
local window = vim.api.nvim_open_win(out_buf, false, {
|
||||
split = 'right',
|
||||
win = 0,
|
||||
width = math.floor(vim.o.columns * 0.35),
|
||||
style = 'minimal',
|
||||
})
|
||||
vim.api.nvim_set_current_win(window)
|
||||
|
||||
-- Keybind to close the window on pressing Enter
|
||||
vim.api.nvim_buf_set_keymap(out_buf, 'n', '<CR>', '', {
|
||||
noremap = true,
|
||||
silent = true,
|
||||
callback = function()
|
||||
vim.api.nvim_win_close(window, true)
|
||||
end
|
||||
})
|
||||
end
|
||||
@@ -0,0 +1,3 @@
|
||||
require("liamm.core.binds")
|
||||
require("liamm.core.keymap")
|
||||
require("liamm.core.options")
|
||||
@@ -0,0 +1,69 @@
|
||||
local opt = vim.opt
|
||||
|
||||
vim.g.root_spec = { "lsp", { ".git", "lua" }, "cwd" }
|
||||
|
||||
opt.cursorline = true
|
||||
opt.expandtab = true
|
||||
opt.fillchars = {
|
||||
foldopen = "",
|
||||
foldclose = "",
|
||||
fold = " ",
|
||||
foldsep = " ",
|
||||
diff = "╱",
|
||||
eob = " ",
|
||||
}
|
||||
opt.foldlevel = 99
|
||||
opt.grepformat = "%f:%l:%c:%m"
|
||||
opt.grepprg = "rg --vimgrep"
|
||||
opt.ignorecase = true
|
||||
opt.hlsearch = false
|
||||
opt.incsearch = true
|
||||
opt.inccommand = "nosplit"
|
||||
opt.jumpoptions = "view"
|
||||
opt.laststatus = 3
|
||||
opt.linebreak = true
|
||||
opt.mouse = "a"
|
||||
opt.pumblend = 10
|
||||
opt.pumheight = 10
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
opt.ruler = false
|
||||
opt.scrolloff = 4
|
||||
opt.sessionoptions = { "buffers", "curdir", "tabpages", "winsize", "help", "globals", "skiprtp", "folds" }
|
||||
opt.shiftround = true
|
||||
opt.shiftwidth = 2
|
||||
opt.shortmess:append({ W = true, I = true, c = true, C = true })
|
||||
opt.showmode = false
|
||||
opt.sidescrolloff = 8
|
||||
opt.signcolumn = "yes"
|
||||
opt.smartcase = true
|
||||
opt.smartindent = true
|
||||
opt.spelllang = { "en" }
|
||||
opt.splitbelow = true
|
||||
opt.splitkeep = "screen"
|
||||
opt.splitright = true
|
||||
opt.tabstop = 2
|
||||
opt.termguicolors = true
|
||||
opt.timeoutlen = vim.g.vscode and 1000 or 300
|
||||
opt.undofile = true
|
||||
opt.undolevels = 10000
|
||||
opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||
opt.updatetime = 200
|
||||
opt.swapfile = false
|
||||
opt.virtualedit = "block"
|
||||
opt.wildmode = "longest:full,full"
|
||||
opt.winminwidth = 5
|
||||
opt.wrap = true
|
||||
|
||||
if vim.fn.has("nvim-0.10") == 1 then
|
||||
opt.smoothscroll = true
|
||||
opt.foldexpr = "v:lua.require'lazyvim.util'.ui.foldexpr()"
|
||||
opt.foldmethod = "expr"
|
||||
opt.foldtext = ""
|
||||
else
|
||||
opt.foldmethod = "indent"
|
||||
opt.foldtext = "v:lua.require'lazyvim.util'.ui.foldtext()"
|
||||
end
|
||||
|
||||
-- Fix markdown indentation settings
|
||||
vim.g.markdown_recommended_style = 0
|
||||
@@ -1,4 +0,0 @@
|
||||
require("liamm.set")
|
||||
require("liamm.remap")
|
||||
require("liamm.packer")
|
||||
|
||||
@@ -0,0 +1,40 @@
|
||||
-- Bootstrap lazy.nvim
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"--branch=stable",
|
||||
lazyrepo,
|
||||
lazypath
|
||||
})
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Make sure to setup `mapleader` and `maplocalleader` before
|
||||
-- loading lazy.nvim so that mappings are correct.
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
{ import = "liamm.plugins" },
|
||||
{ import = "liamm.plugins.lsp" },
|
||||
},
|
||||
install = { colorscheme = { "sonokai" } },
|
||||
checker = { enabled = true, notify = false },
|
||||
change_detection = { notify = false },
|
||||
})
|
||||
@@ -1,54 +0,0 @@
|
||||
return require('packer').startup(function(use)
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
use({ 'folke/tokyonight.nvim', as = 'tokyonight' })
|
||||
use({ 'karoliskoncevicius/sacredforest-vim', as = 'sacredforest' })
|
||||
use({ 'EdenEast/nightfox.nvim', as = 'nightfox' })
|
||||
use({ 'rebelot/kanagawa.nvim', as = 'kanagawa'})
|
||||
use({ 'sainnhe/sonokai', as = 'sonokai'})
|
||||
use({ 'p00f/alabaster.nvim', as = 'alabaster'})
|
||||
|
||||
use 'nvim-telescope/telescope.nvim'
|
||||
use('nvim-treesitter/nvim-treesitter', {run = ':TSUpdate'})
|
||||
use 'nvim-treesitter/playground'
|
||||
use 'nvim-treesitter/nvim-treesitter-context'
|
||||
use 'nvim-lua/plenary.nvim'
|
||||
use 'mbbill/undotree'
|
||||
use 'theprimeagen/harpoon'
|
||||
use 'nvim-lualine/lualine.nvim'
|
||||
use {
|
||||
'mfussenegger/nvim-dap', -- debugger integration
|
||||
requires = {
|
||||
'rcarriga/nvim-dap-ui',
|
||||
'nvim-neotest/nvim-nio' -- dep of dap-ui
|
||||
}
|
||||
}
|
||||
use 'mfussenegger/nvim-jdtls' -- Java LSP Support
|
||||
|
||||
use 'tpope/vim-fugitive' -- git integration
|
||||
--LSP CONFIG
|
||||
--
|
||||
use {
|
||||
'VonHeikemen/lsp-zero.nvim',
|
||||
branch = 'v4.x',
|
||||
requires = {
|
||||
-- LSP Support
|
||||
{'neovim/nvim-lspconfig'}, -- Required
|
||||
{'williamboman/mason.nvim'}, -- Optional
|
||||
{'williamboman/mason-lspconfig.nvim'}, -- Optional
|
||||
|
||||
-- Autocompletion
|
||||
{'hrsh7th/nvim-cmp'}, -- Required
|
||||
{'hrsh7th/cmp-buffer'},
|
||||
{'hrsh7th/cmp-path'},
|
||||
{'saadparwaiz1/cmp_luasnip'},
|
||||
{'hrsh7th/cmp-nvim-lsp'}, -- Required
|
||||
{'hrsh7th/cmp-nvim-lua'},
|
||||
|
||||
-- Snippets
|
||||
{'L3MON4D3/LuaSnip'}, -- Required
|
||||
{'rafamadriz/friendly-snippets'},
|
||||
}
|
||||
}
|
||||
|
||||
end)
|
||||
@@ -0,0 +1,88 @@
|
||||
return {
|
||||
-- which-key... will setup at some point
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
lazy = true,
|
||||
},
|
||||
|
||||
-- statup time tracking
|
||||
{
|
||||
"dstein64/vim-startuptime",
|
||||
cmd = "StartupTime",
|
||||
-- init is called during startup. Configuration for vim plugins typically should be set in an init function
|
||||
init = function()
|
||||
vim.g.startuptime_tries = 10
|
||||
end,
|
||||
},
|
||||
|
||||
-- completions
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
-- load cmp on InsertEnter
|
||||
event = "InsertEnter",
|
||||
-- these dependencies will only be loaded when cmp loads
|
||||
-- dependencies are always lazy-loaded unless specified otherwise
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
"L3MON4D3/LuaSnip",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local luasnip = require("luasnip")
|
||||
|
||||
cmp.setup({
|
||||
completion = {
|
||||
completeopt = "menu,meuone,preview,noselect",
|
||||
},
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
luasnip.lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert({
|
||||
['<C-k>'] = cmp.mapping.select_prev_item(),
|
||||
['<C-j>'] = cmp.mapping.select_next_item(),
|
||||
['<C-f>'] = cmp.mapping.scroll_docs(4), -- scroll preview forward
|
||||
['<C-b>'] = cmp.mapping.scroll_docs(-4), -- scroll preview backward
|
||||
['<C-y>'] = cmp.mapping.confirm({ select = false }),
|
||||
['<C-c>'] = cmp.mapping.abort(),
|
||||
['<C-Space>'] = cmp.mapping.complete(),
|
||||
}),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" }, -- lsp completions
|
||||
{ name = "luasnip" }, -- snippets
|
||||
{ name = "buffer" }, -- text within buffer
|
||||
{ name = "path" }, -- filesystem paths
|
||||
}),
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- mason
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
dependencies = {
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
},
|
||||
config = function()
|
||||
local mason = require("mason")
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
|
||||
mason.setup({})
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = {
|
||||
"lua_ls",
|
||||
"zls",
|
||||
"ols",
|
||||
"rnix",
|
||||
},
|
||||
automatic_installation = true, -- auto-install configured servers
|
||||
automatic_enable = false,
|
||||
})
|
||||
end,
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
return {
|
||||
-- the colorscheme should be available when starting Neovim
|
||||
{
|
||||
"sainnhe/sonokai",
|
||||
lazy = false, -- make sure we load this during startup if it is your main colorscheme
|
||||
priority = 1000, -- make sure to load this before all the other start plugins
|
||||
config = function()
|
||||
-- load the colorscheme here
|
||||
vim.cmd([[colorscheme sonokai]])
|
||||
end,
|
||||
},
|
||||
|
||||
{
|
||||
"p00f/alabaster.nvim",
|
||||
name = "alabaster",
|
||||
},
|
||||
|
||||
-- Other colorschemes
|
||||
{
|
||||
"karoliskoncevicius/sacredforest-vim",
|
||||
lazy = false,
|
||||
name = "sacredforest"
|
||||
},
|
||||
{
|
||||
"folke/tokyonight.nvim",
|
||||
lazy = true,
|
||||
name = "tokyonight",
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
local map = require("liamm.core.keymap").nnoremap
|
||||
-- return {
|
||||
-- "theprimeagen/harpoon",
|
||||
-- branch = "harpoon2",
|
||||
-- dependencies = {
|
||||
-- "nvim-lua/plenary.nvim",
|
||||
-- },
|
||||
-- lazy = false,
|
||||
-- config = function()
|
||||
-- local harpoon = require("harpoon")
|
||||
--
|
||||
-- ---@diagnostic disable-next-line: missing-parameter
|
||||
-- harpoon:setup()
|
||||
-- map("<leader>a", function() harpoon:list():append() end)
|
||||
-- map("<leader>h", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
||||
-- map("<c-h>", function() harpoon:list():select(1) end)
|
||||
-- map("<c-h>", function() harpoon:list():select(2) end)
|
||||
-- map("<c-h>", function() harpoon:list():select(3) end)
|
||||
-- map("<c-h>", function() harpoon:list():select(4) end)
|
||||
-- end,
|
||||
-- }
|
||||
|
||||
return {
|
||||
"ThePrimeagen/harpoon",
|
||||
branch = "harpoon2",
|
||||
config = function()
|
||||
local harpoon = require("harpoon")
|
||||
---@diagnostic disable-next-line: missing-parameter
|
||||
harpoon:setup()
|
||||
map("<leader>a", function() harpoon:list():add() end)
|
||||
map("<c-e>", function() harpoon.ui:toggle_quick_menu(harpoon:list()) end)
|
||||
map("<c-h>", function() harpoon:list():select(1) end)
|
||||
map("<c-j>", function() harpoon:list():select(2) end)
|
||||
map("<c-k>", function() harpoon:list():select(3) end)
|
||||
map("<c-l>", function() harpoon:list():select(4) end)
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
local map = require("liamm.core.keymap").nnoremap
|
||||
local vmap = require("liamm.core.keymap").vnoremap
|
||||
|
||||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
event = { "BufReadPre", "BufNewFile" },
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
},
|
||||
config = function()
|
||||
local lspconfig = require("lspconfig")
|
||||
local cmp_nvim_lsp = require("cmp_nvim_lsp")
|
||||
|
||||
local opts = { noremap = true, silent = true }
|
||||
local on_attach = function(client, bufnr)
|
||||
opts.buffer = bufnr
|
||||
|
||||
opts.desc = "Show LSP References"
|
||||
map("gR", "<cmd>Telescope lsp_references<CR>", opts)
|
||||
|
||||
opts.desc = "Go To Declaration"
|
||||
map("gD", vim.lsp.buf.declaration, opts)
|
||||
|
||||
opts.desc = "Show LSP Definition"
|
||||
map("gd", "<cmd>Telescope lsp_definitions<CR>", opts)
|
||||
|
||||
opts.desc = "Show LSP Type Definitions"
|
||||
map("gt", "<cmd>Telescope lsp_type_definitions<CR>", opts)
|
||||
|
||||
opts.desc = "Show LSP Implementations"
|
||||
map("gi", "<cmd>Telescope lsp_implementations<CR>", opts)
|
||||
|
||||
opts.desc = "See Available Code Actions"
|
||||
map("<leader>ca", vim.lsp.buf.code_action, opts)
|
||||
vmap("<leader>ca", vim.lsp.buf.code_action, opts)
|
||||
|
||||
opts.desc = "Smart Rename"
|
||||
map("<leader>rn", vim.lsp.buf.rename, opts)
|
||||
|
||||
opts.desc = "Show Buffer Diagnostics"
|
||||
map("<leader>vD", "<cmd>Telescope diagnostics bufnr=0<CR>", opts)
|
||||
|
||||
opts.desc = "Show Line Diagnostics"
|
||||
map("<leader>vd", vim.diagnostic.open_float, opts)
|
||||
|
||||
opts.desc = "Go To Prev Diagnostic"
|
||||
map("[d", "<cmd>vim.diagnostic.jump({ count = 1, float = true })<CR>", opts)
|
||||
|
||||
opts.desc = "Go To Next Diagnostic"
|
||||
map("]d", "<cmd>vim.diagnostic.jump({ count = -1, float = true })<CR>", opts)
|
||||
|
||||
opts.desc = "Show Documentation For Cursor Hover"
|
||||
map("K", vim.lsp.buf.hover, opts)
|
||||
|
||||
opts.desc = "Show Documentation For Cursor Hover"
|
||||
map("<leader>rs", "<cmd>LspRestart<CR>", opts)
|
||||
end
|
||||
|
||||
local capabilities = cmp_nvim_lsp.default_capabilities()
|
||||
|
||||
local signs = {
|
||||
Error = ' ',
|
||||
Warn = ' ',
|
||||
Info = ' ',
|
||||
Hint = 'H',
|
||||
}
|
||||
|
||||
for type, icon in pairs(signs) do
|
||||
local hl = "DiagnosticSign" .. type
|
||||
vim.fn.sign_define(hl, { text = icon, texthl = hl, numhl = "" })
|
||||
end
|
||||
|
||||
lspconfig["zls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig["rnix"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
})
|
||||
|
||||
lspconfig["lua_ls"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostic = {
|
||||
globals = { "vim" },
|
||||
},
|
||||
workspace = {
|
||||
library = {
|
||||
[vim.fn.expand("$VIMRUNTIME/lua")] = true,
|
||||
[vim.fn.stdpath("config") .. "/lua"] = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
lspconfig["ols"].setup({
|
||||
capabilities = capabilities,
|
||||
on_attach = on_attach,
|
||||
single_file_support = true,
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
config = function()
|
||||
lualine = require("lualine")
|
||||
lualine.setup({
|
||||
options = {
|
||||
icons_enabled = true,
|
||||
theme = 'auto',
|
||||
component_separators = { left = '|', right = '|'},
|
||||
section_separators = { left = '', right = ''},
|
||||
disabled_filetypes = {
|
||||
statusline = {},
|
||||
winbar = {},
|
||||
},
|
||||
ignore_focus = {},
|
||||
always_divide_middle = true,
|
||||
globalstatus = false,
|
||||
refresh = {
|
||||
statusline = 75,
|
||||
tabline = 10000,
|
||||
winbar = 10000,
|
||||
}
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { 'mode' },
|
||||
lualine_b = {
|
||||
'branch',
|
||||
'diff',
|
||||
{
|
||||
'diagnostics',
|
||||
--sources = 'nvim_diagnostic'
|
||||
sources = { 'nvim_diagnostic' },
|
||||
|
||||
-- Displays diagnostics for the defined severity types
|
||||
sections = { 'error', 'warn', 'info', 'hint' },
|
||||
diagnostics_color = {
|
||||
-- Same values as the general color option can be used here.
|
||||
error = 'DiagnosticError', -- Changes diagnostics' error color.
|
||||
warn = 'DiagnosticWarn', -- Changes diagnostics' warn color.
|
||||
info = 'DiagnosticInfo', -- Changes diagnostics' info color.
|
||||
hint = 'DiagnosticHint', -- Changes diagnostics' hint color.
|
||||
},
|
||||
symbols = {
|
||||
error = ' ',
|
||||
warn = ' ',
|
||||
info = ' ',
|
||||
hint = 'H'
|
||||
},
|
||||
colored = true, -- Displays diagnostics status in color if set to true.
|
||||
update_in_insert = false, -- Update diagnostics in insert mode.
|
||||
always_visible = false, -- Show diagnostics even if there are none.
|
||||
},
|
||||
},
|
||||
lualine_x = {'encoding', 'filetype'},
|
||||
lualine_y = {'progress'},
|
||||
lualine_z = {'location'}
|
||||
},
|
||||
inactive_sections = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {'filename'},
|
||||
lualine_x = {'location'},
|
||||
lualine_y = {},
|
||||
lualine_z = {}
|
||||
},
|
||||
tabline = {},
|
||||
winbar = {},
|
||||
inactive_winbar = {},
|
||||
extensions = {}
|
||||
})
|
||||
end,
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
return {
|
||||
"folke/snacks.nvim",
|
||||
priority = 1000,
|
||||
lazy = false,
|
||||
---@type snacks.Config
|
||||
opts = {
|
||||
input = { enabled = true },
|
||||
picer = { enabled = true },
|
||||
notifier = { enabled = true },
|
||||
scope = { enabled = true },
|
||||
sroll = { enabled = true },
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,44 @@
|
||||
return {
|
||||
"nvim-telescope/telescope.nvim",
|
||||
dependencies = {
|
||||
"nvim-lua/plenary.nvim",
|
||||
{
|
||||
"nvim-telescope/telescope-fzf-native.nvim",
|
||||
build = "cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release"
|
||||
},
|
||||
},
|
||||
lazy = false,
|
||||
config = function()
|
||||
local telescope = require("telescope")
|
||||
local actions = require("telescope.actions")
|
||||
|
||||
telescope.setup({
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
["<C-k>"] = actions.move_selection_previous,
|
||||
["<C-j>"] = actions.move_selection_next,
|
||||
["<C-q>"] = actions.send_selected_to_qflist + actions.open_qflist,
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
fzf = {
|
||||
fuzzy = true,
|
||||
override_generic_sorter = true,
|
||||
override_file_sorter = true,
|
||||
case_mode = smart_case,
|
||||
},
|
||||
},
|
||||
})
|
||||
|
||||
telescope.load_extension("fzf")
|
||||
end,
|
||||
keys = {
|
||||
{ "<leader>ff", "<cmd>Telescope find_files<CR>", desc = "Find files in cwd" },
|
||||
{ "<leader>fg", "<cmd>Telescope git_files<CR>", desc = "Find git file cwd" },
|
||||
{ "<leader>fr", "<cmd>Telescope oldfiles<CR>", desc = "Find recent files in cwd" },
|
||||
{ "<leader>fs", "<cmd>Telescope live_grep<CR>", desc = "Find string in cwd" },
|
||||
{ "<leader>fc", "<cmd>Telescope grep_string<CR>", desc = "Find string under cursor in cwd" },
|
||||
},
|
||||
}
|
||||
@@ -1,123 +0,0 @@
|
||||
local nnoremap = require("liamm.keymap").nnoremap
|
||||
|
||||
nnoremap("<leader>pv", "<cmd>Ex<CR>")
|
||||
nnoremap("<leader>tv", "<cmd>ToggleTerm<CR>")
|
||||
nnoremap("<leader>tt", "<cmd>TSContextToggle<CR>")
|
||||
|
||||
vim.keymap.set("v", "<leader>ss", ":CarbonNow<CR>", { silent = true })
|
||||
|
||||
vim.keymap.set("v", "K", ":m '<-2<CR>gv=gv")
|
||||
vim.keymap.set("v", "J", ":m '>+1<CR>gv=gv")
|
||||
|
||||
vim.keymap.set("n", "J", "mzJ`z")
|
||||
vim.keymap.set("n", "<C-d>", "<C-d>zz")
|
||||
vim.keymap.set("n", "<C-u>", "<C-u>zz")
|
||||
vim.keymap.set("n", "n", "nzzzv")
|
||||
vim.keymap.set("n", "N", "Nzzzv")
|
||||
|
||||
vim.keymap.set("n", "<leader>y", "\"+y")
|
||||
vim.keymap.set("v", "<leader>y", "\"+y")
|
||||
vim.keymap.set("n", "<leader>Y", "\"+Y")
|
||||
|
||||
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", {silent = true})
|
||||
|
||||
-- put to background
|
||||
vim.keymap.set("n", "<leader>bg", "<C-z>")
|
||||
|
||||
-- BUILD SCRIPT INVOKATIONS
|
||||
-- generic build function
|
||||
local function set(list)
|
||||
local _set = {}
|
||||
for _, l in ipairs(list) do
|
||||
_set[l] = true
|
||||
end
|
||||
return _set
|
||||
end
|
||||
|
||||
-- TODO: add support for passing flags
|
||||
function Build()
|
||||
local out_buf = vim.api.nvim_create_buf(false, true)
|
||||
|
||||
local build_scripts = set(vim.fs.find({ "build.sh", "build.zig", "build.bat" }, { upward = true, type = "file", path = "." }))
|
||||
local output = "[No Build Output]"
|
||||
|
||||
if build_scripts['build.zig'] then
|
||||
vim.cmd('echo "Running build.zig"')
|
||||
output = vim.fn.system({ 'zig', 'build' })
|
||||
else
|
||||
if jit.os == 'Windows' and build_scripts['build.bat'] then
|
||||
output = vim.fn.system({ 'build', '' })
|
||||
elseif build_scripts['build.sh'] then
|
||||
output = vim.fn.system({ './build.sh', '' })
|
||||
else
|
||||
end
|
||||
end
|
||||
vim.api.nvim_buf_set_lines(out_buf, -1, -1, true, {"[ Build Output ]"})
|
||||
vim.api.nvim_buf_set_lines(out_buf, -1, -1, true, vim.split(output, '\n'))
|
||||
|
||||
local window = vim.api.nvim_open_win(out_buf, false, {
|
||||
split = 'right',
|
||||
win = 0,
|
||||
width = math.floor(vim.o.columns * 0.35),
|
||||
style = 'minimal',
|
||||
})
|
||||
vim.api.nvim_set_current_win(window)
|
||||
|
||||
-- Keybind to close the window on pressing Enter
|
||||
vim.api.nvim_buf_set_keymap(out_buf, 'n', '<CR>', '', {
|
||||
noremap = true,
|
||||
silent = true,
|
||||
callback = function()
|
||||
vim.api.nvim_win_close(window, true)
|
||||
end
|
||||
})
|
||||
end
|
||||
|
||||
-- TODO: add support for passing flags
|
||||
vim.keymap.set("n", "<leader>bs", ":lua Build()<CR>")
|
||||
|
||||
-- specific build scipt options
|
||||
|
||||
-- `build.sh` script binds
|
||||
-- non-interactive binds
|
||||
vim.keymap.set("n", "<leader>bb" , ":!./build.sh <CR>")
|
||||
vim.keymap.set("n", "<leader>br" , ":!./build.sh run <CR>")
|
||||
vim.keymap.set("n", "<leader>bRb" , ":!./build.sh release <CR>")
|
||||
vim.keymap.set("n", "<leader>bRr" , ":!./build.sh release run <CR>")
|
||||
vim.keymap.set("n", "<leader>bRr" , ":!./build.sh release run <CR>")
|
||||
|
||||
-- interactive binds
|
||||
vim.keymap.set("n", "<leader>bo" , ":!./build.sh ") -- allow for adding extra flags/options
|
||||
vim.keymap.set("n", "<leader>bor" , ":!./build.sh run") -- allow for adding extra flags/options
|
||||
vim.keymap.set("n", "<leader>bRo" , ":!./build.sh release ")
|
||||
vim.keymap.set("n", "<leader>bRor", ":!./build.sh release run ")
|
||||
|
||||
-- `build.zig` script binds
|
||||
-- non-interactive binds
|
||||
vim.keymap.set("n", "<leader>zbb" , ":!zig build <CR>")
|
||||
vim.keymap.set("n", "<leader>zbr" , ":!zig build run <CR>")
|
||||
vim.keymap.set("n", "<leader>zbt" , ":!zig build test <CR>")
|
||||
vim.keymap.set("n", "<leader>zbR" , ":!zig build -Doptimize=ReleaseSafe <CR>")
|
||||
vim.keymap.set("n", "<leader>zbRs" , ":!zig build -Doptimize=ReleaseSmall <CR>")
|
||||
vim.keymap.set("n", "<leader>zbRf" , ":!zig build -Doptimize=ReleaseFast <CR>")
|
||||
vim.keymap.set("n", "<leader>zbRr" , ":!zig build run -Doptimize=ReleaseSafe <CR>")
|
||||
vim.keymap.set("n", "<leader>zbRsr", ":!zig build run -Doptimize=ReleaseSmall <CR>")
|
||||
vim.keymap.set("n", "<leader>zbRfr", ":!zig build run -Doptimize=ReleaseFast <CR>")
|
||||
|
||||
-- interactive binds
|
||||
vim.keymap.set("n", "<leader>zbob" , ":!zig build ")
|
||||
vim.keymap.set("n", "<leader>zbor" , ":!zig build run ")
|
||||
vim.keymap.set("n", "<leader>zbot" , ":!zig build test ")
|
||||
vim.keymap.set("n", "<leader>zboR" , ":!zig build -Doptimize=ReleaseSafe ")
|
||||
vim.keymap.set("n", "<leader>zboRs" , ":!zig build -Doptimize=ReleaseSmall ")
|
||||
vim.keymap.set("n", "<leader>zboRf" , ":!zig build -Doptimize=ReleaseFast ")
|
||||
vim.keymap.set("n", "<leader>zboRr" , ":!zig build run -Doptimize=ReleaseSafe ")
|
||||
vim.keymap.set("n", "<leader>zboRsr", ":!zig build run -Doptimize=ReleaseSmall ")
|
||||
vim.keymap.set("n", "<leader>zboRfr", ":!zig build run -Doptimize=ReleaseFast ")
|
||||
|
||||
-- emacs-inspired binds
|
||||
-- all <C-w> can be done w spacebar-w
|
||||
vim.keymap.set("n", "<leader>w", "<C-w>")
|
||||
vim.keymap.set("n", "<leader>qq", ":x<CR>")
|
||||
nnoremap("<leader>.", ":find ~/")
|
||||
nnoremap("<leader>fc", ":find ~/personal/nixos/modules/old_configs/nvim/lua/liamm/remap.lua<CR>")
|
||||
@@ -1,32 +0,0 @@
|
||||
vim.opt.guicursor = ""
|
||||
|
||||
vim.opt.nu = true
|
||||
vim.opt.rnu = true
|
||||
vim.opt.tabstop = 2
|
||||
vim.opt.softtabstop = 2
|
||||
vim.opt.shiftwidth = 2
|
||||
vim.opt.expandtab = true
|
||||
vim.opt.hlsearch = false
|
||||
vim.opt.incsearch = true
|
||||
vim.opt.termguicolors = true
|
||||
vim.opt.splitright = true
|
||||
vim.opt.splitbelow = true
|
||||
|
||||
vim.opt.updatetime = 40
|
||||
|
||||
vim.opt.colorcolumn = ""
|
||||
|
||||
vim.opt.smartindent = true
|
||||
|
||||
vim.opt.wrap = true
|
||||
|
||||
vim.opt.swapfile = false
|
||||
vim.opt.backup = false
|
||||
vim.opt.undodir = os.getenv("HOME") .. "/.vim/undodir"
|
||||
vim.opt.undofile = true
|
||||
|
||||
vim.opt.scrolloff = 8
|
||||
vim.opt.updatetime = 50
|
||||
|
||||
vim.g.netrw_keepdir = 0
|
||||
vim.g.mapleader = " "
|
||||
Reference in New Issue
Block a user