commit 47b205bd344c1eeb71188798deea1f5c2eb22089
parent a56af0ae9fd2f0b5c57be5db1c5ebdf262360426
Author: Tomas Nemec <owl@gtms.dev>
Date: Tue, 12 Dec 2023 08:40:25 +0100
update
Diffstat:
12 files changed, 121 insertions(+), 248 deletions(-)
diff --git a/after/plugin/cmp.lua b/after/plugin/cmp.lua
@@ -57,7 +57,7 @@ local function close()
fallback = Codeium.Clear
end
- if not cmp.close() then
+ if not cmp.abort() then
fallback()
end
end
@@ -91,7 +91,7 @@ cmp.setup({
end,
},
mapping = {
- ['<c-e>'] = cmp.mapping({ i = close(), c = cmp.mapping.close() }),
+ ['<c-e>'] = cmp.mapping({ i = close(), c = cmp.mapping.abort() }),
['<c-y>'] = cmp.mapping.confirm({ select = true }),
['<c-u>'] = cmp.mapping(cmp.mapping.scroll_docs(4), { 'i', 'c' }),
['<c-d>'] = cmp.mapping(cmp.mapping.scroll_docs(-4), { 'i', 'c' }),
@@ -138,31 +138,61 @@ cmp.setup({
-- experimental = { ghost_text = false },
})
--- cmp.setup.cmdline('/', {
--- --
--- mapping = {
--- ['<c-e>'] = { c = cmp.mapping.close() },
--- ['<c-y>'] = { c = cmp.mapping.confirm({ select = true }) },
--- -- ['<c-space>'] = cmp.mapping { c = doOrOpen(cmp.confirm, { select = true }) },
--- ['<c-p>'] = cmp.mapping({ c = doOrOpen(cmp.select_prev_item, { behavior = cmp.SelectBehavior.Select }) }),
--- ['<c-n>'] = cmp.mapping({ c = doOrOpen(cmp.select_next_item, { behavior = cmp.SelectBehavior.Select }) }),
--- },
--- sources = cmp.config.sources({ { name = 'buffer' } }),
--- })
+cmp.setup.cmdline('/', {
+ --
+ mapping = {
+ ['<c-e>'] = cmp.mapping { c = cmp.mapping.abort() },
+ ['<c-y>'] = cmp.mapping { c = cmp.mapping.confirm({ select = true }) },
+ ['<c-p>'] = cmp.mapping {
+ c = function(fallback)
+ if cmp.visible() then
+ cmp.select_prev_item()
+ else
+ fallback()
+ end
+ end,
+ },
+ ['<c-n>'] = cmp.mapping {
+ c = function(fallback)
+ if cmp.visible() then
+ cmp.select_next_item()
+ else
+ fallback()
+ end
+ end,
+ },
+ },
+ sources = cmp.config.sources({ { name = 'buffer' } }),
+})
--- cmp.setup.cmdline(':', {
--- mapping = {
--- ['<c-e>'] = { c = cmp.mapping.close() },
--- ['<c-y>'] = { c = cmp.mapping.confirm({ select = true }) },
--- -- ['<c-space>'] = cmp.mapping { c = doOrOpen(cmp.confirm, { select = true }) },
--- ['<c-p>'] = cmp.mapping({ c = doOrOpen(cmp.select_prev_item, { behavior = cmp.SelectBehavior.Select }) }),
--- ['<c-n>'] = cmp.mapping({ c = doOrOpen(cmp.select_next_item, { behavior = cmp.SelectBehavior.Select }) }),
--- },
--- sources = cmp.config.sources({ --
--- { name = 'path' },
--- }, { --
--- { name = 'cmdline' },
--- }, { --
--- { name = 'cmdline_history' },
--- }),
--- })
+cmp.setup.cmdline(':', {
+ mapping = {
+ ['<c-e>'] = cmp.mapping { c = cmp.mapping.abort() },
+ ['<c-y>'] = cmp.mapping { c = cmp.mapping.confirm({ select = true }) },
+ ['<c-p>'] = cmp.mapping {
+ c = function(fallback)
+ if cmp.visible() then
+ cmp.select_prev_item()
+ else
+ fallback()
+ end
+ end,
+ },
+ ['<c-n>'] = cmp.mapping {
+ c = function(fallback)
+ if cmp.visible() then
+ cmp.select_next_item()
+ else
+ fallback()
+ end
+ end,
+ },
+ },
+ sources = cmp.config.sources({ --
+ { name = 'path' },
+ }, { --
+ { name = 'cmdline' },
+ }, { --
+ { name = 'cmdline_history' },
+ }),
+})
diff --git a/after/plugin/colorizer.lua b/after/plugin/colorizer.lua
@@ -1,11 +1,13 @@
-if pcall(require, 'colorizer') then
- require'colorizer'.setup({
- filetypes = { 'css', 'scss', 'html' },
- user_default_options = {
- css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
- sass = { enable = true }, -- Enable sass colors
- virtualtext = '■',
- mode = 'background',
- },
- })
+if not pcall(require, 'colorizer') then
+ return
end
+
+require('colorizer').setup {
+ filetypes = { 'css', 'scss', 'html' },
+ user_default_options = {
+ css = true, -- Enable all CSS features: rgb_fn, hsl_fn, names, RGB, RRGGBB
+ sass = { enable = true }, -- Enable sass colors
+ virtualtext = '■',
+ mode = 'background',
+ },
+}
diff --git a/after/plugin/fidget.lua b/after/plugin/fidget.lua
@@ -2,7 +2,4 @@ if not pcall(require, 'fidget') then
return
end
-require('fidget').setup {
- text = { spinner = 'moon', done = '', commenced = '', completed = '' },
- timer = { spinner_rate = 60, fidget_decay = 0, task_decay = 0 },
-}
+require('fidget').setup { progress = { display = { done_ttl = 0.5, progress_icon = { pattern = 'moon' } } } }
diff --git a/after/plugin/hardtime.lua b/after/plugin/hardtime.lua
@@ -2,8 +2,4 @@ if not pcall(require, 'hardtime') then
return
end
-do
- return
-end
-
require('hardtime').setup()
diff --git a/after/plugin/nvim-terminal.lua b/after/plugin/nvim-terminal.lua
@@ -1,6 +0,0 @@
-if not pcall(require, 'terminal') then
- return
-end
-
-local terminal = require('terminal')
-terminal.setup()
diff --git a/after/plugin/rest-nvim.lua b/after/plugin/rest-nvim.lua
@@ -1,6 +1,16 @@
-if not pcall(require, 'rest-nvim') then return end
+if not pcall(require, 'rest-nvim') then
+ return
+end
-require('rest-nvim').setup()
-vim.api.nvim_create_user_command('Rest', function() require('rest-nvim').run(false) end, {})
-vim.api.nvim_create_user_command('RestPreview', function() require('rest-nvim').run(true) end, {})
-vim.api.nvim_create_user_command('RestLast', require('rest-nvim').last, {})
+local rest = require('rest-nvim')
+rest.setup()
+
+vim.api.nvim_create_user_command('Rest', function()
+ rest.run(false)
+end, { desc = 'Rest Run' })
+
+vim.api.nvim_create_user_command('RestPreview', function()
+ rest.run(true)
+end, { desc = 'Rest Run Preview' })
+
+vim.api.nvim_create_user_command('RestLast', rest.last, { desc = 'Rest Last' })
diff --git a/after/plugin/sidebar.lua b/after/plugin/sidebar.lua
@@ -1,21 +0,0 @@
--- if not pcall(require, 'sidebar-nvim') then
-do
- return
-end
-
-local files = require('tms.p.sidebar.files')
--- local gitlab = require('tms.p.sidebar.gitlab')
-
-require('sidebar-nvim').setup({
- initial_width = 40,
- hide_statusline = true,
- sections = {
- files.section,
- 'diagnostics',
- --[[ , gitlab.section ]]
- },
- disable_closing_prompt = true,
-})
-
--- vim.keymap.set('n', '<space>s', '<cmd>SidebarNvimToggle<cr>')
--- vim.keymap.set('n', '<space>S', '<cmd>SidebarNvimFocus<cr>')
diff --git a/after/plugin/ts-autotag.lua b/after/plugin/ts-autotag.lua
@@ -1,2 +1,5 @@
- if not pcall(require, 'nvim-ts-autotag') then return end
- require('nvim-ts-autotag').setup({})
+if not pcall(require, 'nvim-ts-autotag') then
+ return
+end
+
+require('nvim-ts-autotag').setup {}
diff --git a/lua/plugins.lua b/lua/plugins.lua
@@ -3,60 +3,49 @@ return require('paq') {
{ 'savq/paq-nvim', opt = true },
'kyazdani42/nvim-web-devicons',
'nvim-lua/plenary.nvim',
- 'nvim-lua/popup.nvim', -- EXP
- 'yioneko/nvim-type-fmt', -- meta
- 'tweekmonster/startuptime.vim', -- colorscheme
- 'xxdavid/bez-diakritiky.vim', -- movements
+ 'nvim-lua/popup.nvim',
+ 'yioneko/nvim-type-fmt',
+ 'tweekmonster/startuptime.vim',
+ 'xxdavid/bez-diakritiky.vim',
'ggandor/leap.nvim',
- 'ggandor/leap-spooky.nvim', -- editor
+ 'ggandor/leap-spooky.nvim',
'tpope/vim-repeat',
'kylechui/nvim-surround',
'chaoren/vim-wordmotion', -- word counts with _,.,-,...
'romgrk/equal.operator', -- equal text object `lefthand = righthand`
- 'godlygeek/tabular', -- align
- -- use 'windwp/nvim-autopairs'
+ { 'godlygeek/tabular', opt = true }, -- align
'numToStr/Comment.nvim',
- 'mbbill/undotree', -- use 'camspiers/Animate.vim'
+ 'mbbill/undotree',
'nvchad/nvim-colorizer.lua',
'rainbowhxch/beacon.nvim',
- -- use 'Yggdroot/hiPairs'
'karb94/neoscroll.nvim',
- { 'sidebar-nvim/sidebar.nvim', requires = { 'kyazdani42/nvim-web-devicons' } },
- -- use { 'kevinhwang91/nvim-ufo', requires = { 'kevinhwang91/promise-async' } }
'elihunter173/dirbuf.nvim',
- 'norcalli/nvim-terminal.lua',
- { 'j-hui/fidget.nvim', branch = 'legacy' },
- 'lervag/vimtex', -- lua
- 'nanotee/luv-vimdocs',
- 'milisims/nvim-luaref', -- Notes
+ 'j-hui/fidget.nvim',
+ { 'lervag/vimtex', opt = true },
+ 'milisims/nvim-luaref',
-- { 'nvim-neorg/neorg', requires = { 'nvim-lua/plenary.nvim' } }
- { 'mickael-menu/zk-nvim' }, -- quickfix list
- 'kevinhwang91/nvim-bqf', -- distraction
- 'junegunn/limelight.vim',
- 'Pocco81/true-zen.nvim',
- 'shortcuts/no-neck-pain.nvim', -- how to vim
- 'ThePrimeagen/vim-be-good',
+ { 'mickael-menu/zk-nvim', opt = true }, -- quickfix list
+ 'kevinhwang91/nvim-bqf',
+ 'shortcuts/no-neck-pain.nvim',
'nagy135/typebreak.nvim',
- 'm4xshen/hardtime.nvim', -- vcs
+ 'm4xshen/hardtime.nvim',
{ 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } },
'sindrets/diffview.nvim',
'tpope/vim-fugitive',
'ThePrimeagen/git-worktree.nvim',
- 'rhysd/conflict-marker.vim', -- http
- { 'rest-nvim/rest.nvim', requires = { 'nvim-lua/plenary.nvim' } }, -- filetype
+ 'rhysd/conflict-marker.vim',
+ { 'rest-nvim/rest.nvim', requires = { 'nvim-lua/plenary.nvim' }, opt = true }, -- filetype
'tikhomirov/vim-glsl',
'windwp/nvim-ts-autotag',
'baskerville/vim-sxhkdrc',
- -- use 'dart-lang/dart-vim-plugin'
'mfussenegger/nvim-jdtls',
- 'akinsho/pubspec-assist.nvim', -- snippets
+ 'akinsho/pubspec-assist.nvim',
'dmitmel/cmp-cmdline-history',
'f3fora/cmp-spell',
'hrsh7th/cmp-buffer',
'hrsh7th/cmp-calc',
'hrsh7th/cmp-cmdline',
'hrsh7th/cmp-nvim-lsp',
- -- 'zbirenbaum/copilot-cmp',
'hrsh7th/cmp-nvim-lsp-signature-help',
'hrsh7th/cmp-nvim-lua',
'hrsh7th/cmp-path',
diff --git a/lua/tms/p/codeium.lua b/lua/tms/p/codeium.lua
@@ -1,6 +1,17 @@
local M = {}
-M.Accept = vim.fn['codeium#Accept']
+M.Accept = function()
+ local htok = pcall(require, 'hardtime')
+ if htok then
+ vim.cmd.Hardtime 'disable'
+ end
+
+ vim.fn['codeium#Accept']()
+
+ if htok then
+ vim.cmd.Hardtime 'enable'
+ end
+end
M.Clear = vim.fn['codeium#Clear']
diff --git a/lua/tms/p/sidebar/files.lua b/lua/tms/p/sidebar/files.lua
@@ -1,118 +0,0 @@
-local Loclist = require('sidebar-nvim.components.loclist')
-local has_devicons, devicons = pcall(require, 'nvim-web-devicons')
-
-local M = {}
-
-local icons = { --
- directory_closed = '',
- file = '',
-}
-
-local loclist = Loclist:new({ommit_single_group = false, show_group_count = false})
-
-local function get_fileicon(filename)
- if has_devicons and devicons.has_loaded() then
- local extension = filename:match('^.+%.(.+)$')
- local fileicon, _ = devicons.get_icon_color(filename, extension)
- local highlight = 'SidebarNvimNormal'
-
- if extension then highlight = 'DevIcon' .. extension end
- return {text = fileicon or icons['file'], hl = highlight}
- end
- return {text = icons['file'] .. ' '}
-end
-
-local function build_loclist(parent, files)
- local items = {}
-
- for _, file in ipairs(files) do
- if file.type == 'file' then
- local icon = get_fileicon(file.name)
-
- items[#items + 1] = {
- group = parent,
- left = { --
- {text = icon.text .. ' ', hl = icon.hl},
- {text = file.name},
- },
- name = file.name,
- path = file.path,
- type = file.type,
- parent = file.parent,
- node = file,
- }
- elseif file.type == 'directory' then
- local icon
- icon = icons['directory_closed']
-
- items[#items + 1] = {
- group = parent,
- left = { --
- {text = icon .. ' ' .. file.name, hl = 'SidebarNvimFilesDirectory'},
- },
- name = file.name,
- path = file.path,
- type = file.type,
- parent = file.parent,
- node = file,
- }
- end
- end
- return items
-end
-
-M.update = function()
- local ft = vim.api.nvim_buf_get_option(0, 'ft')
- if ft == '' then return end
- if ft == 'SidebarNvim' then return end
- if ft == 'TelescopePrompt' then return end
- if ft == 'help' then return end
-
- local directory = vim.fn.expand('%:p:h')
- local relative = vim.fn.expand('%:h')
-
- local list = {}
- local handle = vim.loop.fs_scandir(directory)
- while handle do
- local filename, filetype = vim.loop.fs_scandir_next(handle)
- if not filename then break end
- if filetype == 'file' then
- table.insert(list, { --
- name = filename,
- type = 'file',
- path = directory .. '/' .. filename,
- })
- elseif filetype == 'directory' then
- table.insert(list, { --
- name = filename,
- type = 'directory',
- path = directory .. '/' .. filename,
- })
- end
- end
-
- loclist:set_items(build_loclist(relative, list), {remove_groups = true})
-end
-
-M.section = {
- title = 'Files',
- setup = function()
- vim.api.nvim_exec([[
- augroup user_sidebar_files_update
- autocmd!
- autocmd BufEnter * lua require'tms.p.sidebar.files'.update()
- augroup END
- ]], false)
- end,
- update = function(_) M.update() end,
- draw = function(ctx)
- local lines = {}
- local hl = {}
-
- loclist:draw(ctx, lines, hl)
-
- return {lines = lines, hl = hl}
- end,
-}
-
-return M
diff --git a/lua/tms/p/sidebar/gitlab.lua b/lua/tms/p/sidebar/gitlab.lua
@@ -1,20 +0,0 @@
-local M = {}
-
-local gitlab_issues = {}
-
-M.section = {
- title = 'Gitlab issues',
- setup = function(_)
- require('plenary.job'):new({
- command = 'glab',
- args = {'mis', 'list', '-a', '@me'},
- on_exit = function(j, code)
- if code > 0 then gitlab_issues = {} end
- gitlab_issues = j:result()
- end,
- }):start()
- end,
- draw = function(_) return gitlab_issues end,
-}
-
-return M