Many updates
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
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)
|
||||
@@ -0,0 +1,105 @@
|
||||
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)
|
||||
|
||||
@@ -0,0 +1,221 @@
|
||||
-- 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)
|
||||
@@ -0,0 +1,5 @@
|
||||
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>")
|
||||
@@ -0,0 +1,10 @@
|
||||
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)
|
||||
@@ -0,0 +1,135 @@
|
||||
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(),
|
||||
})
|
||||
@@ -0,0 +1,61 @@
|
||||
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 = {}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
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)
|
||||
@@ -0,0 +1,16 @@
|
||||
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,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
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
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
vim.keymap.set("n", "<leader>u", vim.cmd.UndotreeToggle)
|
||||
@@ -0,0 +1 @@
|
||||
require("liamm")
|
||||
@@ -0,0 +1,4 @@
|
||||
require("liamm.set")
|
||||
require("liamm.remap")
|
||||
require("liamm.packer")
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
local M = {}
|
||||
|
||||
local function bind(op, outer_opts)
|
||||
outer_opts = outer_opts or {noremap = true}
|
||||
return function(lhs, rhs, opts)
|
||||
opts = vim.tbl_extend("force",
|
||||
outer_opts,
|
||||
opts or {}
|
||||
)
|
||||
vim.keymap.set(op, lhs, rhs, opts)
|
||||
end
|
||||
end
|
||||
|
||||
M.nmap = bind("n", {noremap = false})
|
||||
M.nnoremap = bind("n")
|
||||
M.vnoremap = bind("v")
|
||||
M.xnoremap = bind("x")
|
||||
M.inoremap = bind("i")
|
||||
|
||||
return M
|
||||
@@ -0,0 +1,54 @@
|
||||
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,122 @@
|
||||
local nnoremap = require("liamm.keymap").nnoremap
|
||||
|
||||
nnoremap("<leader>pv", "<cmd>Ex<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>")
|
||||
@@ -0,0 +1,32 @@
|
||||
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