navigator stable wip

navigator
spike 2 years ago
parent 826f75cb6d
commit 9848ceff61

@ -0,0 +1,2 @@
- [navigator] fix 'gi' keymap overriden by
- [navigator] disable diagnostic on startup

@ -67,12 +67,13 @@ M.general = {--{{{
["<C-c>"] = { "<cmd> %y+ <CR>", "copy whole file" },
-- line numbers
["<leader>n"] = { "<cmd> set nu! <CR>", "toggle line number" },
["<leader>rn"] = { "<cmd> set rnu! <CR>", "toggle relative number" },
["<leader>n"] = { "<cmd> set nu!<CR><cmd> set rnu!<CR>", "toggle line number" },
-- update nvchad
["<leader>uu"] = { "<cmd> :NvChadUpdate <CR>", "update nvchad" },
["<leader>ss"] = { "<cmd> mks! <CR>", "save session"},
["<leader>tt"] = {
function()
require("base46").toggle_theme()
@ -80,12 +81,16 @@ M.general = {--{{{
"toggle theme",
},
-- luasnip edit snippets
["<leader>se"] = {
function()
require("luasnip.loaders").edit_snippet_files()
end,
"luasnip edit snippets"},
"luasnip edit snippets"
},
-- Allow moving the cursor through wrapped lines with j, k, <Up> and <Down>
-- http://www.reddit.com/r/vim/comments/2k4cbr/problem_with_gj_and_gk/
@ -114,7 +119,10 @@ M.general = {--{{{
end,
"close buffer",
},
["<Down>"] = {"<cmd> close <CR>", "close window"},
-- quick close window
["<leader><BS>"] = {"<C-w>c", "close window"},
-- yank from cusor to eol to system and primary clipboard
@ -153,11 +161,7 @@ M.general = {--{{{
-- config files
-- ["<leader>ev"] = {
-- function()
-- local vim_config_files = {""}
-- end
-- , "edit vim config"},
["<leader>ev"] = {"<cmd> source ~/.config/nvim/Session.vim<CR>" , "edit vim config"},
},
t = { ["<C-x>"] = { termcodes "<C-\\><C-N>", "escape terminal mode" } },
@ -206,7 +210,7 @@ M.tabufline = {--{{{
"goto next buffer",
},
["<S-Tab>"] = {
["<C-f>"] = {
function()
require("core.utils").tabuflinePrev()
end,
@ -381,21 +385,22 @@ M.fzf_lua = {--{{{
n = {
-- find
["<C-p>"] = { "<cmd> FzfLua files <CR>", "FzfLua find files" },
["<leader>fl"] = { "<cmd> FzfLua lines <CR>", "FzfLua grep in lines" },
["<leader>fl"] = { "<cmd> FzfLua lines <CR>", "FzfLua grep open buffer lines" },
-- grep
["<leader>fw"] = { "<cmd> FzfLua grep_cword <CR>", "FzfLua grep cword" },
["<leader>f."] = { "<cmd> FzfLua live_grep_native <CR>", "FzfLua grep live native" },
["<leader>ff"] = { "<cmd> FzfLua grep_project <CR>", "FzfLua grep live project" },
["<leader>f*"] = { "<cmd> FzfLua live_grep_glob <CR>", "FzfLua grep with glob (SPACE-- globs)" },
-- continue
["<leader>ff"] = { "<cmd> FzfLua resume <CR>", "FzfLua resume last search"},
["<leader>fr"] = { "<cmd> FzfLua resume <CR>", "FzfLua resume last search" },
["<leader>;"] = { "<cmd> FzfLua buffers <CR>", "FzfLua find buffers" },
["<leader>fb"] = { "<cmd> FzfLua builtins <CR>", "FzfLua builtins" },
["<leader>fh"] = { "<cmd> FzfLua help_tags <CR>", "FzfLua find help pages" },
["<leader>fo"] = { "<cmd> FzfLua oldfiles <CR>", "FzfLua find oldfiles" },
["<leader>tk"] = { "<cmd> lua require'custom.plugins.fzflua'.keymaps() <CR>", "FzfLua show keymaps" },
["<leader>tk"] = { "<cmd> FzfLua keymaps <CR>", "FzfLua show keymaps" },
}
} --}}}
@ -511,32 +516,38 @@ M.whichkey = {--{{{
} --}}}
M.blankline = { --{{{
plugin = true,
-- plugin = true,
--
-- n = {
-- ["<leader>cc"] = {
-- function()
-- local ok, start = require("indent_blankline.utils").get_current_context(
-- vim.g.indent_blankline_context_patterns,
-- vim.g.indent_blankline_use_treesitter_scope
-- )
--
-- if ok then
-- vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 })
-- vim.cmd [[normal! _]]
-- end
-- end,
--
-- "Jump to current context",
-- },
-- },
} --}}}
M.navigator = {--{{{
plugin = true,
n = {
["<leader>bc"] = {
function()
local ok, start = require("indent_blankline.utils").get_current_context(
vim.g.indent_blankline_context_patterns,
vim.g.indent_blankline_use_treesitter_scope
)
if ok then
vim.api.nvim_win_set_cursor(vim.api.nvim_get_current_win(), { start, 0 })
vim.cmd [[normal! _]]
end
end,
"Jump to current_context",
},
},
["<Right>"] = { "<cmd> TSymbols <CR><C-w>h", "toggle TreeSitter symbols " },
}
}--}}}
M.vista = { -- Tagbar equivalent using LSP {{{
plugin = true,
n = {
["<Right>"] = { "<cmd> Vista!! <CR>", "toggle Vista "} ,
["<Right>"] = { "<cmd> Vista!! <CR>", "toggle TreeSitter symbols " },
},
} --}}}

@ -18,7 +18,7 @@ opt.laststatus = 3 -- global statusline
opt.showmode = false
opt.title = true
opt.clipboard = "unnamedplus"
opt.clipboard = "unnamed"
opt.cul = true -- cursor line
opt.colorcolumn = "80"
opt.rulerformat = "%30(%=:b%n%y%m%r%w %l,%c%V %P%)" -- NvChad has custom ruler !
@ -96,7 +96,7 @@ opt.undofile = true
opt.backup = true
opt.backupcopy = "yes"
opt.backupdir = vim.fn.expand("$XDG_DATA_HOME/nvim/backups")
opt.sessionoptions="blank,buffers,curdir,folds,tabpages,winsize,resize,localoptions"
opt.sessionoptions="blank,buffers,curdir,folds,help,tabpages,winsize,resize,winpos"
-- interval for writing swap file to disk, also used by gitsigns
opt.updatetime = 250

@ -17,6 +17,29 @@ M.ui = {
M.plugins = {
user = require "custom.plugins",
override = {
["nvim-treesitter/nvim-treesitter"] = {
ensure_installed = {
"lua",
"go",
"rust",
"fish",
"bash",
"python",
"c",
"haskell",
"javascript",
"html",
"markdown",
"markdown_inline",
"make",
"sql",
"yaml",
"toml",
"vue",
}
}
}
}
return M

@ -0,0 +1,24 @@
local present, navigator = pcall(require, "navigator")
if not present then
return
end
local config = {
-- debug = true,
transparency = nil,
default_mapping = true,
-- keymaps = {
--
-- },
-- TODO: remap all keys to restore default keys maps like `gi`
lsp = {
document_highlight = false,
mason = true,
format_on_save = false, -- applies to all formatting feature of neovim
-- including auto-fold
}
}
navigator.setup(config)

@ -1,53 +0,0 @@
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

@ -8,12 +8,13 @@ return {
["mfussenegger/nvim-dap"] = {
module = "dap"
},
["liuchengxu/vista.vim"] = {
cmd = "Vista",
setup = function()
require("core.utils").load_mappings "vista"
end
},
-- side panel with symbols (replaced by Navigator :LspSymbols cmd)
-- ["liuchengxu/vista.vim"] = {
-- cmd = "Vista",
-- setup = function()
-- require("core.utils").load_mappings "vista"
-- end
-- },
["folke/which-key.nvim"] = {
disable = false,
},
@ -49,7 +50,8 @@ return {
config = function ()
require("auto-session").setup {
log_level = "error",
auto_session_suppress_dirs = {"~/", "~/projects", "/"}
auto_session_suppress_dirs = {"~/", "~/projects", "/"},
auto_save_enabled = false,
}
end
},
@ -93,7 +95,30 @@ return {
module = {"cmp", "cmp_nvim_lsp"},
event = "InsertEnter",
},
["neovim/nvim-lspconfig"] = {
config = nil -- disable lspconfig, handled by navigator
},
["williamboman/mason-lspconfig.nvim"] = {
requires = {"williamboman/mason.nvim", "nvim-lspconfig"},
after = "mason.nvim",
module = "mson-lspconfig.nvim",
config = function()
require("mason-lspconfig").setup({})
end,
},
-- ["ray-x/navigator.lua"] = {
-- after = "nvim-lspconfig"
-- }
["https://git.sp4ke.xyz/sp4ke/navigator.lua"] = {
after = "nvim-lspconfig",
requires = {"neovim/nvim-lspconfig", "ray-x/guihua.lua", "nvim-treesitter/nvim-treesitter"},
setup = function()
require("core.utils").load_mappings "navigator"
end,
config = function()
require("custom.plugins.configs.navigator")
end
},
["ray-x/guihua.lua"] = {
module = "navigator",
run= "cd lua/fzy && make"
}
}

Loading…
Cancel
Save