another day
This commit is contained in:
parent
feb59d91c5
commit
1bbc50e3a9
|
@ -1,14 +1,48 @@
|
|||
local map = vim.keymap.set
|
||||
|
||||
-- The good 'ol keybinds
|
||||
map('n', '<C-s>', '<cmd>w<CR>', { noremap = true, silent = true, desc = 'File save' })
|
||||
map('n', '<C-c>', '<cmd>%y+<CR>', { desc = 'File copy whole' })
|
||||
|
||||
-- Move between windows with arrows
|
||||
vim.keymap.set('n', '<C-Left>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
||||
vim.keymap.set('n', '<C-Right>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
||||
vim.keymap.set('n', '<C-Down>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||
vim.keymap.set('n', '<C-Up>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||
map('n', '<C-Left>', '<C-w><C-h>', { desc = 'Move focus to the left window' })
|
||||
map('n', '<C-Right>', '<C-w><C-l>', { desc = 'Move focus to the right window' })
|
||||
map('n', '<C-Down>', '<C-w><C-j>', { desc = 'Move focus to the lower window' })
|
||||
map('n', '<C-Up>', '<C-w><C-k>', { desc = 'Move focus to the upper window' })
|
||||
|
||||
-- Double Q to close current window
|
||||
--map('n', 'qq', '<CMD>q<CR>', { silent = true, desc = 'CLose window' })
|
||||
-- vim.api.nvim_create_autocmd('FileType', {
|
||||
-- pattern = 'TelescopePrompt',
|
||||
-- callback = function(params)
|
||||
-- vim.keymap.set('', 'qq', '<Esc>', { noremap = true, buffer = params.buf })
|
||||
-- end,
|
||||
-- })
|
||||
|
||||
-- Keep cursor centered when PgUp & PgDown
|
||||
vim.keymap.set({ 'n', 'i', 'v' }, '<PageUp>', '<PageUp>zz', { desc = 'Page up' })
|
||||
vim.keymap.set({ 'n', 'i', 'v' }, '<PageDown>', '<PageDown>zz', { desc = 'Page down' })
|
||||
map({ 'n', 'i', 'v' }, '<PageUp>', '<PageUp><CMD>normal zz<CR>', { desc = 'Page up' })
|
||||
map({ 'n', 'i', 'v' }, '<PageDown>', '<PageDown><CMD>normal zz<CR>', { desc = 'Page down' })
|
||||
|
||||
-- Redirect command output and allow edit
|
||||
vim.keymap.set('c', '<S-CR>', function()
|
||||
map('c', '<S-CR>', function()
|
||||
require('noice').redirect(vim.fn.getcmdline())
|
||||
end, { desc = 'Redirect Cmdline' })
|
||||
|
||||
-- LSP specific mappings
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
||||
callback = function(event)
|
||||
local map = function(keys, fn, desc)
|
||||
vim.keymap.set('n', keys, fn, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||
end
|
||||
|
||||
local builtin = require 'telescope.builtin'
|
||||
map('gd', builtin.lsp_definitions, '[G]oto [D]efinition')
|
||||
map('gr', builtin.lsp_references, '[G]oto [R]eferences')
|
||||
map('gi', builtin.lsp_implementations, '[G]oto [I]mplementation')
|
||||
map('gt', builtin.lsp_type_definitions, '[G]oto [T]ype Definition')
|
||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclarations')
|
||||
map('gic', builtin.lsp_incoming_calls, '[G]oto [I]ncoming [C]alls')
|
||||
map('goc', builtin.lsp_outgoing_calls, '[G]oto [O]utgoing [C]alls')
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
function FancyWrapper(ptr: NativePointer);
|
17
init.lua
17
init.lua
|
@ -81,7 +81,7 @@ vim.opt.smartcase = true
|
|||
vim.opt.signcolumn = 'yes'
|
||||
|
||||
-- Decrease update time
|
||||
vim.opt.updatetime = 125
|
||||
vim.opt.updatetime = 250
|
||||
|
||||
-- Decrease mapped sequence wait time
|
||||
-- Displays which-key popup sooner
|
||||
|
@ -113,11 +113,14 @@ vim.opt.scrolloff = 10
|
|||
vim.opt.hlsearch = true
|
||||
vim.keymap.set('n', '<Esc>', '<cmd>nohlsearch<CR>')
|
||||
|
||||
-- Diagnostic keymaps
|
||||
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'Go to previous [D]iagnostic message' })
|
||||
vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'Go to next [D]iagnostic message' })
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'Show diagnostic [E]rror messages' })
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'Open diagnostic [Q]uickfix list' })
|
||||
-- Add padding to Neovide only
|
||||
if vim.g.neovide then
|
||||
vim.g.neovide_padding_top = 4
|
||||
vim.g.neovide_padding_bottom = 6
|
||||
vim.g.neovide_padding_right = 12
|
||||
vim.g.neovide_padding_left = 12
|
||||
end
|
||||
|
||||
-- Exit terminal mode in the builtin terminal with a shortcut that is a bit easier
|
||||
-- for people to discover. Otherwise, you normally need to press <C-\><C-n>, which
|
||||
-- is not what someone will guess without a bit more experience.
|
||||
|
@ -191,7 +194,7 @@ local opts = {
|
|||
},
|
||||
}
|
||||
|
||||
require 'autocommand'
|
||||
require 'commands'
|
||||
require 'fancyutil'
|
||||
require('lazy').setup('plugins', opts)
|
||||
-- The line beneath this is called `modeline`. See `:help modeline`
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
-- init module
|
||||
local _M = {}
|
||||
|
||||
--- @param bufnr integer | nil
|
||||
--- @param winnr integer | nil
|
||||
--- @return true | false | nil
|
||||
function _M.get_oil_nnn(bufnr)
|
||||
bufnr = bufnr or 0
|
||||
local ok, value = pcall(vim.api.nvim_buf_get_var, bufnr, 'nnn')
|
||||
function _M.get_oil_nnn(winnr)
|
||||
winnr = winnr or 0
|
||||
local ok, value = pcall(vim.api.nvim_win_get_var, winnr, 'nnn')
|
||||
if not ok then
|
||||
return nil
|
||||
end
|
||||
|
@ -14,6 +14,12 @@ function _M.get_oil_nnn(bufnr)
|
|||
end
|
||||
return false
|
||||
end
|
||||
vim.fn.get_oil_nnn = _M.get_oil_nnn
|
||||
|
||||
--- @param val boolean
|
||||
--- @param winnr integer | nil
|
||||
function _M.set_oil_nnn(val, winnr)
|
||||
winnr = winnr or 0
|
||||
vim.api.nvim_win_set_var(winnr, 'nnn', val)
|
||||
end
|
||||
|
||||
return _M
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
-- autopairs
|
||||
-- https://github.com/windwp/nvim-autopairs
|
||||
|
||||
return {
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
event = 'InsertEnter',
|
||||
-- Optional dependency
|
||||
|
@ -13,4 +11,5 @@ return {
|
|||
local cmp = require 'cmp'
|
||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -1,9 +1,19 @@
|
|||
return {
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
event = 'InsertEnter',
|
||||
dependencies = { 'hrsh7th/nvim-cmp' },
|
||||
opts = {
|
||||
check_ts = true,
|
||||
|
||||
ts_config = {
|
||||
lua = { 'string' }, -- it will not add a pair on that treesitter node
|
||||
javascript = { 'template_string' },
|
||||
java = false, -- don't check treesitter on java
|
||||
},
|
||||
enable_check_bracket_line = true,
|
||||
},
|
||||
config = function()
|
||||
require('nvim-autopairs').setup {}
|
||||
local cmp_autopairs = require 'nvim-autopairs.completion.cmp'
|
||||
local cmp = require 'cmp'
|
||||
cmp.event:on('confirm_done', cmp_autopairs.on_confirm_done())
|
||||
|
|
|
@ -5,7 +5,7 @@ return {
|
|||
cmd = { 'ConformInfo' },
|
||||
keys = {
|
||||
{
|
||||
'<leader>f',
|
||||
'<A-f>',
|
||||
function()
|
||||
require('conform').format { async = true, lsp_fallback = true }
|
||||
end,
|
||||
|
@ -25,7 +25,7 @@ return {
|
|||
--[[ c = true, cpp = true ]]
|
||||
}
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
timeout_ms = 3000,
|
||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
||||
}
|
||||
end,
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
{
|
||||
'gbprod/cutlass.nvim',
|
||||
opts = {
|
||||
cut_key = 'm',
|
||||
},
|
||||
},
|
||||
}
|
|
@ -1,36 +1,37 @@
|
|||
return {
|
||||
{
|
||||
'tzachar/highlight-undo.nvim',
|
||||
config = function()
|
||||
vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
desc = 'Highlight when yanking (copying) text',
|
||||
group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }),
|
||||
callback = function()
|
||||
vim.highlight.on_yank { timeout = 200 }
|
||||
end,
|
||||
})
|
||||
|
||||
vim.api.nvim_set_hl(0, 'highlight-action', {
|
||||
fg = '#dcd7ba',
|
||||
bg = '#2d4f67',
|
||||
default = true,
|
||||
})
|
||||
|
||||
require('highlight-undo').setup {
|
||||
duration = 200,
|
||||
undo = {
|
||||
lhs = 'u',
|
||||
hlgroup = 'DiffAdd',
|
||||
map = 'undo',
|
||||
opts = {},
|
||||
},
|
||||
redo = {
|
||||
lhs = '<C-r>',
|
||||
hlgroup = 'DiffAdd',
|
||||
map = 'redo',
|
||||
opts = {},
|
||||
},
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
-- return {
|
||||
-- {
|
||||
-- 'tzachar/highlight-undo.nvim',
|
||||
-- config = function()
|
||||
-- vim.api.nvim_create_autocmd('TextYankPost', {
|
||||
-- desc = 'Highlight when yanking (copying) text',
|
||||
-- group = vim.api.nvim_create_augroup('highlight-yank', { clear = true }),
|
||||
-- callback = function()
|
||||
-- vim.highlight.on_yank { timeout = 200 }
|
||||
-- end,
|
||||
-- })
|
||||
--
|
||||
-- vim.api.nvim_set_hl(0, 'highlight-action', {
|
||||
-- fg = '#dcd7ba',
|
||||
-- bg = '#2d4f67',
|
||||
-- default = true,
|
||||
-- })
|
||||
--
|
||||
-- require('highlight-undo').setup {
|
||||
-- duration = 200,
|
||||
-- undo = {
|
||||
-- lhs = 'u',
|
||||
-- hlgroup = 'DiffAdd',
|
||||
-- map = 'undo',
|
||||
-- opts = {},
|
||||
-- },
|
||||
-- redo = {
|
||||
-- lhs = '<C-r>',
|
||||
-- hlgroup = 'DiffAdd',
|
||||
-- map = 'redo',
|
||||
-- opts = {},
|
||||
-- },
|
||||
-- }
|
||||
-- end,
|
||||
-- },
|
||||
-- }
|
||||
return {}
|
||||
|
|
|
@ -26,17 +26,55 @@ return {
|
|||
which_key = true,
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require('catppuccin').setup(opts)
|
||||
local theme = require 'catppuccin.palettes.mocha'
|
||||
local highlight = {
|
||||
RainbowRed = theme.red,
|
||||
RainbowYellow = theme.yellow,
|
||||
RainbowBlue = theme.blue,
|
||||
RainbowOrange = theme.peach,
|
||||
RainbowGreen = theme.green,
|
||||
RainbowViolet = theme.maroon,
|
||||
RainbowCyan = theme.teal,
|
||||
}
|
||||
vim.g.rainbow_delimiters = { highlight = highlight }
|
||||
end,
|
||||
},
|
||||
{ 'tpope/vim-sleuth' },
|
||||
{
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
dependencies = { 'catppuccin/nvim' },
|
||||
main = 'ibl',
|
||||
opts = {
|
||||
indent = vim.g.rainbow_delimiters,
|
||||
exclude = {
|
||||
filetypes = {
|
||||
'dashboard',
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local hooks = require 'ibl.hooks'
|
||||
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
|
||||
for name, value in pairs(vim.g.rainbow_delimiters) do
|
||||
vim.api.nvim_set_hl(0, name, { fg = value })
|
||||
end
|
||||
end)
|
||||
|
||||
opts.scope = {
|
||||
highlight = {
|
||||
'RainbowDelimiterRed',
|
||||
'RainbowDelimiterYellow',
|
||||
'RainbowDelimiterBlue',
|
||||
'RainbowDelimiterOrange',
|
||||
'RainbowDelimiterGreen',
|
||||
'RainbowDelimiterViolet',
|
||||
'RainbowDelimiterCyan',
|
||||
},
|
||||
}
|
||||
-- require('ibl').setup(opts)
|
||||
hooks.register(hooks.type.SCOPE_HIGHLIGHT, hooks.builtin.scope_highlight_from_extmark)
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -6,11 +6,11 @@ return {
|
|||
'williamboman/mason-lspconfig.nvim',
|
||||
'WhoIsSethDaniel/mason-tool-installer.nvim',
|
||||
'folke/lazydev.nvim',
|
||||
'b0o/schemastore.nvim',
|
||||
{ 'j-hui/fidget.nvim' },
|
||||
},
|
||||
config = function()
|
||||
require('lazydev').setup {}
|
||||
require('neoconf').setup {}
|
||||
vim.diagnostic.config {
|
||||
update_in_insert = true,
|
||||
float = {
|
||||
|
@ -21,6 +21,11 @@ return {
|
|||
virtual_text = false,
|
||||
}
|
||||
|
||||
vim.fn.sign_define('DiagnosticSignError', { text = '', texthl = 'DiagnosticSignError' })
|
||||
vim.fn.sign_define('DiagnosticSignWarn', { text = '', texthl = 'DiagnosticSignWarn' })
|
||||
vim.fn.sign_define('DiagnosticSignInfo', { text = '', texthl = 'DiagnosticSignInfo' })
|
||||
vim.fn.sign_define('DiagnosticSignHint', { text = '', texthl = 'DiagnosticSignHint' })
|
||||
|
||||
-- function will be executed to configure the current buffer
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
||||
|
@ -48,6 +53,7 @@ return {
|
|||
local capabilities = vim.lsp.protocol.make_client_capabilities()
|
||||
capabilities = vim.tbl_deep_extend('force', capabilities, require('cmp_nvim_lsp').default_capabilities())
|
||||
capabilities.textDocument.completion.completionItem.snippetSupport = true
|
||||
capabilities.textDocument.callHierarchy.dynamicRegistration = true
|
||||
|
||||
local lazyPlugins = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||
local servers = {
|
||||
|
@ -74,9 +80,39 @@ return {
|
|||
},
|
||||
},
|
||||
},
|
||||
jsonls = {},
|
||||
yamlls = {},
|
||||
jsonls = {
|
||||
settings = {
|
||||
json = {
|
||||
schemas = require('schemastore').json.schemas(),
|
||||
validate = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
yamlls = {
|
||||
settings = {
|
||||
yaml = {
|
||||
schemas = require('schemastore').yaml.schemas(),
|
||||
},
|
||||
schemaStore = {
|
||||
enable = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
eslint_d = {},
|
||||
pylsp = {
|
||||
settings = {
|
||||
pylsp = {
|
||||
plugins = {
|
||||
pycodestyle = {
|
||||
ignore = { 'W391' },
|
||||
maxLineLength = 120,
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
-- You can press `g?` for help in this menu.
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
return {
|
||||
{
|
||||
'nvimdev/lspsaga.nvim',
|
||||
},
|
||||
}
|
|
@ -1,3 +1,28 @@
|
|||
local function get_oil_extension()
|
||||
local oil_ext = vim.deepcopy(require 'lualine.extensions.oil')
|
||||
oil_ext.sections.lualine_z = {
|
||||
{
|
||||
'mode',
|
||||
separator = { left = '', right = '' },
|
||||
fmt = function(mode, context)
|
||||
local winnr = vim.fn.tabpagewinnr(context.tabnr)
|
||||
local val = require('fancyutil').get_oil_nnn(winnr)
|
||||
if val then
|
||||
return 'nnn'
|
||||
end
|
||||
return mode
|
||||
end,
|
||||
color = function()
|
||||
local val = require('fancyutil').get_oil_nnn()
|
||||
if val then
|
||||
return { fg = '#054fca', bg = '#ff98dd' }
|
||||
end
|
||||
end,
|
||||
},
|
||||
}
|
||||
return oil_ext
|
||||
end
|
||||
|
||||
return {
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
|
@ -18,32 +43,41 @@ return {
|
|||
component_separators = '',
|
||||
section_separators = { left = '', right = '' },
|
||||
},
|
||||
tabline = {
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_c = {
|
||||
'%=',
|
||||
{
|
||||
'filename',
|
||||
file_status = true,
|
||||
path = 3,
|
||||
symbols = {
|
||||
modified = '', -- Text to show when the file is modified.
|
||||
readonly = '', -- Text to show when the file is non-modifiable or readonly.
|
||||
unnamed = '[No Name]', -- Text to show for unnamed buffers.
|
||||
newfile = '[New]', -- Text to show for newly created file before first write
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
{ 'filetype' },
|
||||
{ 'fileformat' },
|
||||
},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
},
|
||||
sections = {
|
||||
lualine_a = {
|
||||
{
|
||||
'mode',
|
||||
separator = { left = '' },
|
||||
fmt = function(_, _)
|
||||
-- local winnr = vim.fn.tab (context.tabnr)
|
||||
-- vim.fn.winbufnr(winnr)
|
||||
local val = require('fancyutil').get_oil_nnn()
|
||||
if val then
|
||||
return 'nnn'
|
||||
end
|
||||
end,
|
||||
color = function(_)
|
||||
local val = require('fancyutil').get_oil_nnn()
|
||||
if val == true then
|
||||
return { fg = '#054fca' }
|
||||
end
|
||||
return {}
|
||||
end,
|
||||
separator = { left = '', right = '' },
|
||||
},
|
||||
},
|
||||
lualine_x = {
|
||||
{
|
||||
'lsp_progress',
|
||||
display_components = { 'lsp_client_name', { 'title', 'percentage', 'message' } },
|
||||
display_components = { 'lsp_client_name', 'spinner', { 'title', 'percentage', 'message' } },
|
||||
colors = {
|
||||
percentage = colors.gray,
|
||||
title = colors.gray,
|
||||
|
@ -52,35 +86,25 @@ return {
|
|||
lsp_client_name = colors.purple,
|
||||
use = true,
|
||||
},
|
||||
timer = {
|
||||
progress_enddelay = 1500,
|
||||
spinner = 1500,
|
||||
lsp_client_enddelay = 2500,
|
||||
},
|
||||
},
|
||||
},
|
||||
lualine_z = {
|
||||
{
|
||||
'location',
|
||||
separator = { right = '' },
|
||||
left_padding = 2,
|
||||
separator = { left = '', right = '' },
|
||||
},
|
||||
},
|
||||
},
|
||||
extensions = {
|
||||
'oil',
|
||||
get_oil_extension(),
|
||||
'lazy',
|
||||
},
|
||||
}
|
||||
|
||||
-- vim.api.nvim_create_autocmd({ 'BufEnter' }, {
|
||||
-- callback = function(ev)
|
||||
-- local filetype = vim.api.nvim_get_option_value('filetype', { buf = ev.buf })
|
||||
--
|
||||
-- print(string.format('event fired: %s', filetype))
|
||||
-- if filetype == 'oil' then
|
||||
-- local ok, value = pcall(vim.api.nvim_buf_get_var, ev.buf, 'nnn')
|
||||
-- if not ok then
|
||||
-- vim.api.nvim_buf_set_var(ev.buf, 'nnn', true)
|
||||
-- end
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
|
|
@ -30,6 +30,20 @@ return {
|
|||
return MiniHipatterns.compute_hex_color_group(correct, 'bg')
|
||||
end,
|
||||
},
|
||||
rgb = {
|
||||
pattern = '()Rgb%(%s*%d+,%s*%d+,%s*%d+%s*%)()',
|
||||
group = function(_, _, data)
|
||||
local _, _, r, g, b = data.full_match:find 'Rgb%(%s*(%d+),%s*(%d+),%s*(%d+)%s*%)'
|
||||
local correct = string.format('#%02x%02x%02x', r, g, b)
|
||||
if correct:len() ~= 7 then
|
||||
return
|
||||
end
|
||||
return MiniHipatterns.compute_hex_color_group(correct, 'bg')
|
||||
end,
|
||||
extmark_opts = {
|
||||
priority = 210,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
return {
|
||||
{
|
||||
'folke/neoconf.nvim',
|
||||
opts = {},
|
||||
},
|
||||
}
|
|
@ -3,7 +3,6 @@ return {
|
|||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
opts = {
|
||||
|
||||
ensure_installed = { 'bash', 'c', 'html', 'lua', 'luadoc', 'markdown', 'vim', 'vimdoc' },
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
|
|
|
@ -3,77 +3,33 @@ return {
|
|||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
event = 'VimEnter',
|
||||
keys = {
|
||||
{
|
||||
'qq',
|
||||
function()
|
||||
require('oil').close()
|
||||
end,
|
||||
mode = '',
|
||||
desc = 'Close current window',
|
||||
},
|
||||
{
|
||||
'<leader>tn',
|
||||
function()
|
||||
local val = require('fancyutil').get_oil_nnn()
|
||||
if val == true then
|
||||
vim.api.nvim_buf_set_var(bufnr, 'nnn', false)
|
||||
elseif val == false then
|
||||
vim.api.nvim_buf_set_var(bufnr, 'nnn', true)
|
||||
end
|
||||
end,
|
||||
mode = '',
|
||||
desc = '[T]oggle [n]nn Mode',
|
||||
},
|
||||
{
|
||||
'~',
|
||||
'<CMD>Oil<CR>',
|
||||
mode = '',
|
||||
desc = 'Open parent directory',
|
||||
},
|
||||
{
|
||||
'<Left>',
|
||||
function()
|
||||
if require('oil.util').is_oil_bufnr(0) and require('fancyutil').get_oil_nnn() then
|
||||
local oil = require 'oil'
|
||||
local bufname = vim.api.nvim_buf_get_name(0)
|
||||
local parent = oil.get_buffer_parent_url(bufname, true)
|
||||
return oil.open(parent)
|
||||
end
|
||||
-- fallback to sending page up key
|
||||
local keys = vim.api.nvim_replace_termcodes('<Left>', true, false, true)
|
||||
vim.api.nvim_feedkeys(keys, 'n', false)
|
||||
end,
|
||||
mode = '',
|
||||
desc = 'Move up the file tree',
|
||||
},
|
||||
{
|
||||
'<Right>',
|
||||
function()
|
||||
local oil = require 'oil'
|
||||
local entry = oil.get_cursor_entry()
|
||||
local dir = oil.get_current_dir()
|
||||
if entry and dir and require('fancyutil').get_oil_nnn() then
|
||||
local path = dir .. entry.name
|
||||
local stat = vim.loop.fs_stat(path)
|
||||
if stat and stat.type == 'directory' then
|
||||
return oil.open(path)
|
||||
end
|
||||
end
|
||||
-- fallback to sending arrow key
|
||||
local keys = vim.api.nvim_replace_termcodes('<Right>', true, false, true)
|
||||
vim.api.nvim_feedkeys(keys, 'n', false)
|
||||
end,
|
||||
mode = '',
|
||||
desc = 'Move down the file tree',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
default_file_explorer = true,
|
||||
restore_window_options = true,
|
||||
|
||||
keymaps = {
|
||||
['gd'] = {
|
||||
desc = 'Toggle file detail view',
|
||||
callback = function()
|
||||
vim.g.detail = not vim.g.detail
|
||||
if vim.g.detail then
|
||||
require('oil').set_columns { 'icon', 'permissions', 'size', 'mtime' }
|
||||
else
|
||||
require('oil').set_columns { 'icon' }
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
win_options = {
|
||||
wrap = true,
|
||||
signcolumn = 'yes',
|
||||
-- signcolumn = '',
|
||||
cursorcolumn = false,
|
||||
foldcolumn = '0',
|
||||
spell = false,
|
||||
|
@ -88,29 +44,57 @@ return {
|
|||
return name:match '.git'
|
||||
end,
|
||||
},
|
||||
-- group = aug,
|
||||
extensions = {
|
||||
'oil',
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local oil = require 'oil'
|
||||
oil.setup(opts)
|
||||
end,
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd('BufEnter', {
|
||||
desc = 'Detect buffer and setup oil nnn flag',
|
||||
-- group = aug,
|
||||
pattern = '*',
|
||||
nested = true,
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWinEnter' }, {
|
||||
pattern = 'oil://*',
|
||||
callback = function(params)
|
||||
local bufnr = params.buf
|
||||
local _, filetype = pcall(vim.api.nvim_get_option_value, 'filetype', { buf = bufnr })
|
||||
if filetype == 'oil' then
|
||||
local val = require('fancyutil').get_oil_nnn(bufnr)
|
||||
if val == nil then
|
||||
vim.api.nvim_buf_set_var(bufnr, 'nnn', true)
|
||||
if params.event == 'BufEnter' then
|
||||
-- double Q to close window
|
||||
vim.keymap.set('', 'qq', require('oil').close, { buffer = bufnr, desc = 'Close current window' })
|
||||
|
||||
-- toggle detailed list mode
|
||||
vim.keymap.set('', '<leader>tnnn', function()
|
||||
local fu = require 'fancyutil'
|
||||
local winnr = 0
|
||||
local val = fu.get_oil_nnn(winnr)
|
||||
fu.set_oil_nnn(val ~= true, winnr)
|
||||
end, { buffer = bufnr, desc = '[T]oggle [nnn] Mode' })
|
||||
|
||||
--- nnn move up file tree
|
||||
vim.keymap.set('', '<Left>', function()
|
||||
if require('oil.util').is_oil_bufnr(bufnr) and require('fancyutil').get_oil_nnn() then
|
||||
local oil = require 'oil'
|
||||
local bufname = vim.api.nvim_buf_get_name(bufnr)
|
||||
local parent = oil.get_buffer_parent_url(bufname, true)
|
||||
return oil.open(parent)
|
||||
end
|
||||
local keys = vim.api.nvim_replace_termcodes('<Left>', true, false, true)
|
||||
vim.api.nvim_feedkeys(keys, 'n', false) -- send consumed keys
|
||||
end, { buffer = bufnr, desc = 'Move up the file tree' })
|
||||
|
||||
-- nnn move down file tree
|
||||
vim.keymap.set('', '<Right>', function()
|
||||
local oil = require 'oil'
|
||||
local entry = oil.get_cursor_entry()
|
||||
local dir = oil.get_current_dir()
|
||||
if entry and dir and require('fancyutil').get_oil_nnn(0) then
|
||||
local path = dir .. entry.name
|
||||
local stat = vim.loop.fs_stat(path)
|
||||
if stat and stat.type == 'directory' then
|
||||
return oil.open(path)
|
||||
end
|
||||
end
|
||||
local keys = vim.api.nvim_replace_termcodes('<Right>', true, false, true)
|
||||
vim.api.nvim_feedkeys(keys, 'n', false) -- send consumed keys
|
||||
end, { buffer = bufnr, desc = 'Move down the file tree' })
|
||||
return
|
||||
end
|
||||
local winnr = vim.fn.bufwinid(bufnr)
|
||||
local val = require('fancyutil').get_oil_nnn(winnr)
|
||||
if val == nil then
|
||||
require('fancyutil').set_oil_nnn(true, winnr)
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
|
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
{
|
||||
'HiPhish/rainbow-delimiters.nvim',
|
||||
config = function(_, opts)
|
||||
require('rainbow-delimiters.setup').setup {}
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
{
|
||||
'tpope/vim-repeat',
|
||||
event = 'VeryLazy',
|
||||
},
|
||||
}
|
|
@ -6,7 +6,7 @@ return {
|
|||
{ 'nvim-tree/nvim-web-devicons' },
|
||||
},
|
||||
opts = {
|
||||
enable = true,
|
||||
enable = false,
|
||||
options = {
|
||||
-- If lualine is installed tabline will use separators configured in lualine by default.
|
||||
-- These options can be used to override those settings.
|
||||
|
@ -16,13 +16,16 @@ return {
|
|||
show_tabs_always = true, -- this shows tabs only when there are more than one tab or if the first tab is named
|
||||
show_devicons = true, -- this shows devicons in buffer section
|
||||
colored = true,
|
||||
show_bufnr = true, -- this appends [bufnr] to buffer section,
|
||||
show_bufnr = false, -- this appends [bufnr] to buffer section,
|
||||
tabline_show_last_separator = true,
|
||||
show_filename_only = true, -- shows base filename only instead of relative path in filename
|
||||
modified_icon = 'single', -- change the default modified icon
|
||||
modified_icon = '*', -- change the default modified icon
|
||||
modified_italic = true, -- set to true by default; this determines whether the filename turns italic if modified
|
||||
show_tabs_only = false, -- this shows only tabs instead of tabs + buffers
|
||||
},
|
||||
extensions = {
|
||||
'lazy',
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
require('tabline').setup(opts)
|
||||
|
|
|
@ -2,18 +2,11 @@ return {
|
|||
{
|
||||
'nvim-telescope/telescope.nvim',
|
||||
event = 'VimEnter',
|
||||
branch = '0.1.x',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
{ -- If encountering errors, see telescope-fzf-native README for installation instructions
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
|
||||
-- `build` is used to run some command when the plugin is installed/updated.
|
||||
-- This is only run then, not every time Neovim starts up.
|
||||
build = 'make',
|
||||
|
||||
-- `cond` is a condition used to determine whether this plugin should be
|
||||
-- installed and loaded.
|
||||
cond = function()
|
||||
return vim.fn.executable 'make' == 1
|
||||
end,
|
||||
|
@ -45,18 +38,21 @@ return {
|
|||
-- [[ Configure Telescope ]]
|
||||
-- See `:help telescope` and `:help telescope.setup()`
|
||||
require('telescope').setup {
|
||||
-- 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' },
|
||||
-- },
|
||||
-- },
|
||||
-- pickers = {}
|
||||
defaults = {
|
||||
mappings = {
|
||||
i = {
|
||||
['<c-enter>'] = 'to_fuzzy_refine',
|
||||
},
|
||||
n = {
|
||||
['qq'] = 'close',
|
||||
},
|
||||
},
|
||||
dynamic_preview_title = true,
|
||||
},
|
||||
pickers = {},
|
||||
extensions = {
|
||||
['ui-select'] = {
|
||||
require('telescope.themes').get_dropdown(),
|
||||
require('telescope.themes').get_ivy(),
|
||||
},
|
||||
},
|
||||
}
|
||||
|
@ -66,9 +62,12 @@ return {
|
|||
pcall(require('telescope').load_extension, 'ui-select')
|
||||
pcall(require('telescope').load_extension, 'noice')
|
||||
pcall(require('telescope').load_extension, 'undo')
|
||||
pcall(require('telescope').load_extension, 'yank_history')
|
||||
|
||||
-- See `:help telescope.builtin`
|
||||
local builtin = require 'telescope.builtin'
|
||||
local extensions = require('telescope').extensions
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<leader>fh', builtin.help_tags, { desc = '[F]ind [H]elp' })
|
||||
vim.keymap.set('n', '<leader>fk', builtin.keymaps, { desc = '[F]ind [K]eymaps' })
|
||||
vim.keymap.set('n', '<leader>ff', builtin.find_files, { desc = '[F]ind [F]iles' })
|
||||
|
@ -77,13 +76,13 @@ return {
|
|||
vim.keymap.set('n', '<leader>fg', builtin.live_grep, { desc = '[F]ind by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>fd', builtin.diagnostics, { desc = '[F]ind [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>fr', builtin.resume, { desc = '[F]ind [R]esume' })
|
||||
vim.keymap.set('n', '<leader>f.', builtin.oldfiles, { desc = '[F]ind Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<leader>f.', builtin.oldfiles, { desc = '[F]ind Recent Files [.]' })
|
||||
vim.keymap.set('n', '<leader>fy', extensions.yank_history.yank_history, { desc = '[F]ind [Y]ank History' })
|
||||
|
||||
-- Slightly advanced example of overriding default behavior and theme
|
||||
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(require('telescope.themes').get_ivy {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
return {
|
||||
{
|
||||
'akinsho/toggleterm.nvim',
|
||||
version = '*',
|
||||
opts = {
|
||||
size = 24,
|
||||
open_mapping = [[<c-t>]],
|
||||
},
|
||||
init = function()
|
||||
vim.api.nvim_create_autocmd('BufWinEnter', {
|
||||
desc = 'Detect buffer and setup oil nnn flag',
|
||||
pattern = 'term://*',
|
||||
callback = function(params)
|
||||
local winnr = vim.fn.bufwinid(params.buf)
|
||||
vim.api.nvim_set_option_value('cursorline', false, { win = winnr })
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
|
@ -3,17 +3,13 @@ return {
|
|||
'folke/trouble.nvim',
|
||||
opts = {
|
||||
modes = {
|
||||
preview_float = {
|
||||
test = {
|
||||
mode = 'diagnostics',
|
||||
preview = {
|
||||
type = 'float',
|
||||
relative = 'editor',
|
||||
border = 'rounded',
|
||||
title = 'Preview',
|
||||
title_pos = 'center',
|
||||
position = { 0, -2 },
|
||||
size = { width = 0.3, height = 0.3 },
|
||||
zindex = 200,
|
||||
relative = 'win',
|
||||
type = 'split',
|
||||
position = 'right',
|
||||
size = 0.3,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
|
|
@ -2,7 +2,7 @@ return {
|
|||
{
|
||||
'gbprod/yanky.nvim',
|
||||
opts = {
|
||||
ystem_clipboard = {
|
||||
system_clipboard = {
|
||||
sync_with_ring = true,
|
||||
clipboard_register = nil,
|
||||
},
|
||||
|
@ -11,6 +11,9 @@ return {
|
|||
on_yank = true,
|
||||
timer = 500,
|
||||
},
|
||||
preserve_cursor_position = {
|
||||
enabled = true,
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
commit_author: Some(Rgb(116, 199, 236)),
|
||||
danger_fg: Some(Rgb(243, 139, 168)),
|
||||
push_gauge_bg: Some(Rgb(137, 180, 250)),
|
||||
push_gauge_fg: some(Rgb(30, 30, 46)),
|
||||
push_gauge_fg: Some(Rgb(30, 30, 46)),
|
||||
tag_fg: Some(Rgb(245, 224, 220)),
|
||||
branch_fg: Some(Rgb(148, 226, 213))
|
||||
)
|
||||
|
|
18
neoconf.json
18
neoconf.json
|
@ -1,18 +0,0 @@
|
|||
{
|
||||
"neodev": {
|
||||
"library": {
|
||||
"enabled": true,
|
||||
"plugins": ["neoconf.nvim", "nvim-lspconfig"]
|
||||
}
|
||||
},
|
||||
"neoconf": {
|
||||
"plugins": {
|
||||
"lua_ls": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"lspconfig": {
|
||||
"sumneko_lua": {}
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue