This commit is contained in:
spike 2022-08-22 03:28:23 +02:00
parent 51e6c7876f
commit 656729bab5
5 changed files with 213 additions and 6 deletions

View File

@ -115,9 +115,9 @@ M.general = {
},
["<Down>"] = {"<cmd> close <CR>", "close window"},
-- yank from cusor to eol to system and primary clipboard
["<leader>y"] = {'"*y$"+y$'},
-- yank from cusor to eol to system and primary clipboard
["<leader>y"] = {'"*y$"+y$', "yank from cursor to eol to primary and clipboard"},
-- folding levels
["<leader>f0"] = {":set foldlevel=0<CR>", "set fold level"},
@ -147,7 +147,15 @@ M.general = {
os.execute("echo do >" .. fifo_patch )
end,
"notify <scripts/utils/fifo_watch>"
}
},
-- config files
-- ["<leader>ev"] = {
-- function()
-- local vim_config_files = {""}
-- end
-- , "edit vim config"},
},
t = { ["<C-x>"] = { termcodes "<C-\\><C-N>", "escape terminal mode" } },
@ -365,6 +373,31 @@ M.nvimtree = {
},
}
M.fzf_lua = {
plugin = true,
n = {
-- find
["<C-p>"] = { "<cmd> FzfLua files <CR>", "find files" },
-- grep
["<leader>fw"] = { "<cmd> FzfLua grep_cword <CR>", "grep cword" },
["<leader>f."] = { "<cmd> FzfLua live_grep_native <CR>", "grep live native" },
["<leader>f*"] = { "<cmd> FzfLua live_grep_glob <CR>", "grep with glob (SPACE-- globs)"},
-- continue
["<leader>ff"] = { "<cmd> FzfLua resume <CR>", "resume last search"},
["<leader>;"] = { "<cmd> FzfLua buffers <CR>", "find buffers" },
["<leader>fb"] = { "<cmd> FzfLua builtins <CR>", "FzfLua builtins" },
["<leader>fh"] = { "<cmd> FzfLua help_tags <CR>", "find help pages" },
["<leader>fo"] = { "<cmd> FzfLua oldfiles <CR>", "find oldfiles" },
["<leader>tk"] = { "<cmd> lua require'custom.plugins.fzflua'.keymaps() <CR>", "show keymaps" },
}
}
M.telescope = {
plugin = true,

View File

@ -1,12 +1,17 @@
-- vim modeline
-- vim: foldmarker={,} foldmethod=marker
-- local augroup = vim.api.nvim_create_augroup
-- local autocmd = vim.api.nvim_create_autocmd
-- highlights {
vim.cmd [[
hi CursorLine gui=underline
]]
--}
-- Shift key typos
-- Shift key typos{
vim.cmd [[
command! -bang -nargs=* -complete=file E e<bang> <args>
command! -bang -nargs=* -complete=file W w<bang> <args>
@ -19,7 +24,9 @@ vim.cmd [[
command! -bang QA qa<bang>
command! -bang Qa qa<bang>
]]
--}
-- suckless {
vim.cmd [[
" Autocompile suckless
let dwm_file_patterns = expand("$HOME/.local/src/suckless/*/{config.h,*.c}")
@ -32,11 +39,32 @@ vim.cmd [[
"au BufWrite */src/*/dwm*/{*.h,dwm.c} :AsyncRun! make clean && make && sudo make install
augroup END
]]
--}
-- Make asyncrun work with fugitive
-- Make asyncrun work with fugitive {
vim.cmd [[
augroup asyncrun
au!
command -bang -nargs=* -complete=file Make AsyncRun -program=make @ <args>
augroup END
]]
--}
-- gopass{
vim.cmd [[
augroup gopass
au!
au BufNewFile,BufRead /dev/shm/gopass* setlocal noswapfile nobackup noundofile
augroup END
]]
--}
-- plantuml {
vim.cmd [[
au FileType plantuml let g:plantuml_previewer#plantuml_jar_path = get(
\ matchlist(system('cat `which plantuml` | grep plantuml.jar'), '\v.*\s[''"]?(\S+plantuml\.jar).*'),
\ 1,
\ 0
\)
]]
-- }

View File

@ -0,0 +1,70 @@
local present, fzf = pcall(require, "fzf-lua")
if not present then
return
end
fzf.register_ui_select()
local options = {
fzf_opts = {
['--layout'] = 'default',
['--padding'] = '3%,1%'
},
winopts = {
fullscreen = false
},
previewers = {
man = {
cmd = "man %s | col -bx",
}
},
files = {
previewer = "bat_native",
file_icons = true,
color_icons = false,
winopts = {
fullscreen = true
},
},
oldfiles = {
color_icons = false,
},
grep = {
previewer = "bat_native",
file_icons = false,
color_icons = false,
winopts = {
fullscreen = true
},
},
buffers = {
color_icons = false
},
lines = {
color_icons = false
},
git = {
status = {
preview_pager = "delta --width=$FZF_PREVIEW_COLUMNS",
},
files = {
color_icons = false,
winopts = {
fullscreen = true
},
}
},
}
fzf.setup(options)

View File

@ -0,0 +1,53 @@
local core = require "fzf-lua.core"
local utils = require "fzf-lua.utils"
local config = require "fzf-lua.config"
M = {}
M.keymaps = function(opts)
opts = config.normalize_opts(opts, config.globals.nvim.keymaps)
if not opts then return end
local modes = {
n = "blue",
i = "red",
c = "yellow"
}
local keymaps = {}
local add_keymap = function(keymap)
-- hijack fields
local keymap_desc = keymap.desc == nil and keymap.rhs or keymap.desc
keymap.str = string.format("%s │ %-40s │ %s",
utils.ansi_codes[modes[keymap.mode] or "blue"](keymap.mode),
keymap.lhs:gsub("%s", "<Space>"),
keymap_desc)
local k = string.format("[%s:%s:%s]",
keymap.buffer, keymap.mode, keymap.lhs)
keymaps[k] = keymap
end
for mode, _ in pairs(modes) do
local global = vim.api.nvim_get_keymap(mode)
for _, keymap in pairs(global) do
add_keymap(keymap)
end
local buf_local = vim.api.nvim_buf_get_keymap(0, mode)
for _, keymap in pairs(buf_local) do
add_keymap(keymap)
end
end
local entries = {}
for _, v in pairs(keymaps) do
table.insert(entries, v.str)
end
opts.fzf_opts['--no-multi'] = ''
core.fzf_exec(entries, opts)
end
return M

View File

@ -11,6 +11,19 @@ return {
["folke/which-key.nvim"] = {
disable = false,
},
["nvim-telescope/telescope.nvim"] = {
disable = true
},
["ibhagwan/fzf-lua"] = {
after = "ui",
config = function()
require("custom.plugins.configs.fzflua")
require("plugins.configs.others").devicons()
end,
setup = function()
require("core.utils").load_mappings "fzf_lua"
end
},
-- Run async commands (make & errors)
["skywind3000/asyncrun.vim"] = {
config = function()
@ -18,6 +31,16 @@ return {
vim.g.asyncrun_open = 8
end
},
-- restore view
["vim-scripts/restore_view.vim"] = {},
-- Read info files
["https://gitlab.com/HiPhish/info.vim.git"] = {
cmd = "Info",
setup = function()
require("custom.plugins.info").set_mappings()
end
},
["L3MON4D3/LuaSnip"] = {
config = function()
-- load default config first