Many updates
This commit is contained in:
@@ -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,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,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
|
||||
Reference in New Issue
Block a user