From d0b245d0239059aa34f529d0be498df4ef9c1896 Mon Sep 17 00:00:00 2001 From: "martin f. krafft" Date: Wed, 9 Apr 2025 13:57:02 +0200 Subject: [PATCH] Import options from vimrc --- .config/nvim/init.lua | 48 +++++++++++++++++++++------------------- .config/nvim/keymaps.lua | 14 +++++++----- .config/nvim/options.lua | 20 ++++++++--------- .gitignore.d/neovim | 3 +++ 4 files changed, 47 insertions(+), 38 deletions(-) diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 03c40f1..b6f4e03 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -1,50 +1,52 @@ vim.g.statedir = vim.fn.expand("~/.local/state/nvim/") -vim.g.mapleader = ';' -vim.g.maplocalleader = ';' +vim.g.mapleader = ";" +vim.g.maplocalleader = ";" vim.g.netrw_home = vim.g.statedir .. "netrw" -vim.cmd.runtime 'options.lua' -vim.cmd.runtime 'keymaps.lua' -vim.cmd.runtime 'style.vim' -vim.cmd.runtime 'emojis.vim' +vim.cmd.runtime("options.lua") +vim.cmd.runtime("keymaps.lua") +vim.cmd.runtime("style.vim") +vim.cmd.runtime("emojis.vim") -vim.cmd 'packadd! gnupg' +vim.cmd("packadd! gnupg") -vim.call "plug#begin" +vim.call("plug#begin") -local Plug = vim.fn['plug#'] +local Plug = vim.fn["plug#"] -- My preferred colour scheme -Plug 'wimstefan/vim-artesanal' +Plug("wimstefan/vim-artesanal") -- Git operations from within files -Plug 'tpope/vim-fugitive' +Plug("tpope/vim-fugitive") -- Detect tabstop and shiftwidth automatically -Plug 'tpope/vim-sleuth' +Plug("tpope/vim-sleuth") -- Markdown support, which requires tabular. -Plug 'godlygeek/tabular' -Plug 'preservim/vim-markdown' +Plug("godlygeek/tabular") +Plug("preservim/vim-markdown") -- ExplainPattern to visualise/help with Vim regular expressions -Plug 'Houl/ExplainPattern-vim' +Plug("Houl/ExplainPattern-vim") -- Remember the last editing position -Plug 'farmergreg/vim-lastplace' +Plug("farmergreg/vim-lastplace") -Plug 'neovim/nvim-lspconfig' -Plug 'dense-analysis/ale' +Plug("neovim/nvim-lspconfig") +Plug("dense-analysis/ale") -vim.call "plug#end" +vim.call("plug#end") function hasPlug(plugin) - return vim.g.plugs[plugin] ~= nil + return vim.g.plugs[plugin] ~= nil end function prequire(m) - local ok, err = pcall(require, m) - if not ok then return nil, err end - return err + local ok, err = pcall(require, m) + if not ok then + return nil, err + end + return err end diff --git a/.config/nvim/keymaps.lua b/.config/nvim/keymaps.lua index 891ea02..1fc938d 100644 --- a/.config/nvim/keymaps.lua +++ b/.config/nvim/keymaps.lua @@ -1,12 +1,16 @@ -- this isn't windows, screw the F1->help key -vim.keymap.set({'n', 'v', 'o', 'i'}, '', '') +vim.keymap.set({ "n", "v", "o", "i" }, "", "") -- toggle paste mode with F2 -vim.keymap.set({'n', 'v', 'o', 'i'}, '', ':set invpaste') +vim.keymap.set({ "n", "v", "o", "i" }, "", "set invpaste") -- clear highlights on search when pressing in normal mode -vim.keymap.set('n', '', 'nohlsearch') +vim.keymap.set("n", "", "nohlsearch") -- Pop-up menu navigation with tab -vim.keymap.set('i', '', function() return vim.fn.pumvisible() and "" or "" end, {expr = true, remap = false}) -vim.keymap.set('i', '', function() return vim.fn.pumvisible() and "" or "" end, {expr = true, remap = false}) +vim.keymap.set("i", "", function() + return vim.fn.pumvisible() and "" or "" +end, { expr = true, remap = false }) +vim.keymap.set("i", "", function() + return vim.fn.pumvisible() and "" or "" +end, { expr = true, remap = false }) diff --git a/.config/nvim/options.lua b/.config/nvim/options.lua index 1165c34..206327f 100644 --- a/.config/nvim/options.lua +++ b/.config/nvim/options.lua @@ -13,17 +13,17 @@ vim.opt.smartcase = true ----------------------------------------------------------------------------- -- "dark" or "light"; the background color brightness -vim.opt.background = 'light' +vim.opt.background = "light" ----------------------------------------------------------------------------- --- messages and info ----------------------------------------------------------------------------- -- list of flags to make messages shorter -vim.opt.shortmess = 'atTWoOI' +vim.opt.shortmess = "atTWoOI" -- display the current mode in the status line -vim.opt.showmode = false -- the cursor already reflects the mode +vim.opt.showmode = false -- the cursor already reflects the mode -- do not display a status line unless there is more than one window vim.opt.laststatus = 1 @@ -43,14 +43,14 @@ vim.opt.breakindent = true vim.opt.textwidth = 78 -- list of flags that tell how automatic formatting works -vim.opt.formatoptions = 'tcroqn1l' +vim.opt.formatoptions = "tcroqn1l" -- pattern to recognize a numbered list -- [[…]] is the Lua way to disable escape sequences in strings vim.opt.formatlistpat = [[^\v\s*(((#|\a|\d{,4}|[ivx]{,4})[]:.)}/])+|[-\*.·→+])\s+]] -- whether to use a popup menu for Insert mode completion -vim.opt.completeopt = { 'menu', 'noinsert', 'popup', 'preview' } +vim.opt.completeopt = { "menu", "noinsert", "popup", "preview" } -- number of spaces used for each step of (auto)indent vim.opt.shiftwidth = 2 @@ -75,7 +75,7 @@ vim.opt.undofile = true ----------------------------------------------------------------------------- -- folding type: "manual", "indent", "expr", "marker", "syntax" or "diff" -vim.opt.foldmethod = 'marker' +vim.opt.foldmethod = "marker" ----------------------------------------------------------------------------- --- reading and writing files @@ -95,14 +95,14 @@ vim.opt.autoread = true ----------------------------------------------------------------------------- -- list of directories for the swap file -vim.opt.directory = { '.', vim.g.statedir .. '/swap//', '/var/tmp//', '$TMPDIR//', '/tmp//' } +vim.opt.directory = { ".", vim.g.statedir .. "/swap//", "/var/tmp//", "$TMPDIR//", "/tmp//" } ----------------------------------------------------------------------------- --- command line editing ----------------------------------------------------------------------------- -- list of patterns to ignore files for file name completion -vim.opt.wildignore = { '*.o', '*.pyc', '*.pyo', '*~', '*.bk', '*.bak' } +vim.opt.wildignore = { "*.o", "*.pyc", "*.pyo", "*~", "*.bk", "*.bak" } ----------------------------------------------------------------------------- --- various @@ -112,9 +112,9 @@ vim.opt.wildignore = { '*.o', '*.pyc', '*.pyo', '*~', '*.bk', '*.bak' } vim.opt.secure = true -- list that specifies what to write in the ShaDa file -vim.opt.shada = {'!', '%', '\'100', '/100', ':100', '<100', '@100', 'f1', 'h', 's10' } +vim.opt.shada = { "!", "%", "'100", "/100", ":100", "<100", "@100", "f1", "h", "s10" } -- location of shada file vim.opt.shadafile = vim.g.statedir .. "shada/main.shada" -- disable the mouse entirely -vim.opt.mouse = '' +vim.opt.mouse = "" diff --git a/.gitignore.d/neovim b/.gitignore.d/neovim index d5d9387..fba3a58 100644 --- a/.gitignore.d/neovim +++ b/.gitignore.d/neovim @@ -4,8 +4,11 @@ !/.config/nvim/init.lua !/.config/nvim/keymaps.lua !/.config/nvim/options.lua +<<<<<<< HEAD !/.config/nvim/plugin/ale.lua !/.config/nvim/plugin/highlight-yank.lua +======= +>>>>>>> 27ab3a2 (Import options from vimrc) !/.config/nvim/plugin/listmode.lua !/.config/nvim/plugin/lspconfig.lua !/.config/nvim/plugin/vim-artesanal.lua -- 2.39.5