From c296d671ac80a1e91ef7ccc743bd0c4bc3e93f78 Mon Sep 17 00:00:00 2001 From: Steffen Rademacker Date: Mon, 2 Oct 2023 09:58:53 +0200 Subject: [PATCH] even more minimal config (flat file) --- nvim/init.lua | 181 +++++++++++++++++- nvim/lua/autocommands.lua | 39 ---- nvim/lua/config/null-ls.lua | 15 -- nvim/lua/options.lua | 46 ----- nvim/lua/plugins.lua | 83 -------- nvim/lua/{config => plugins}/cmp.lua | 0 nvim/lua/{config => plugins}/colorizer.lua | 0 nvim/lua/{config => plugins}/floaterm.lua | 1 - nvim/lua/{config => plugins}/lint.lua | 4 + nvim/lua/{config => plugins}/lspconfig.lua | 0 nvim/lua/{config => plugins}/lualine.lua | 0 nvim/lua/{config => plugins}/neorg.lua | 0 nvim/lua/{config => plugins}/telescope.lua | 5 + nvim/lua/{config => plugins}/treesitter.lua | 0 nvim/lua/{config => plugins}/vsnip.lua | 0 .../{mappings.lua => plugins/which-key.lua} | 84 ++++---- nvim/lua/{config => plugins}/zen-mode.lua | 0 17 files changed, 223 insertions(+), 235 deletions(-) delete mode 100644 nvim/lua/autocommands.lua delete mode 100644 nvim/lua/config/null-ls.lua delete mode 100644 nvim/lua/options.lua delete mode 100644 nvim/lua/plugins.lua rename nvim/lua/{config => plugins}/cmp.lua (100%) rename nvim/lua/{config => plugins}/colorizer.lua (100%) rename nvim/lua/{config => plugins}/floaterm.lua (70%) rename nvim/lua/{config => plugins}/lint.lua (79%) rename nvim/lua/{config => plugins}/lspconfig.lua (100%) rename nvim/lua/{config => plugins}/lualine.lua (100%) rename nvim/lua/{config => plugins}/neorg.lua (100%) rename nvim/lua/{config => plugins}/telescope.lua (75%) rename nvim/lua/{config => plugins}/treesitter.lua (100%) rename nvim/lua/{config => plugins}/vsnip.lua (100%) rename nvim/lua/{mappings.lua => plugins/which-key.lua} (60%) rename nvim/lua/{config => plugins}/zen-mode.lua (100%) diff --git a/nvim/init.lua b/nvim/init.lua index 33f15364..e2bc4c1a 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -1,4 +1,177 @@ -require('plugins') -require('mappings') -require('options') -require('autocommands') +-- small helper function for loading external plugin config files +local g = vim.g +local set = vim.opt +local setlocal = vim.opt_local +local createCmd = vim.api.nvim_create_autocmd +local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' + +local function get_config (key) + return function() require('plugins/' .. key) end +end + +if not vim.loop.fs_stat(lazypath) then + vim.fn.system({ 'git', 'clone', '--filter=blob:none', 'https://github.com/folke/lazy.nvim.git', '--branch=stable', lazypath }) +end + +-- minimum starter options and settings before loading plugins +set.rtp:prepend(lazypath) +vim.api.nvim_set_keymap('n', '', '', {}) +g.mapleader = ' ' +g.maplocalleader = ' ' + +require('lazy').setup({ + -- The colorscheme of choice + { 'luisiacc/gruvbox-baby', priority = 1000 }, + + -- modern neovim with treesitter, lsp, cmp, vsnips and telescope + { 'neovim/nvim-lspconfig', config = get_config('lspconfig') }, + { 'nvim-treesitter/nvim-treesitter', config = get_config('treesitter'), build = ':TSUpdate' }, + { 'nvim-treesitter/nvim-treesitter-textobjects', dependencies = 'nvim-treesitter/nvim-treesitter' }, + { 'nvim-treesitter/nvim-treesitter-refactor', dependencies = 'nvim-treesitter/nvim-treesitter' }, + { 'nvim-telescope/telescope.nvim', dependencies = 'nvim-lua/plenary.nvim', config = get_config('telescope') }, + { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, + { 'hrsh7th/vim-vsnip', config = get_config('vsnip') }, + { 'rafamadriz/friendly-snippets', dependencies = 'hrsh7th/vim-vsnip' }, + { 'hrsh7th/nvim-cmp', + dependencies = { + 'hrsh7th/cmp-buffer', + 'hrsh7th/cmp-cmdline', + 'hrsh7th/cmp-calc', + 'hrsh7th/cmp-nvim-lsp', + 'hrsh7th/cmp-path', + 'hrsh7th/cmp-vsnip', + }, + config = get_config('cmp'), + }, + + -- interface enhancements + { 'folke/which-key.nvim', event = 'VeryLazy', config = get_config('which-key') }, + { 'folke/zen-mode.nvim', dependencies = 'folke/twilight.nvim', config = get_config('zen-mode') }, + { 'kevinhwang91/nvim-bqf', config = true }, + { 'lewis6991/gitsigns.nvim', config = true }, + { 'norcalli/nvim-colorizer.lua', event = 'BufReadPre', config = get_config('colorizer') }, + { 'nvim-lualine/lualine.nvim', dependencies = 'nvim-tree/nvim-web-devicons', config = get_config('lualine') }, + + -- editing / movement enhancements + { 'AndrewRadev/splitjoin.vim' }, + { 'folke/flash.nvim', event = 'VeryLazy', config = true }, + { 'kylechui/nvim-surround', event = 'VeryLazy', config = true }, + { 'numToStr/Comment.nvim', config = true }, + { 'numToStr/Navigator.nvim', config = true }, + { 'tpope/vim-ragtag' }, -- TODO still needed?! + { 'tpope/vim-repeat' }, -- TODO still needed?! + { 'windwp/nvim-autopairs', event = 'InsertEnter', config = true }, + + -- more plugins and integrations + { 'voldikss/vim-floaterm', config = get_config('floaterm') }, + { 'mfussenegger/nvim-lint', config = get_config('lint') }, + -- TODO formatter with eslint, stylelint, markdownlint and code_actions? + { 'nvim-neorg/neorg', + build = ':Neorg sync-parsers', + dependencies = 'nvim-lua/plenary.nvim', + config = get_config('neorg'), + }, + { 'jackMort/ChatGPT.nvim', + event = 'VeryLazy', + dependencies = { + 'MunifTanjim/nui.nvim', + 'nvim-lua/plenary.nvim', + 'nvim-telescope/telescope.nvim' + }, + config = true, + }, +}) + +-- deactivate python and perl +g.loaded_python_provider = 0 +g.loaded_perl_provider = 0 + +-- general sane vim options +set.breakindent = true +set.clipboard = 'unnamedplus' +set.cmdheight = 1 +set.completeopt = { 'menu', 'menuone', 'noselect' } +set.conceallevel = 2 +set.cpoptions:append('$') +set.cursorline = true +set.foldexpr = 'nvim_treesitter#foldexpr()' +set.foldmethod = 'expr' +set.gdefault = true +set.grepprg = 'rg' +set.hidden = true +set.ignorecase = true +set.infercase = true +set.laststatus = 3 +set.lazyredraw = true +set.list = true +set.listchars = 'extends:»,precedes:«,tab:▸ ,trail:·' +set.foldenable = false +set.showmode = false +set.swapfile = false +set.wrap = false +set.writebackup = false +set.relativenumber = true +set.scrolljump = 5 +set.scrolloff = 3 +set.shiftround = true +set.shiftwidth = 2 +set.shortmess:append('c') +set.showbreak = '\\\\\\\\' +set.showmatch = true +set.sidescroll = 10 +set.sidescrolloff = 5 +set.smartcase = true +set.splitright = true +set.splitbelow = true +set.timeoutlen = 300 +set.updatetime = 300 +set.virtualedit = 'all' +set.visualbell = true +set.wildmode = { 'list:longest', 'list:full' } + +-- colorscheme +set.background = 'dark' +set.termguicolors = true +g.gruvbox_baby_telescope_theme = 1 +vim.cmd 'colorscheme gruvbox-baby' + +-- default language +vim.cmd 'language en_US.UTF-8' + +-- set some autocommand -- TODO refactor those in createCmd if possible +vim.cmd([[ + " Remember last location/cursor in file + autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'\"" | endif + " Autoresize windows/splits when vim resizes + autocmd VimResized * wincmd = + " floaterm integration + autocmd VimEnter * highlight FloatermBorder guibg='#282828' guifg='#fbf1c7' +]]) + +-- make dash-spearated-key"ords on "word" in vim +createCmd({ 'BufEnter', 'BufWinEnter' }, { + pattern = { '*.css', '*.scss', '*.json' }, + callback = function() setlocal.iskeyword:append('-') end, +}) + +-- filetype-specific settings for text-files +createCmd({ 'BufEnter', 'BufWinEnter' }, { + pattern = { '*.md', '*.markdown', '*.rst', '*.txt', 'neomutt-*', '*.mail' }, + callback = function() + setlocal.spell = true + setlocal.spelllang = { 'de', 'en' } + setlocal.wrap = true + setlocal.textwidth = 70 + setlocal.formatoptions:append('q') + end, +}) + +-- filetype-specific settings for mails +createCmd({ 'BufEnter', 'BufWinEnter' }, { + pattern = { 'neomutt-*', '*.mail' }, + callback = function() + setlocal.filetype = 'mail' + setlocal.comments:append('nb:>') + setlocal.formatoptions:append('aw') + end, +}) diff --git a/nvim/lua/autocommands.lua b/nvim/lua/autocommands.lua deleted file mode 100644 index d3bf4f16..00000000 --- a/nvim/lua/autocommands.lua +++ /dev/null @@ -1,39 +0,0 @@ -local setlocal = vim.opt_local -local create = vim.api.nvim_create_autocmd - -vim.cmd([[ - " Remember last location/cursor in file - autocmd BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$") | exe "normal g'\"" | endif - - " Autoresize windows/splits when vim resizes - autocmd VimResized * wincmd = -]]) - --- make dash-spearated-key"ords on "word" in vim -create({ 'BufEnter', 'BufWinEnter' }, { - pattern = { '*.css', '*.scss', '*.json' }, - callback = function() setlocal.iskeyword:append('-') end, -}) - --- filetype-specific settings for text-files -create({ 'BufEnter', 'BufWinEnter' }, { - pattern = { '*.md', '*.markdown', '*.rst', '*.txt', 'neomutt-*', '*.mail' }, - callback = function() - setlocal.spell = true - setlocal.spelllang = { 'de', 'en' } - setlocal.wrap = true - setlocal.textwidth = 70 - setlocal.formatoptions:append('q') - end, -}) - --- filetype-specific settings for mails -create({ 'BufEnter', 'BufWinEnter' }, { - pattern = { 'neomutt-*', '*.mail' }, - callback = function() - setlocal.filetype = 'mail' - setlocal.comments:append('nb:>') - setlocal.formatoptions:append('aw') - end, -}) - diff --git a/nvim/lua/config/null-ls.lua b/nvim/lua/config/null-ls.lua deleted file mode 100644 index 10fa1243..00000000 --- a/nvim/lua/config/null-ls.lua +++ /dev/null @@ -1,15 +0,0 @@ -local null_ls = require('null-ls') -local b = null_ls.builtins - --- register any number of sources simultaneously -local sources = { - -- js and friends via eslint_d - b.formatting.eslint_d, - b.formatting.stylelint.with({ prefer_local = 'node_modules/.bin' }), - b.formatting.markdownlint, - b.code_actions.eslint_d, -} - -null_ls.setup({ - sources = sources, -}) diff --git a/nvim/lua/options.lua b/nvim/lua/options.lua deleted file mode 100644 index 26dd1337..00000000 --- a/nvim/lua/options.lua +++ /dev/null @@ -1,46 +0,0 @@ -vim.opt.breakindent = true -vim.opt.clipboard = 'unnamedplus' -vim.opt.cmdheight = 1 -vim.opt.completeopt = { 'menu', 'menuone', 'noselect' } -vim.opt.conceallevel = 2 -vim.opt.cpoptions:append('$') -vim.opt.cursorline = true -vim.opt.foldexpr = 'nvim_treesitter#foldexpr()' -vim.opt.foldmethod = 'expr' -vim.opt.gdefault = true -vim.opt.grepprg = 'rg' -vim.opt.hidden = true -vim.opt.ignorecase = true -vim.opt.infercase = true -vim.opt.laststatus = 3 -vim.opt.lazyredraw = true -vim.opt.list = true -vim.opt.listchars = 'extends:»,precedes:«,tab:▸ ,trail:·' -vim.opt.foldenable = false -vim.opt.showmode = false -vim.opt.swapfile = false -vim.opt.wrap = false -vim.opt.writebackup = false -vim.opt.relativenumber = true -vim.opt.scrolljump = 5 -vim.opt.scrolloff = 3 -vim.opt.shiftround = true -vim.opt.shiftwidth = 2 -vim.opt.shortmess:append('c') -vim.opt.showbreak = '\\\\\\\\' -vim.opt.showmatch = true -vim.opt.sidescroll = 10 -vim.opt.sidescrolloff = 5 -vim.opt.smartcase = true -vim.opt.splitright = true -vim.opt.splitbelow = true -vim.opt.timeoutlen = 300 -vim.opt.updatetime = 300 -vim.opt.virtualedit = 'all' -vim.opt.visualbell = true -vim.opt.wildmode = { 'list:longest', 'list:full' } - --- colorscheme and default language -vim.g.gruvbox_baby_telescope_theme = 1 -vim.cmd 'colorscheme gruvbox-baby' -vim.cmd 'language en_US.UTF-8' diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua deleted file mode 100644 index 4f6f22db..00000000 --- a/nvim/lua/plugins.lua +++ /dev/null @@ -1,83 +0,0 @@ --- small helper function for loading external plugin config files -local function get_config (key) - return function() require('config/' .. key) end -end - -local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' -if not vim.loop.fs_stat(lazypath) then - vim.fn.system({ 'git', 'clone', '--filter=blob:none', 'https://github.com/folke/lazy.nvim.git', '--branch=stable', lazypath }) -end - --- minimum starter options and settings before loading plugins -vim.api.nvim_set_keymap('n', '', '', {}) -vim.g.mapleader = ' ' -vim.g.maplocalleader = ' ' -vim.g.loaded_python_provider = 0 -vim.g.loaded_perl_provider = 0 -vim.opt.rtp:prepend(lazypath) -vim.opt.background = 'dark' -vim.opt.termguicolors = true - -require('lazy').setup({ - -- The colorscheme of choice - { 'luisiacc/gruvbox-baby', priority = 1000 }, - - -- modern neovim with treesitter, lsp, cmp, vsnips and telescope - { 'neovim/nvim-lspconfig', config = get_config('lspconfig') }, - { 'nvim-treesitter/nvim-treesitter', config = get_config('treesitter'), build = ':TSUpdate' }, - { 'nvim-treesitter/nvim-treesitter-textobjects', dependencies = 'nvim-treesitter/nvim-treesitter' }, - { 'nvim-treesitter/nvim-treesitter-refactor', dependencies = 'nvim-treesitter/nvim-treesitter' }, - { 'nvim-telescope/telescope.nvim', dependencies = 'nvim-lua/plenary.nvim', config = get_config('telescope') }, - { 'nvim-telescope/telescope-fzf-native.nvim', build = 'make' }, - { 'hrsh7th/vim-vsnip', config = get_config('vsnip') }, - { 'rafamadriz/friendly-snippets', dependencies = 'hrsh7th/vim-vsnip' }, - { 'hrsh7th/nvim-cmp', - dependencies = { - 'hrsh7th/cmp-buffer', - 'hrsh7th/cmp-cmdline', - 'hrsh7th/cmp-calc', - 'hrsh7th/cmp-nvim-lsp', - 'hrsh7th/cmp-path', - 'hrsh7th/cmp-vsnip', - }, - config = get_config('cmp'), - }, - - -- interface enhancements - { 'folke/which-key.nvim', event = 'VeryLazy', config = true }, - { 'folke/zen-mode.nvim', dependencies = 'folke/twilight.nvim', config = get_config('zen-mode') }, - { 'kevinhwang91/nvim-bqf', config = true }, - { 'lewis6991/gitsigns.nvim', config = true }, - { 'norcalli/nvim-colorizer.lua', event = 'BufReadPre', config = get_config('colorizer') }, - { 'nvim-lualine/lualine.nvim', dependencies = 'nvim-tree/nvim-web-devicons', config = get_config('lualine') }, - - -- editing / movement enhancements - { 'AndrewRadev/splitjoin.vim' }, - { 'folke/flash.nvim', event = 'VeryLazy', config = true }, - { 'kylechui/nvim-surround', event = 'VeryLazy', config = true }, - { 'numToStr/Comment.nvim', config = true }, - { 'numToStr/Navigator.nvim', config = true }, - { 'tpope/vim-ragtag' }, -- TODO still needed?! - { 'tpope/vim-repeat' }, -- TODO still needed?! - { 'windwp/nvim-autopairs', event = 'InsertEnter', config = true }, - - -- more plugins and integrations - { 'voldikss/vim-floaterm', config = get_config('floaterm') }, - { 'mfussenegger/nvim-lint', config = get_config('lint') }, - -- TODO replace null-ls with formatter ?! - { 'jose-elias-alvarez/null-ls.nvim', config = get_config('null-ls'), dependencies = 'nvim-lua/plenary.nvim' }, - { 'nvim-neorg/neorg', - build = ':Neorg sync-parsers', - dependencies = 'nvim-lua/plenary.nvim', - config = get_config('neorg'), - }, - { 'jackMort/ChatGPT.nvim', - event = 'VeryLazy', - dependencies = { - 'MunifTanjim/nui.nvim', - 'nvim-lua/plenary.nvim', - 'nvim-telescope/telescope.nvim' - }, - config = true, - }, -}) diff --git a/nvim/lua/config/cmp.lua b/nvim/lua/plugins/cmp.lua similarity index 100% rename from nvim/lua/config/cmp.lua rename to nvim/lua/plugins/cmp.lua diff --git a/nvim/lua/config/colorizer.lua b/nvim/lua/plugins/colorizer.lua similarity index 100% rename from nvim/lua/config/colorizer.lua rename to nvim/lua/plugins/colorizer.lua diff --git a/nvim/lua/config/floaterm.lua b/nvim/lua/plugins/floaterm.lua similarity index 70% rename from nvim/lua/config/floaterm.lua rename to nvim/lua/plugins/floaterm.lua index 972ce89b..4dc5b43b 100644 --- a/nvim/lua/config/floaterm.lua +++ b/nvim/lua/plugins/floaterm.lua @@ -4,4 +4,3 @@ vim.g.floaterm_autoclose = 1 vim.g.floaterm_opener = 'edit' vim.g.floaterm_borderchars = '─│─│╭╮╯╰' vim.g.floaterm_title = '' -vim.cmd('au VimEnter * highlight FloatermBorder guibg="#282828" guifg="#fbf1c7"') diff --git a/nvim/lua/config/lint.lua b/nvim/lua/plugins/lint.lua similarity index 79% rename from nvim/lua/config/lint.lua rename to nvim/lua/plugins/lint.lua index fb97620e..f6c42bf6 100644 --- a/nvim/lua/config/lint.lua +++ b/nvim/lua/plugins/lint.lua @@ -11,6 +11,10 @@ require('lint').linters_by_ft = { typescriptreact = { 'tsc', 'eslint_d' }, } +-- TODO stylelint for local files :/ override args/cwd +local stylelint = require('lint').linters.stylelint +require('lint').linters.stylelint = stylelint + vim.api.nvim_create_autocmd({ 'BufWritePost' }, { pattern = { '*.js', '*.ts', '*.jsx', '*.tsx', diff --git a/nvim/lua/config/lspconfig.lua b/nvim/lua/plugins/lspconfig.lua similarity index 100% rename from nvim/lua/config/lspconfig.lua rename to nvim/lua/plugins/lspconfig.lua diff --git a/nvim/lua/config/lualine.lua b/nvim/lua/plugins/lualine.lua similarity index 100% rename from nvim/lua/config/lualine.lua rename to nvim/lua/plugins/lualine.lua diff --git a/nvim/lua/config/neorg.lua b/nvim/lua/plugins/neorg.lua similarity index 100% rename from nvim/lua/config/neorg.lua rename to nvim/lua/plugins/neorg.lua diff --git a/nvim/lua/config/telescope.lua b/nvim/lua/plugins/telescope.lua similarity index 75% rename from nvim/lua/config/telescope.lua rename to nvim/lua/plugins/telescope.lua index 7b9174db..31c1401c 100644 --- a/nvim/lua/config/telescope.lua +++ b/nvim/lua/plugins/telescope.lua @@ -7,6 +7,11 @@ require('telescope').setup({ width = 0.9, height = 0.9, }, + borderchars = { + prompt = { '─', ' ', ' ', ' ', '─', '─', ' ', ' ' }, + results = { ' ' }, + preview = { ' ' }, + }, }, extensions = { fzf = { diff --git a/nvim/lua/config/treesitter.lua b/nvim/lua/plugins/treesitter.lua similarity index 100% rename from nvim/lua/config/treesitter.lua rename to nvim/lua/plugins/treesitter.lua diff --git a/nvim/lua/config/vsnip.lua b/nvim/lua/plugins/vsnip.lua similarity index 100% rename from nvim/lua/config/vsnip.lua rename to nvim/lua/plugins/vsnip.lua diff --git a/nvim/lua/mappings.lua b/nvim/lua/plugins/which-key.lua similarity index 60% rename from nvim/lua/mappings.lua rename to nvim/lua/plugins/which-key.lua index 3c7066ca..d7770554 100644 --- a/nvim/lua/mappings.lua +++ b/nvim/lua/plugins/which-key.lua @@ -1,12 +1,3 @@ --- helper function for easier mappings -local map = function(mode, lhs, rhs, opts) - return vim.api.nvim_set_keymap(mode, lhs, rhs, vim.tbl_extend('keep', opts or {}, { - nowait = true, - silent = true, - noremap = true, - })) -end - local wk = require('which-key') wk.register({ @@ -37,34 +28,6 @@ wk.register({ S = { function() require('flash').treesitter() end, 'flash treesitter select' }, Y = { 'y$', 'yank till end of line with Y'}, - -- all normal mode leader key mappings in one place - [''] = { - [','] = { 'Telescope find_files', '' }, - ['-'] = { 'sj', '' }, - ['.'] = { 'Telescope buffers', '' }, - ['/'] = { 'Telescope search_history', '' }, - [';'] = { 'Telescope command_history', '' }, - ['\''] = { 'Telescope git_files', '' }, - ['\\'] = { 'vl', '' }, - [']'] = { 'Telescope current_buffer_fuzzy_find', '' }, - a = { 'Telescope live_grep', '' }, - b = { 'Telescope git_branches', '' }, - c = { 'Telescope git_bcommits', '' }, - d = { 'lua vim.lsp.buf.declaration()', '' }, - e = { 'lua vim.diagnostic.goto_next()', '' }, - f = { 'lua vim.lsp.buf.formatting()', '' }, - h = { 'lua vim.lsp.buf.hover()', '' }, - r = { 'lua vim.lsp.buf.rename()', '' }, - x = { 'lua vim.lsp.buf.code_action()', '' }, - l = { 'FloatermNew lazygit', '' }, - t = { 'FloatermNew', '' }, - v = { - ve = { 'e $MYVIMRC', '' }, - vr = { 'source $MYVIMRC', '' }, - }, - w = { 'set wrap! wrap?', '' }, - }, - -- with as modifier [''] = { 'NavigatorLeft', '' }, [''] = { 'NavigatorDown', '' }, @@ -79,10 +42,39 @@ wk.register({ [''] = { '>>', 'bubbling lines with alt-hjkl', noremap = false }, }) --- non-normal-mode mappings +-- all normal mode leader key mappings in one place +wk.register({ + ['\\'] = { 'vl', 'Vertical split' }, + ['-'] = { 'sj', 'Horizontal split' }, + [','] = { 'Telescope find_files', 'Telescope find files' }, + ['.'] = { 'Telescope buffers', 'Telescope find buffers' }, + ['\''] = { 'Telescope git_files', 'Telescope in git files' }, + ['/'] = { 'Telescope search_history', 'Telescope find in search history' }, + [';'] = { 'Telescope command_history', 'Telescope find in command history' }, + [']'] = { 'Telescope current_buffer_fuzzy_find', 'Telescope in current buffer' }, + + a = { 'Telescope live_grep', '' }, + b = { 'Telescope git_branches', '' }, + c = { 'Telescope git_bcommits', '' }, + d = { 'lua vim.lsp.buf.declaration()', '' }, + e = { 'lua vim.diagnostic.goto_next()', '' }, + f = { 'lua vim.lsp.buf.formatting()', '' }, + h = { 'lua vim.lsp.buf.hover()', '' }, + r = { 'lua vim.lsp.buf.rename()', '' }, + x = { 'lua vim.lsp.buf.code_action()', '' }, + l = { 'FloatermNew lazygit', '' }, + t = { 'FloatermNew', '' }, + v = { + ve = { 'e $MYVIMRC', '' }, + vr = { 'source $MYVIMRC', '' }, + }, + w = { 'set wrap! wrap?', '' }, +}, { prefix = '' }) + +-- visual-mode mappings wk.register({ [';'] = { ':', 'Colon with semicolon' }, - v = { '', 'remapping visual/visual-block mode', }, + v = { '', 'remapping visual/visual-block mode' }, -- with as modifier [''] = { 'v', 'remapping visual/visual-block mode' }, @@ -94,13 +86,11 @@ wk.register({ [''] = { '>gv', 'bubbling lines with alt-hjkl', noremap = false }, }, { mode = 'v' }) +-- non-normal-mode mappings wk.register({ [''] = { 'vsnip#available(-1) ? "(vsnip-jump-prev)" : ""', 'snippet expansion' }, -}, { mode = 's', expr = true, noremap = true }) - --- add undo-repo-breakpoints automatically when writing long text --- TODO only for prose (mail md etc) --- map('i', ',', ',u') --- map('i', '.', '.u') --- map('i', '!', '!u') --- map('i', '?', '?u') +}, { + mode = 's', + expr = true, + noremap = true +}) diff --git a/nvim/lua/config/zen-mode.lua b/nvim/lua/plugins/zen-mode.lua similarity index 100% rename from nvim/lua/config/zen-mode.lua rename to nvim/lua/plugins/zen-mode.lua