diff options
| -rw-r--r-- | nvim/.config/nvim/lua/custom/chadrc.lua | 41 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/custom/init.lua | 56 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/custom/mappings.lua | 38 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/custom/plugins/init.lua | 52 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/custom/plugins/lspconfig.lua | 16 | ||||
| -rw-r--r-- | nvim/.config/nvim/lua/custom/plugins/override.lua | 36 |
6 files changed, 239 insertions, 0 deletions
diff --git a/nvim/.config/nvim/lua/custom/chadrc.lua b/nvim/.config/nvim/lua/custom/chadrc.lua new file mode 100644 index 0000000..7cfd28e --- /dev/null +++ b/nvim/.config/nvim/lua/custom/chadrc.lua @@ -0,0 +1,41 @@ +-- This is an example chadrc file , its supposed to be placed in /lua/custom/ + +local M = {} + +local override = require "custom.plugins.override" +local userPlugins = require "custom.plugins" + +M.plugins = { + + options = { + lspconfig = { + setup_lspconf = "custom.plugins.lspconfig", + }, + + statusline = { + separator_style = "round", + }, + }, + + override = { + ["kyazdani42/nvim-tree.lua"] = override.nvimtree, + ["nvim-treesitter/nvim-treesitter"] = override.treesitter, + ["nvim-telescope/telescope.nvim"] = override.telescope, + }, + + user = userPlugins, +} + + + + +-- make sure you maintain the structure of `core/default_config.lua` here, +-- example of changing theme: + +M.ui = { + theme = "onedark", +} + +M.mappings = require "custom.mappings" + +return M diff --git a/nvim/.config/nvim/lua/custom/init.lua b/nvim/.config/nvim/lua/custom/init.lua new file mode 100644 index 0000000..e8e7636 --- /dev/null +++ b/nvim/.config/nvim/lua/custom/init.lua @@ -0,0 +1,56 @@ +-- This is an example init file , its supposed to be placed in /lua/custom/ + +-- This is where your custom modules and plugins go. +-- Please check NvChad docs if you're totally new to nvchad + dont know lua!! + +--print("custom/init.lua") +--print("custom/init.lua") + +local opt = vim.opt + +-- Indenting +opt.expandtab = false +opt.shiftwidth = 4 +opt.tabstop = 4 +opt.smartindent = true + +-- runs a script that cleans out tex build files whenever I close out of a .tex file. +vim.cmd("autocmd VimLeave *.tex !texclear %") + +-- Ensure files are read as what I want: +vim.cmd("autocmd BufRead,BufNewFile /tmp/calcurse*,~/.calcurse/notes/* set filetype=markdown") +vim.cmd("autocmd BufRead,BufNewFile *.ms,*.me,*.mom,*.man set filetype=groff") +vim.cmd("autocmd BufRead,BufNewFile *.tex set filetype=texclear") + +-- save file as sudo on files that require root permission +vim.cmd("cnoremap w!! execute 'silent! write !sudo tee % >/dev/null' <bar> edit!") + +-- automatically delete all trailing whitespace and newlines at end of file on save +vim.cmd([[ +fun! TrimWhitespace() + let l:save = winsaveview() + keeppatterns %s/\s\+$//e + call winrestview(l:save) +endfun +fun! TrimTrailingLines() + let l:save = winsaveview() + keeppatterns :v/\_s*\S/d + call winrestview(l:save) +endfun +autocmd BufWritePre * call TrimWhitespace() +autocmd BufWritePre * call TrimTrailingLines() +]]) + + +-- turn off highlighting on the bits of code that are changed, so the line that is changed is highlighted but the actual text that has changed stands out on the line and is readable +vim.cmd([[ +if &diff + highlight! link DiffText MatchParen +endif +]]) + +-- -- autocompile dwmblocks +-- vim.cmd("autocmd BufWritePost ~/.local/src/dwmblocks/config.h !cd ~/.local/src/dwmblocks/; sudo make install && { killall -q dwmblocks;setsid dwmblocks & "}) + +-- must be here and not in lazy loader parameters +vim.g.livepreview_previewer = "zathura" diff --git a/nvim/.config/nvim/lua/custom/mappings.lua b/nvim/.config/nvim/lua/custom/mappings.lua new file mode 100644 index 0000000..c7510cb --- /dev/null +++ b/nvim/.config/nvim/lua/custom/mappings.lua @@ -0,0 +1,38 @@ +local M = {} + +M.general = { + n = { + -- check file in shellcheck + ["<leader>s"] = {":!clear && shellcheck -x %<CR>", ""}, + -- open bibliography file in split + ["<leader>b"] = {":vsp<space>$BIB<CR>", ""}, + ["<leader>r"] = {":vsp<space>$REFER<CR>", ""}, + -- compile document, be it groff/LaTeX/markdown/etc. + ["<leader>lc"] = {":w! | !compile '<c-r>%'<CR>", ""}, + -- open corresponding .pdf/.html or preview + ["<leader>lp"] = {":!opout <c-r>%<CR><CR>", ""}, + ["<leader>pc"] = {":PackerCompile <CR>", ""}, + ["<F5>"] = {":make run<CR>", ""}, + ["<F7>"] = {":make<CR>", ""}, + --[""] = {"", ""}, + } +} + +M.vim_latex_live_preview = { + n = { + ["<F5>"] = {"<cmd> LLPStartPreview <CR>", ""}, + }, +} + +--M.vimwiki = { +-- n = { +-- ["<leader>wf"] = {"<cmd> VimwikiIndex <CR>", ""}, +-- } +--} + +-- replace all is aliased to S. +-- vimscript prints immediately that I entered search-replace mode, lua does not +-- map("n", "S", ":%s//g<Left><Left>") +vim.cmd("nnoremap S :%s//g<Left><Left>") + +return M diff --git a/nvim/.config/nvim/lua/custom/plugins/init.lua b/nvim/.config/nvim/lua/custom/plugins/init.lua new file mode 100644 index 0000000..942f47c --- /dev/null +++ b/nvim/.config/nvim/lua/custom/plugins/init.lua @@ -0,0 +1,52 @@ +return { + + ["jpalardy/vim-slime"] = { + ft = {"jl", "py", "m"}, + config = function() + vim.g.slime_paste_file = "$HOME/.cache/slime_paste" + vim.g.slime_target = "tmux" + vim.g.slime_default_config = { socket_name = "default", target_pane = "{last}" } + end, + }, + + ["JuliaEditorSupport/julia-vim"] = { + -- lazy load does not work + -- https://github.com/JuliaEditorSupport/julia-vim/issues/269 + -- ft = {"jl"}, + }, + + ["christoomey/vim-tmux-navigator"] = { + ft = {"jl", "py", "m"}, + }, + + ["lervag/vimtex"] = { + ft = {"tex"}, + setup = function() + vim.g.vimtex_view_method = "zathura" + end, + }, + + ["xuhdev/vim-latex-live-preview"] = { + ft = {"tex"}, + config = function() + print("latex-preview config") + --require("custom.plugins.mappings").vim_latex_live_preview() + --local map = require("core.utils").map + --map("n", "<F5>", ":LLPStartPreview<CR>") + vim.g.livepreview_use_biber = 1 + vim.g.livepreview_cursorhold_recompile = 1 + vim.opt.updatetime = 1000 + end, + }, + + ["vimwiki/vimwiki"] = { + config = function() + vim.g.vimwiki_ext2syntax = { ['.Rmd']='markdown', ['.rmd']='markdown', ['.md']='markdown', ['.markdown']='markdown', ['.mdown']='markdown' } + --require("custom.plugins.mappings").vimwiki() + --local map = require("core.utils").map + --map("n", "<leader>ww", ':VimwikiIndex') + local HOME = os.getenv("HOME") + vim.g.vimwiki_list = {{ path = HOME .. '/sync/vimwiki', syntax = 'markdown', ext = '.md' }} + end, + }, +} diff --git a/nvim/.config/nvim/lua/custom/plugins/lspconfig.lua b/nvim/.config/nvim/lua/custom/plugins/lspconfig.lua new file mode 100644 index 0000000..3893903 --- /dev/null +++ b/nvim/.config/nvim/lua/custom/plugins/lspconfig.lua @@ -0,0 +1,16 @@ +local M = {} + +M.setup_lsp = function(attach, capabilities) + local lspconfig = require "lspconfig" + + local servers = { "html", "cssls", "bashls", "emmet_ls", "tsserver", "clangd" } + + for _, lsp in ipairs(servers) do + lspconfig[lsp].setup { + on_attach = attach, + capabilities = capabilities, + } + end +end + +return M diff --git a/nvim/.config/nvim/lua/custom/plugins/override.lua b/nvim/.config/nvim/lua/custom/plugins/override.lua new file mode 100644 index 0000000..7074ff8 --- /dev/null +++ b/nvim/.config/nvim/lua/custom/plugins/override.lua @@ -0,0 +1,36 @@ +-- overriding default plugin configs! + +local M = {} + +M.treesitter = { + ensure_installed = { + "vim", + "html", + "css", + "javascript", + "json", + "toml", + "markdown", + "c", + "bash", + "lua", + "norg", + }, +} + +M.nvimtree = { + git = { + enable = true, + }, +} + +M.telescope = { + extensions = { + -- fd is needed + media_files = { + filetypes = { "png", "webp", "jpg", "jpeg" }, + }, + }, +} + +return M |
