From 4d358a5d49bf69a3a689c30ff425ccae19ec08d3 Mon Sep 17 00:00:00 2001 From: Benjamin Chausse Date: Sun, 24 Sep 2023 04:42:06 -0400 Subject: Update 2 to vim config --- lua/ben/core/init.lua | 70 +++++++++++++++++++++++++++++++++--- lua/ben/plugins/bling.lua | 7 ++++ lua/ben/plugins/colorizer.lua | 4 +++ lua/ben/plugins/fugitive.lua | 6 ++++ lua/ben/plugins/nvim-r.lua | 6 ++++ lua/ben/plugins/search-highlight.lua | 7 ++++ lua/ben/plugins/vimtex.lua | 8 +++++ lua/ben/plugins/winresizer.lua | 5 +++ 8 files changed, 109 insertions(+), 4 deletions(-) create mode 100644 lua/ben/plugins/bling.lua create mode 100644 lua/ben/plugins/colorizer.lua create mode 100644 lua/ben/plugins/search-highlight.lua create mode 100644 lua/ben/plugins/winresizer.lua diff --git a/lua/ben/core/init.lua b/lua/ben/core/init.lua index efdb794..e5bb0a2 100644 --- a/lua/ben/core/init.lua +++ b/lua/ben/core/init.lua @@ -1,14 +1,76 @@ -- My Personal Configurations: -- Superior leader key -vim.g.mapleader = ";" +vim.g.mapleader = ";" -- Space is quicker than Shift+Semicolon -vim.keymap.set('n', '', ":") +vim.keymap.set("n", "", ":") -- fm -> File Manager -vim.keymap.set('n', 'fm', "Exp") +vim.keymap.set("n", "fm", "Exp") -- Tree View for the netrw File Manager vim.g.netrw_liststyle = 3 -vim.g.netrw_banner = 3 + +-- Set encoding to UTF-8 +vim.opt.encoding = "utf-8" + +-- Display all matching files when tab completing +vim.opt.wildmenu = true + +-- Don't show the previously typed command +vim.opt.shortmess:append("c") + +-- Set absolute and relative number hybrid +vim.opt.number = true +vim.opt.relativenumber = true + +-- View column count +vim.opt.ruler = true + +-- Disable the statusline +vim.opt.laststatus = 0 + +-- Sensible split directions +vim.opt.splitbelow = true +vim.opt.splitright = true + +-- Set tab width and shift width to 2 +vim.opt.tabstop = 2 +vim.opt.shiftwidth = 2 + +-- Expanding tabs +vim.opt.expandtab = true + +-- Set fold method to marker for Vim folding +vim.opt.foldmethod = "marker" + +-- Spelling +vim.opt.complete:append("kspell") -- Better Spell Checking +vim.opt.spelllang = "fr" -- French prose + +-- Tag Editing +vim.api.nvim_set_keymap("i", "t", "<++>", { noremap = true }) +vim.api.nvim_set_keymap("i", ":", '/<++>"_c4l', { noremap = true }) + +-- Quickly save +vim.api.nvim_set_keymap("n", "w", ":update", { silent = true }) + +-- Logical way to Yank +vim.api.nvim_set_keymap("n", "Y", "y$", {}) + +-- Easily escape terminal mode +vim.api.nvim_set_keymap("t", "", "", {}) + +-- Split motion +vim.api.nvim_set_keymap("n", "", "h", {}) +vim.api.nvim_set_keymap("n", "", "j", {}) +vim.api.nvim_set_keymap("n", "", "k", {}) +vim.api.nvim_set_keymap("n", "", "l", {}) + +-- Saving and quitting buffers +vim.api.nvim_set_keymap("n", "ZF", "ZQ", {}) +vim.api.nvim_set_keymap("n", "w", ":update", { silent = true }) + +-- Remove trailing white spaces on BufWritePre +vim.cmd([[autocmd BufWritePre * %s/\s\+$//e]]) diff --git a/lua/ben/plugins/bling.lua b/lua/ben/plugins/bling.lua new file mode 100644 index 0000000..a0771e1 --- /dev/null +++ b/lua/ben/plugins/bling.lua @@ -0,0 +1,7 @@ +return { + "ivyl/vim-bling", + keys = { + { "/", "/" }, + { "?", "?" }, + }, +} diff --git a/lua/ben/plugins/colorizer.lua b/lua/ben/plugins/colorizer.lua new file mode 100644 index 0000000..c29c9bb --- /dev/null +++ b/lua/ben/plugins/colorizer.lua @@ -0,0 +1,4 @@ +return { + "chrisbra/Colorizer", + event = "VeryLazy", +} diff --git a/lua/ben/plugins/fugitive.lua b/lua/ben/plugins/fugitive.lua index 2ec2c88..4aba739 100644 --- a/lua/ben/plugins/fugitive.lua +++ b/lua/ben/plugins/fugitive.lua @@ -4,4 +4,10 @@ return { cond = function() return vim.fn.isdirectory(".git") == 1 end, + config = function() + vim.keymap.set("n", "gs", ":Git") + vim.keymap.set("n", "gd", ":Git difftool") + vim.keymap.set("n", "gm", ":Gvdiffsplit!") + vim.keymap.set("n", "gc", ":Git commit") + end, } diff --git a/lua/ben/plugins/nvim-r.lua b/lua/ben/plugins/nvim-r.lua index 0a38c0e..fa93005 100644 --- a/lua/ben/plugins/nvim-r.lua +++ b/lua/ben/plugins/nvim-r.lua @@ -1,4 +1,10 @@ return { "jalvesaq/Nvim-R", ft = { "R", "Rnoweb", "tex", "aux", "bib" }, + config = function() + vim.g.r_syntax_folding = 1 + vim.opt.foldnestmax = 1 + vim.opt.foldmethod = "marker" + vim.g.rout_follow_colorscheme = 0 + end, } diff --git a/lua/ben/plugins/search-highlight.lua b/lua/ben/plugins/search-highlight.lua new file mode 100644 index 0000000..e00e17f --- /dev/null +++ b/lua/ben/plugins/search-highlight.lua @@ -0,0 +1,7 @@ +return { + "qxxxb/vim-searchhi", + keys = { + { "/", "/" }, + { "?", "?" }, + }, +} diff --git a/lua/ben/plugins/vimtex.lua b/lua/ben/plugins/vimtex.lua index 38b3676..31ee15e 100644 --- a/lua/ben/plugins/vimtex.lua +++ b/lua/ben/plugins/vimtex.lua @@ -1,4 +1,12 @@ return { "lervag/vimtex", ft = { "texinfo", "tex", "aux", "bib" }, + config = function() + vim.g.vimtex_view_general_viewer = "open" + vim.g.vimtex_view_general_options = "-a zathura" + vim.g.tex_flavor = "latex" + vim.g.tex_no_error = 1 + vim.g.tex_conceal = "abdmg" + vim.api.set_keymap("n", "", "(vimtex-toc-open)", { noremap = false, silent = true }) + end, } diff --git a/lua/ben/plugins/winresizer.lua b/lua/ben/plugins/winresizer.lua new file mode 100644 index 0000000..f920cb5 --- /dev/null +++ b/lua/ben/plugins/winresizer.lua @@ -0,0 +1,5 @@ +return { + "simeji/winresizer", + lazy = true, + keys = { "", "WinResizerStart" }, +} -- cgit v1.2.3