improvements
This commit is contained in:
parent
e46d491826
commit
7e027ecce7
16
.config/nvim/lua/lazyvim/config/autocmds.lua
Executable file → Normal file
16
.config/nvim/lua/lazyvim/config/autocmds.lua
Executable file → Normal file
@ -60,14 +60,14 @@ vim.cmd('autocmd BufEnter * setlocal formatoptions-=cro')
|
|||||||
-- Set filetype to tex for .tex files?
|
-- Set filetype to tex for .tex files?
|
||||||
vim.cmd([[autocmd BufRead,BufNewFile *.tex set filetype=tex]])
|
vim.cmd([[autocmd BufRead,BufNewFile *.tex set filetype=tex]])
|
||||||
|
|
||||||
-- Trim whitespace from files on save
|
-- -- Trim whitespace from files on save, also have utils.trim_whitespace()
|
||||||
vim.cmd([[
|
-- vim.cmd([[
|
||||||
autocmd BufWritePre * let currPos = getpos(".")
|
-- autocmd BufWritePre * let currPos = getpos(".")
|
||||||
autocmd BufWritePre * %s/\s\+$//e
|
-- autocmd BufWritePre * %s/\s\+$//e
|
||||||
autocmd BufWritePre * %s/\n\+\%$//e
|
-- autocmd BufWritePre * %s/\n\+\%$//e
|
||||||
autocmd BufWritePre *.[ch] %s/\%$/\r/e
|
-- autocmd BufWritePre *.[ch] %s/\%$/\r/e
|
||||||
autocmd BufWritePre * cal cursor(currPos[1], currPos[2])
|
-- autocmd BufWritePre * cal cursor(currPos[1], currPos[2])
|
||||||
]])
|
-- ]])
|
||||||
|
|
||||||
-- Run custom textclear command when exiting a .tex file (cleanup files)
|
-- Run custom textclear command when exiting a .tex file (cleanup files)
|
||||||
vim.cmd([[autocmd VimLeave *.tex !texclear %]])
|
vim.cmd([[autocmd VimLeave *.tex !texclear %]])
|
||||||
|
|||||||
0
.config/nvim/lua/lazyvim/config/keymaps.lua
Executable file → Normal file
0
.config/nvim/lua/lazyvim/config/keymaps.lua
Executable file → Normal file
@ -73,6 +73,17 @@ return {
|
|||||||
{ "<leader>T", group = "term" },
|
{ "<leader>T", group = "term" },
|
||||||
})
|
})
|
||||||
|
|
||||||
|
whichkey.add({
|
||||||
|
mode = { "n", "v" },
|
||||||
|
{
|
||||||
|
"<leader>bt",
|
||||||
|
function()
|
||||||
|
require "lazyvim.utils".trim_whitespace()
|
||||||
|
end,
|
||||||
|
desc = "Trim whitespace from current buffer"
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
-- Z = { "<cmd>ZenMode<cr>", "Zen" },
|
-- Z = { "<cmd>ZenMode<cr>", "Zen" },
|
||||||
-- u = { "<cmd>UndotreeToggle<cr>", "Undo Tree" },
|
-- u = { "<cmd>UndotreeToggle<cr>", "Undo Tree" },
|
||||||
-- ["'"] = { "<cmd>close<CR>", "Close split" },
|
-- ["'"] = { "<cmd>close<CR>", "Close split" },
|
||||||
|
|||||||
@ -86,10 +86,10 @@ function M.toggle(option, silent, values)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
local enabled = true
|
local diagnostics_enabled = true
|
||||||
function M.toggle_diagnostics()
|
function M.toggle_diagnostics()
|
||||||
enabled = not enabled
|
diagnostics_enabled = not diagnostics_enabled
|
||||||
if enabled then
|
if diagnostics_enabled then
|
||||||
vim.diagnostic.enable()
|
vim.diagnostic.enable()
|
||||||
vim.notify("Enabled diagnostics", vim.log.levels.INFO, { title = "Diagnostics" })
|
vim.notify("Enabled diagnostics", vim.log.levels.INFO, { title = "Diagnostics" })
|
||||||
else
|
else
|
||||||
@ -147,4 +147,12 @@ function M.setColorscheme(scheme)
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
function M.trim_whitespace()
|
||||||
|
pcall(vim.cmd, 'let currPos = getpos(".")')
|
||||||
|
pcall(vim.cmd, [[%s/\s\+$//e]])
|
||||||
|
pcall(vim.cmd, [[%s/\n\+\%$//e]])
|
||||||
|
pcall(vim.cmd, [[.[ch] %s/\%$/\r/e]])
|
||||||
|
pcall(vim.cmd, 'cal cursor(currPos[1], currPos[2])')
|
||||||
|
end
|
||||||
|
|
||||||
return M
|
return M
|
||||||
|
|||||||
@ -31,7 +31,7 @@ set -g base-index 1
|
|||||||
setw -g pane-base-index 1
|
setw -g pane-base-index 1
|
||||||
|
|
||||||
# Enable full mouse support.
|
# Enable full mouse support.
|
||||||
set -g mouse on
|
# set -g mouse on # gross gross gross
|
||||||
|
|
||||||
# -----------------------------------------------------------------------------
|
# -----------------------------------------------------------------------------
|
||||||
# Key Binds
|
# Key Binds
|
||||||
|
|||||||
@ -19,7 +19,7 @@ case "${ext}" in
|
|||||||
c) cc "${file}" -o "${base}" && "./${base}" ;;
|
c) cc "${file}" -o "${base}" && "./${base}" ;;
|
||||||
cob) cobc -x -o "$base" "$file" && "$base" ;;
|
cob) cobc -x -o "$base" "$file" && "$base" ;;
|
||||||
cpp) g++ "${file}" -o "${base}" && "./${base}" ;;
|
cpp) g++ "${file}" -o "${base}" && "./${base}" ;;
|
||||||
cs) mcs "${file}" && mono "${base}.exe" ;;
|
cs) cd - && dotnet run ;;
|
||||||
go) go run "${file}" ;;
|
go) go run "${file}" ;;
|
||||||
h) sudo make install ;;
|
h) sudo make install ;;
|
||||||
java) javac -d classes "${file}" && java -cp classes "${base}" ;;
|
java) javac -d classes "${file}" && java -cp classes "${base}" ;;
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user