updates for nvim

This commit is contained in:
Solomon Laing 2022-12-29 16:45:31 +13:00
parent 87921c606a
commit d793c5e6c7
7 changed files with 46 additions and 88 deletions

View File

@ -28,15 +28,8 @@ require "user.todo-comments" -- highlight TODO and other related comments
require "user.treesitter" -- magic
require "user.whichkey" -- keymaps
require "user.spectre" -- renaming but better
-- require "user.bufferline" -- replaced with cybu and bbye
-- disabled due to "Not enough room" issue see https://github.com/neovim/neovim/issues/19464
-- and potential conflict with noice, I added it same time as updating so maybe not.
require "user.winbar" -- top bar
require "user.cybu" -- cycle through current buffers
require "user.dap" -- debugging
require "user.lspsaga" -- bit overkill, using for code action menu
require "user.neogen"
require "user.zk"
-- require "user.noice" -- fun with new ui
require "user.neogen" -- annotation/doc generator

View File

@ -1,55 +1,55 @@
vim.api.nvim_create_autocmd({ "User" }, {
pattern = { "AlphaReady" },
callback = function()
vim.cmd [[
vim.cmd([[
set laststatus=0 | autocmd BufUnload <buffer> set laststatus=3
]]
]])
end,
})
vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = { "term://*" },
callback = function()
vim.cmd "startinsert!"
vim.cmd "set cmdheight=1"
vim.cmd("startinsert!")
vim.cmd("set cmdheight=1")
end,
})
vim.api.nvim_create_autocmd({ "VimResized" }, {
callback = function()
vim.cmd "tabdo wincmd ="
vim.cmd("tabdo wincmd =")
end,
})
vim.api.nvim_create_autocmd({ "CmdWinEnter" }, {
callback = function()
vim.cmd "quit"
vim.cmd("quit")
end,
})
vim.api.nvim_create_autocmd({ "BufWinEnter" }, {
callback = function()
vim.cmd "set formatoptions-=cro"
vim.cmd("set formatoptions-=cro")
end,
})
vim.api.nvim_create_autocmd({ "TextYankPost" }, {
callback = function()
vim.highlight.on_yank { higroup = "Visual", timeout = 200 }
vim.highlight.on_yank({ higroup = "Visual", timeout = 200 })
end,
})
vim.api.nvim_create_autocmd({ "VimEnter" }, {
callback = function()
vim.cmd "hi link illuminatedWord LspReferenceText"
vim.cmd("hi link illuminatedWord LspReferenceText")
end,
})
-- Prevent auto comment on next line
vim.cmd [[autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o]]
vim.cmd([[autocmd FileType * setlocal formatoptions-=c formatoptions-=r formatoptions-=o]])
-- 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
vim.cmd [[
@ -61,12 +61,12 @@ autocmd BufWritePre * cal cursor(currPos[1], currPos[2])
]]
-- Recompile and restart Xmonad on save of config file for Xmonad or Xmobar
vim.cmd [[autocmd BufWritePost ~/.xmonad/xmonad.hs,~/.config/xmobar/xmobar-main.hs,~/.config/xmobar/xmobar-sub.hs,~/.config/xmobar/xmobar-single.hs !xmonad --recompile && xmonad --restart]]
vim.cmd([[autocmd BufWritePost ~/.xmonad/xmonad.hs,~/.config/xmobar/xmobar-main.hs,~/.config/xmobar/xmobar-sub.hs,~/.config/xmobar/xmobar-single.hs !xmonad --recompile && xmonad --restart]])
-- Run custom textclear command when exiting a .tex file (cleanup files)
vim.cmd [[autocmd VimLeave *.tex !texclear %]]
vim.cmd([[autocmd VimLeave *.tex !texclear %]])
-- Run install when editing my scripts
vim.cmd [[
vim.cmd([[
autocmd BufWritePost ~/repos/inks-scripts/scripts/** !~/repos/inks-scripts/install
]]
]])

View File

@ -6,3 +6,7 @@ if not s_ok then
vim.notify("Colorscheme" .. colorscheme .. " not found!")
return
end
-- For transperant background
-- vim.api.nvim_set_hl(0, "Normal", { bg = "none"})
-- vim.api.nvim_set_hl(0, "NormalFloat", { bg = "none"})

View File

@ -24,7 +24,7 @@ local options = {
expandtab = true, -- use spaces instead of tab
shiftwidth = 4, -- insert 4 spaces for indentation
tabstop = 4, -- insert 4 spaces for tab
cursorline = true,
cursorline = false,
number = true,
laststatus = 3,
showcmd = false,
@ -52,11 +52,6 @@ vim.cmd "set whichwrap+=<,>,[,],h,l"
vim.cmd "set colorcolumn=80"
vim.cmd [[set iskeyword+=-]]
vim.g.gutentags_generate_on_new = 1
vim.g.gutentags_generate_on_write = 1
vim.g.gutentags_generate_on_missing = 1
vim.g.gutentags_generate_on_empty_buffer = 0
-- Disable snipmate plugins to avoid duplicate snippets
vim.g.UltiSnipsEnableSnipMate = 0
vim.g.UltiSnipsRemoveSelectModeMappings = 0

View File

@ -45,9 +45,6 @@ return packer.startup(function(use)
-- Plugin manager
use("wbthomason/packer.nvim") -- Have packer manage inself
-- Noice :D
-- use("folke/noice.nvim") -- magic by folke.
-- Lua Development
use("nvim-lua/plenary.nvim") -- useful lua functions
use("nvim-lua/popup.nvim")
@ -95,7 +92,6 @@ return packer.startup(function(use)
use("NvChad/nvim-colorizer.lua")
-- Colorschemes
use("folke/tokyonight.nvim")
use("sainnhe/gruvbox-material")
use("sainnhe/sonokai")
use("dracula/vim")
@ -107,6 +103,7 @@ return packer.startup(function(use)
use("moll/vim-bbye")
use("lewis6991/impatient.nvim")
use("ghillb/cybu.nvim")
use("mbbill/undotree")
use("MunifTanjim/nui.nvim")
-- Icons
@ -117,7 +114,6 @@ return packer.startup(function(use)
use("rcarriga/nvim-dap-ui")
-- Tabline
use("akinsho/bufferline.nvim")
use("fgheng/winbar.nvim")
-- Statusline
@ -139,6 +135,7 @@ return packer.startup(function(use)
-- Git
use("lewis6991/gitsigns.nvim")
use("f-person/git-blame.nvim")
use("tpope/vim-fugitive")
-- Editing Support
use("windwp/nvim-autopairs")
@ -156,9 +153,6 @@ return packer.startup(function(use)
use("tpope/vim-surround")
use("danymat/neogen")
-- Notes
use("mickael-menu/zk-nvim")
-- Keybinding
use("folke/which-key.nvim")

View File

@ -85,6 +85,11 @@ local m_mappings = {
h = { '<cmd>lua require("harpoon.ui").nav_prev()<cr>', "Harpoon Prev" },
s = { "<cmd>Telescope harpoon marks<cr>", "Search Files" },
u = { '<cmd>lua require("harpoon.ui").toggle_quick_menu()<cr>', "Harpoon UI" },
['1'] = { '<cmd> lua require("harpoon.ui").nav_file(1)<cr>', 'Goto 1' },
['2'] = { '<cmd> lua require("harpoon.ui").nav_file(2)<cr>', 'Goto 2' },
['3'] = { '<cmd> lua require("harpoon.ui").nav_file(3)<cr>', 'Goto 3' },
['4'] = { '<cmd> lua require("harpoon.ui").nav_file(4)<cr>', 'Goto 4' },
}
local mappings = {
@ -101,6 +106,7 @@ local mappings = {
z = { "<cmd>ZenMode<cr>", "Zen" },
["/"] = { '<cmd>lua require("Comment.api").toggle.linewise.current()<CR>', "Comment" },
["'"] = { "<cmd>close<CR>", "Close split" },
u = { '<cmd>UndoTreeToggle', 'Undo Tree' },
C = {
name = "Compiler",
@ -177,7 +183,7 @@ local mappings = {
g = {
name = "Git",
g = { "<cmd>lua _LAZYGIT_TOGGLE()<CR>", "Lazygit" },
g = { "<cmd>Git<CR>", "Git" },
j = { "<cmd>lua require 'gitsigns'.next_hunk()<cr>", "Next Hunk" },
k = { "<cmd>lua require 'gitsigns'.prev_hunk()<cr>", "Prev Hunk" },
l = { "<cmd>GitBlameToggle<cr>", "Blame" },
@ -234,36 +240,8 @@ local mappings = {
u = { "<cmd>LuaSnipUnlinkCurrent<cr>", "Unlink Snippet" },
M = { "<cmd>Mason<cr>", "Open Mason UI" },
},
T = {
name = "Treesitter",
h = { "<cmd>TSHighlightCapturesUnderCursor<cr>", "Highlight" },
p = { "<cmd>TSPlaygroundToggle<cr>", "Playground" },
r = { "<cmd>TSToggle rainbow<cr>", "Rainbow" },
},
N = {
name = "Notes (zk)",
n = { "<cmd>ZkNew<cr>", "New Note" },
e = { "<cmd>ZkNotes<cr>", "Edit Notes" },
t = { "<cmd>ZkTags<cr>", "Edit Related Notes" },
},
}
local vopts = {
mode = "v", -- VISUAL mode
prefix = "<leader>",
buffer = nil, -- Global mappings. Specify a buffer number for buffer local mappings
silent = true, -- use `silent` when creating keymaps
noremap = true, -- use `noremap` when creating keymaps
nowait = true, -- use `nowait` when creating keymaps
}
local vmappings = {
["/"] = { '<ESC><CMD>lua require("Comment.api").toggle.linewise(vim.fn.visualmode())<CR>', "Comment" },
}
which_key.setup(setup)
which_key.register(mappings, opts)
which_key.register(vmappings, vopts)
which_key.register(m_mappings, m_opts)

View File

@ -1,6 +0,0 @@
local s_ok, zk = pcall(require, "zk")
if not s_ok then
return
end
zk.setup()