Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| a030c6bfec | |||
| 08eec76067 | |||
| 3a831210d0 | |||
| dac73cf585 | |||
| 44f0fbbf3f |
@@ -110,7 +110,7 @@ do
|
||||
vim.o.number = true
|
||||
-- You can also add relative line numbers, to help with jumping.
|
||||
-- Experiment for yourself to see if you like it!
|
||||
-- vim.o.relativenumber = true
|
||||
vim.o.relativenumber = true
|
||||
|
||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||
vim.o.mouse = 'a'
|
||||
@@ -178,6 +178,12 @@ end
|
||||
-- basic keymaps
|
||||
-- ============================================================
|
||||
do
|
||||
|
||||
-- [[ Yuriy Keymaps ]]
|
||||
vim.opt.clipboard = "unnamedplus"
|
||||
|
||||
|
||||
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
@@ -251,6 +257,11 @@ do
|
||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||
callback = function() vim.hl.on_yank() end,
|
||||
})
|
||||
|
||||
-- [[ RPC Server for external control ]]
|
||||
-- Used for changing the theme to light/dark from external tools (e.g. atom.cz)
|
||||
local socket_path = '/tmp/nvim-' .. vim.fn.getpid() .. '.sock'
|
||||
vim.fn.serverstart(socket_path)
|
||||
end
|
||||
|
||||
-- ============================================================
|
||||
@@ -385,15 +396,32 @@ do
|
||||
vim.pack.add { gh 'folke/tokyonight.nvim' }
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
require('tokyonight').setup {
|
||||
style = 'moon', -- default dark theme
|
||||
light_style = 'day', -- theme used when background is light
|
||||
styles = {
|
||||
comments = { italic = false }, -- Disable italics in comments
|
||||
},
|
||||
}
|
||||
|
||||
-- Load the colorscheme here.
|
||||
-- Like many other themes, this one has different styles, and you could load
|
||||
-- any other, such as 'tokyonight-storm', 'tokyonight-moon', or 'tokyonight-day'.
|
||||
vim.cmd.colorscheme 'tokyonight-night'
|
||||
-- Auto switch based on KDE Plasma system theme
|
||||
local function set_theme()
|
||||
local handle = io.popen "kreadconfig6 --group 'General' --key 'ColorScheme' 2>/dev/null"
|
||||
if handle == nil then
|
||||
vim.o.background = 'dark'
|
||||
return
|
||||
end
|
||||
local result = handle:read '*a'
|
||||
handle:close()
|
||||
if result:match '[Dd]ark' then
|
||||
vim.o.background = 'dark'
|
||||
else
|
||||
vim.o.background = 'light'
|
||||
end
|
||||
end
|
||||
set_theme()
|
||||
|
||||
-- Uses tokyonight (without suffix) so it respects vim.o.background
|
||||
vim.cmd.colorscheme 'tokyonight'
|
||||
|
||||
-- Highlight todo, notes, etc in comments
|
||||
vim.pack.add { gh 'folke/todo-comments.nvim' }
|
||||
@@ -494,11 +522,16 @@ do
|
||||
-- You can put your default mappings / updates / etc. in here
|
||||
-- All the info you're looking for is in `:help telescope.setup()`
|
||||
--
|
||||
-- defaults = {
|
||||
-- mappings = {
|
||||
-- i = { ['<c-enter>'] = 'to_fuzzy_refine' },
|
||||
-- },
|
||||
-- },
|
||||
defaults = {
|
||||
layout_strategy = 'vertical',
|
||||
layout_config = {
|
||||
height = 0.95,
|
||||
width = 0.95,
|
||||
vertical = {
|
||||
preview_height = 0.5,
|
||||
},
|
||||
},
|
||||
},
|
||||
-- pickers = {}
|
||||
extensions = {
|
||||
['ui-select'] = { require('telescope.themes').get_dropdown() },
|
||||
@@ -521,7 +554,8 @@ do
|
||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader>sc', builtin.commands, { desc = '[S]earch [C]ommands' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.find_files, { desc = '[ ] Find files' })
|
||||
vim.keymap.set('n', '<leader>sb', builtin.buffers, { desc = '[S]earch [B]uffers' })
|
||||
|
||||
-- Add Telescope-based LSP pickers when an LSP attaches to a buffer.
|
||||
-- If you later switch picker plugins, this is where to update these mappings.
|
||||
@@ -560,10 +594,10 @@ do
|
||||
-- Override default behavior and theme when searching
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
-- You can pass additional configuration to Telescope to change the theme, layout, etc.
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
builtin.current_buffer_fuzzy_find {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
}
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
-- It's also possible to pass additional configuration options.
|
||||
@@ -976,7 +1010,7 @@ do
|
||||
-- NOTE: You can add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
|
||||
--
|
||||
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
|
||||
-- require 'custom.plugins'
|
||||
require 'custom.plugins'
|
||||
end
|
||||
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
vim.pack.add {
|
||||
{
|
||||
src = 'https://github.com/nickjvandyke/opencode.nvim',
|
||||
version = vim.version.range '*',
|
||||
},
|
||||
}
|
||||
|
||||
local opencode_port = 4096
|
||||
local opencode_url = 'http://127.0.0.1:' .. opencode_port
|
||||
|
||||
---@type opencode.Opts
|
||||
vim.g.opencode_opts = {
|
||||
server = {
|
||||
url = opencode_url,
|
||||
start = false,
|
||||
},
|
||||
}
|
||||
|
||||
vim.o.autoread = true -- Required for `vim.g.opencode_opts.events.reload`.
|
||||
|
||||
vim.keymap.set({ 'n', 'x' }, '<leader>oa', function()
|
||||
require('opencode').ask('@this: ')
|
||||
end, { desc = 'Ask opencode' })
|
||||
|
||||
vim.keymap.set({ 'n', 'x' }, '<leader>os', function()
|
||||
require('opencode').select()
|
||||
end, { desc = 'Select opencode action' })
|
||||
|
||||
vim.keymap.set({ 'n', 'x' }, 'go', function()
|
||||
return require('opencode').operator('@this ')
|
||||
end, { desc = 'Add range to opencode', expr = true })
|
||||
|
||||
vim.keymap.set('n', 'goo', function()
|
||||
return require('opencode').operator('@this ') .. '_'
|
||||
end, { desc = 'Add line to opencode', expr = true })
|
||||
|
||||
vim.keymap.set('n', '<S-C-u>', function()
|
||||
require('opencode').command('session.half.page.up')
|
||||
end, { desc = 'Scroll opencode up' })
|
||||
|
||||
vim.keymap.set('n', '<S-C-d>', function()
|
||||
require('opencode').command('session.half.page.down')
|
||||
end, { desc = 'Scroll opencode down' })
|
||||
@@ -0,0 +1,113 @@
|
||||
vim.pack.add {
|
||||
{
|
||||
src = 'https://github.com/alexpasmantier/tv.nvim',
|
||||
version = 'main',
|
||||
},
|
||||
}
|
||||
|
||||
-- Built-in tv.nvim handlers.
|
||||
local h = require('tv').handlers
|
||||
|
||||
require('tv').setup {
|
||||
layout = 'landscape', -- 'landscape' (default) or 'portrait'
|
||||
window = {
|
||||
width = 0.8,
|
||||
height = 0.8,
|
||||
border = 'none',
|
||||
title = ' tv.nvim ',
|
||||
title_pos = 'center',
|
||||
},
|
||||
channels = {
|
||||
files = {
|
||||
layout = 'portrait',
|
||||
keybinding = '<leader>tf',
|
||||
handlers = {
|
||||
['<CR>'] = h.open_as_files,
|
||||
['<C-q>'] = h.send_to_quickfix,
|
||||
['<C-s>'] = h.open_in_split,
|
||||
['<C-v>'] = h.open_in_vsplit,
|
||||
['<C-y>'] = h.copy_to_clipboard,
|
||||
},
|
||||
},
|
||||
|
||||
text = {
|
||||
layout = 'portrait',
|
||||
keybinding = '<C-p>',
|
||||
handlers = {
|
||||
['<CR>'] = h.open_at_line,
|
||||
['<C-q>'] = h.send_to_quickfix,
|
||||
['<C-s>'] = h.open_in_split,
|
||||
['<C-v>'] = h.open_in_vsplit,
|
||||
['<C-y>'] = h.copy_to_clipboard,
|
||||
},
|
||||
},
|
||||
|
||||
['git-log'] = {
|
||||
keybinding = '<leader>gl',
|
||||
handlers = {
|
||||
['<CR>'] = function(entries, config)
|
||||
if #entries > 0 then
|
||||
vim.cmd 'enew | setlocal buftype=nofile bufhidden=wipe'
|
||||
vim.cmd('silent 0read !git show ' .. vim.fn.shellescape(entries[1]))
|
||||
vim.cmd '1delete _ | setlocal filetype=git nomodifiable'
|
||||
vim.cmd 'normal! gg'
|
||||
end
|
||||
end,
|
||||
['<C-y>'] = h.copy_to_clipboard,
|
||||
},
|
||||
},
|
||||
|
||||
['git-branch'] = {
|
||||
keybinding = '<leader>gb',
|
||||
handlers = {
|
||||
['<CR>'] = h.execute_shell_command 'git checkout {}',
|
||||
['<C-y>'] = h.copy_to_clipboard,
|
||||
},
|
||||
},
|
||||
|
||||
['docker-images'] = {
|
||||
keybinding = '<leader>di',
|
||||
window = { title = ' Docker Images ' },
|
||||
handlers = {
|
||||
['<CR>'] = function(entries, config)
|
||||
if #entries > 0 then
|
||||
vim.ui.input({
|
||||
prompt = 'Container name: ',
|
||||
default = 'my-container',
|
||||
}, function(name)
|
||||
if name and name ~= '' then
|
||||
local cmd = string.format('docker run -it --name %s %s', name, entries[1])
|
||||
vim.cmd('!' .. cmd)
|
||||
end
|
||||
end)
|
||||
end
|
||||
end,
|
||||
['<C-y>'] = h.copy_to_clipboard,
|
||||
},
|
||||
},
|
||||
|
||||
env = {
|
||||
keybinding = '<leader>ev',
|
||||
handlers = {
|
||||
['<CR>'] = h.insert_at_cursor,
|
||||
['<C-l>'] = h.insert_on_new_line,
|
||||
['<C-y>'] = h.copy_to_clipboard,
|
||||
},
|
||||
},
|
||||
|
||||
alias = {
|
||||
keybinding = '<leader>al',
|
||||
handlers = {
|
||||
['<CR>'] = h.insert_at_cursor,
|
||||
['<C-y>'] = h.copy_to_clipboard,
|
||||
},
|
||||
},
|
||||
},
|
||||
tv_binary = 'tv',
|
||||
global_keybindings = {
|
||||
channels = '<leader>tv',
|
||||
},
|
||||
quickfix = {
|
||||
auto_open = true,
|
||||
},
|
||||
}
|
||||
@@ -0,0 +1,61 @@
|
||||
-- Zoxide integration for Neovim
|
||||
-- Allows you to use zoxide's smart directory jumping within Neovim
|
||||
|
||||
-- Install telescope-zoxide plugin
|
||||
local gh = function(repo)
|
||||
return 'https://github.com/' .. repo
|
||||
end
|
||||
|
||||
vim.pack.add { gh 'jvgrootveld/telescope-zoxide' }
|
||||
|
||||
-- Configure telescope-zoxide
|
||||
require('telescope').load_extension 'zoxide'
|
||||
|
||||
-- Keymaps for zoxide
|
||||
vim.keymap.set('n', '<leader>cd', function()
|
||||
require('telescope').extensions.zoxide.list()
|
||||
end, { desc = '[C]hange [D]irectory with zoxide' })
|
||||
|
||||
-- Optional: Create a command to change directory using zoxide
|
||||
vim.api.nvim_create_user_command('Z', function(opts)
|
||||
local path = opts.args
|
||||
if path == '' then
|
||||
-- If no argument, open telescope picker
|
||||
require('telescope').extensions.zoxide.list()
|
||||
else
|
||||
-- Otherwise, use zoxide to find and change to directory
|
||||
local handle = io.popen('zoxide query -- ' .. vim.fn.shellescape(path))
|
||||
if handle then
|
||||
local result = handle:read '*a'
|
||||
handle:close()
|
||||
result = result:gsub('%s+$', '') -- trim trailing whitespace
|
||||
if result ~= '' then
|
||||
vim.cmd('cd ' .. vim.fn.fnameescape(result))
|
||||
print('Changed directory to: ' .. result)
|
||||
else
|
||||
print('Directory not found in zoxide database')
|
||||
end
|
||||
end
|
||||
end
|
||||
end, { nargs = '*', desc = 'Change directory using zoxide' })
|
||||
|
||||
-- Optional: Create commands similar to zoxide's zi (interactive)
|
||||
vim.api.nvim_create_user_command('Zi', function()
|
||||
require('telescope').extensions.zoxide.list()
|
||||
end, { desc = 'Interactive zoxide directory picker' })
|
||||
|
||||
-- Optional: Add zoxide entries when changing directories in Neovim
|
||||
-- This keeps your zoxide database in sync with Neovim directory changes
|
||||
vim.api.nvim_create_autocmd('DirChanged', {
|
||||
callback = function()
|
||||
local dir = vim.fn.getcwd()
|
||||
vim.fn.system('zoxide add ' .. vim.fn.shellescape(dir))
|
||||
end,
|
||||
desc = 'Add directory to zoxide database when changing directories in Neovim',
|
||||
})
|
||||
|
||||
-- Custom directory aliases
|
||||
-- Using command abbreviation since Neovim commands must start with uppercase
|
||||
vim.cmd([[
|
||||
cnoreabbrev <expr> cda getcmdtype() == ':' && getcmdline() == 'cda' ? 'cd $HOME/Syncthing/Git/ansible/' : 'cda'
|
||||
]])
|
||||
Reference in New Issue
Block a user