diff --git a/init.lua b/init.lua index e708684..792445d 100644 --- a/init.lua +++ b/init.lua @@ -5,6 +5,10 @@ for _, m in ipairs({ 'netrw', 'netrwPlugin', 'gzip', 'tarPlugin', 'zipPlugin', ' vim.g['loaded_' .. m] = 1 end +for _, p in ipairs({ 'node', 'python3', 'perl', 'ruby' }) do + vim.g['loaded_' .. p .. '_provider'] = 0 +end + -- Config Global vim.pack.add({ 'https://github.com/nvim-mini/mini.nvim' }) local misc = require('mini.misc') diff --git a/lua/git.lua b/lua/git.lua index 8dca257..96561df 100644 --- a/lua/git.lua +++ b/lua/git.lua @@ -14,12 +14,17 @@ end return { status = function() - local items = {} - for _, l in ipairs(vim.fn.systemlist('git status -s -u')) do - local p = l:sub(4):gsub('.* %-> ', '') - if vim.uv.fs_stat(p) then items[#items + 1] = { text = l, path = p } end + local lines = vim.fn.systemlist('git status -s -u') + if vim.v.shell_error ~= 0 then + return vim.notify('Not a git repository', vim.log.levels.WARN) end - if #items == 0 then return vim.notify('No changes') end + + local items = {} + for _, l in ipairs(lines) do + local p = l:sub(4):gsub('.* %-> ', ''):gsub('^"(.*)"$', '%1') + items[#items + 1] = { text = l, path = p } + end + if #items == 0 then return vim.notify('No changes', vim.log.levels.INFO) end MiniPick.start({ source = { items = items, name = 'Git Status', show = show }, diff --git a/plugin/10_options.lua b/plugin/10_options.lua index 8d91467..cff3469 100644 --- a/plugin/10_options.lua +++ b/plugin/10_options.lua @@ -4,25 +4,26 @@ vim.o.undofile = true -- Enable persistent undo vim.o.shada = "'100,<50,s10,:1000,/100,@100,h" -- Limit ShaDa file (for startup) -- UI -vim.o.breakindent = true -- Indent wrapped lines to match line start -vim.o.breakindentopt = 'list:-1' -- Add padding for lists (if 'wrap' is set) -vim.o.cursorline = true -- Enable current line highlighting -vim.o.linebreak = true -- Wrap lines at 'breakat' (if 'wrap' is set) -vim.o.list = true -- Show helpful text indicators -vim.o.number = true -- Show line numbers -vim.o.pumheight = 10 -- Make popup menu smaller -vim.o.pummaxwidth = 80 -- Make popup menu not too wide -vim.o.shortmess = 'CFOSWacou' -- Disable some built-in completion messages -vim.o.signcolumn = 'yes' -- Always show signcolumn (less flicker) -vim.o.splitbelow = true -- Horizontal splits will be below -vim.o.splitkeep = 'screen' -- Reduce scroll during window split -vim.o.splitright = true -- Vertical splits will be to the right -vim.o.wrap = false -- Don't visually wrap lines -vim.o.winborder = 'rounded' -- Use border in floating windows -vim.o.pumborder = 'rounded' -- Use border in popup menu -vim.o.cmdheight = 0 -- Hide the command line when not in use -vim.cmd('syntax off') -- Disable legacy syntax highlighting -require('vim._core.ui2').enable({ -- Enable new ui (requires nightly) +vim.o.breakindent = true -- Indent wrapped lines to match line start +vim.o.breakindentopt = 'list:-1' -- Add padding for lists (if 'wrap' is set) +vim.o.cursorline = true -- Enable current line highlighting +vim.o.linebreak = true -- Wrap lines at 'breakat' (if 'wrap' is set) +vim.o.list = true -- Show helpful text indicators +vim.o.listchars = 'tab:→ ,trail:·,nbsp:␣' -- Characters for list mode +vim.o.number = true -- Show line numbers +vim.o.pumheight = 10 -- Make popup menu smaller +vim.o.pummaxwidth = 80 -- Make popup menu not too wide +vim.o.shortmess = 'CFOSWacou' -- Disable some built-in completion messages +vim.o.signcolumn = 'yes' -- Always show signcolumn (less flicker) +vim.o.splitbelow = true -- Horizontal splits will be below +vim.o.splitkeep = 'screen' -- Reduce scroll during window split +vim.o.splitright = true -- Vertical splits will be to the right +vim.o.wrap = false -- Don't visually wrap lines +vim.o.winborder = 'rounded' -- Use border in floating windows +vim.o.pumborder = 'rounded' -- Use border in popup menu +vim.o.cmdheight = 0 -- Hide the command line when not in use +vim.cmd('syntax off') -- Disable legacy syntax highlighting +require('vim._core.ui2').enable({ -- Enable new ui (requires nightly) msg = { targets = 'msg' } }) diff --git a/plugin/20_keymaps.lua b/plugin/20_keymaps.lua index e4ec1e5..67fcc49 100644 --- a/plugin/20_keymaps.lua +++ b/plugin/20_keymaps.lua @@ -58,7 +58,8 @@ end nmap_leader('ed', 'lua MiniFiles.open()', 'Directory') nmap_leader('ef', explore_at_file, 'File directory') -nmap_leader('ey', 'lua vim.fn.setreg("+", vim.api.nvim_buf_get_name(0))', 'Yank absolute path') +nmap_leader('ey', 'lua vim.fn.setreg("+", vim.fn.fnamemodify(vim.api.nvim_buf_get_name(0), ":."))', 'Yank absolute path') +nmap_leader('eY', 'lua vim.fn.setreg("+", vim.api.nvim_buf_get_name(0))', 'Yank relative path') nmap_leader('en', 'messages', 'Notifications') -- Find @@ -74,6 +75,7 @@ nmap_leader('fh', 'Pick help', 'Help tags') nmap_leader('fl', 'Pick buf_lines scope="all"', 'Lines (all)') nmap_leader('fL', 'Pick buf_lines scope="current"', 'Lines (buf)') nmap_leader('fm', 'Pick git_status', 'Modified / changed files') +nmap_leader('fo', 'Pick oldfiles', 'Old / recent files') nmap_leader('fr', 'Pick resume', 'Resume') nmap_leader('fs', 'Pick lsp scope="workspace_symbol_live"', 'Symbols workspace') nmap_leader('fS', 'Pick lsp scope="document_symbol"', 'Symbols document') diff --git a/plugin/30_mini.lua b/plugin/30_mini.lua index 19c9669..f0835f2 100644 --- a/plugin/30_mini.lua +++ b/plugin/30_mini.lua @@ -12,7 +12,16 @@ Config.now(function() return vim.iter({ vim.fn.glob('~/Code/*', 0, 1), vim.fn.glob('~/Documents/*/*', 0, 1) }) :flatten() :filter(function(p) return vim.fn.isdirectory(p) == 1 end) - :map(function(p) return { name = vim.fn.fnamemodify(p, ':t'), action = 'edit ' .. vim.fn.fnameescape(p), section = 'Projects' } end) + :map(function(p) + return { + name = vim.fn.fnamemodify(p, ':t'), + action = function() + vim.fn.chdir(p) + require('mini.files').open(p) + end, + section = 'Projects', + } + end) :totable() end, @@ -47,7 +56,7 @@ Config.later(function() { mode = { 'n', 'x' }, keys = 'g' }, { mode = { 'n', 'x' }, keys = "'" }, { mode = { 'n', 'x' }, keys = '`' }, - { mode = { 'n', 'x' }, keys = "'" }, + { mode = { 'n', 'x' }, keys = '"' }, { mode = { 'i', 'c' }, keys = '' }, { mode = 'n', keys = '' }, { mode = { 'n', 'x' }, keys = 's' },