.
This commit is contained in:
parent
5332dcebbe
commit
cc9545d408
10 changed files with 105 additions and 111 deletions
|
|
@ -3,3 +3,5 @@ jhillyerd/plugin-git
|
||||||
jorgebucaran/nvm.fish
|
jorgebucaran/nvm.fish
|
||||||
wfxr/forgit
|
wfxr/forgit
|
||||||
berk-karaal/loadenv.fish
|
berk-karaal/loadenv.fish
|
||||||
|
pure-fish/pure
|
||||||
|
franciscolourenco/done
|
||||||
|
|
|
||||||
|
|
@ -1,90 +1,21 @@
|
||||||
|
# a called to `_pure_prompt_new_line` is triggered by an event
|
||||||
function fish_prompt
|
function fish_prompt
|
||||||
set -l __last_command_exit_status $status
|
set --local exit_codes $pipestatus # save previous exit codes
|
||||||
|
|
||||||
if not set -q -g __fish_arrow_functions_defined
|
# Handle transient prompt (Fish 4.1.0+)
|
||||||
set -g __fish_arrow_functions_defined
|
# When --final-rendering is passed, show simplified prompt for scrollback
|
||||||
function _git_branch_name
|
if contains -- --final-rendering $argv
|
||||||
set -l branch (git symbolic-ref --quiet HEAD 2>/dev/null)
|
set --local last_status $exit_codes[-1]
|
||||||
if set -q branch[1]
|
|
||||||
echo (string replace -r '^refs/heads/' '' $branch)
|
echo -e -n (_pure_prompt_transient $last_status)
|
||||||
else
|
echo -e -n (_pure_prompt_ending)
|
||||||
echo (git rev-parse --short HEAD 2>/dev/null)
|
return
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
function _is_git_dirty
|
_pure_print_prompt_rows # manage default vs. compact prompt
|
||||||
not command git diff-index --cached --quiet HEAD -- &>/dev/null
|
_pure_place_iterm2_prompt_mark # place iTerm shell integration mark
|
||||||
or not command git diff --no-ext-diff --quiet --exit-code &>/dev/null
|
echo -e -n (_pure_prompt $exit_codes) # print prompt
|
||||||
end
|
echo -e -n (_pure_prompt_ending) # reset colors and end prompt
|
||||||
|
|
||||||
function _is_git_repo
|
set _pure_fresh_session false
|
||||||
type -q git
|
|
||||||
or return 1
|
|
||||||
git rev-parse --git-dir >/dev/null 2>&1
|
|
||||||
end
|
|
||||||
|
|
||||||
function _hg_branch_name
|
|
||||||
echo (hg branch 2>/dev/null)
|
|
||||||
end
|
|
||||||
|
|
||||||
function _is_hg_dirty
|
|
||||||
set -l stat (hg status -mard 2>/dev/null)
|
|
||||||
test -n "$stat"
|
|
||||||
end
|
|
||||||
|
|
||||||
function _is_hg_repo
|
|
||||||
fish_print_hg_root >/dev/null
|
|
||||||
end
|
|
||||||
|
|
||||||
function _repo_branch_name
|
|
||||||
_$argv[1]_branch_name
|
|
||||||
end
|
|
||||||
|
|
||||||
function _is_repo_dirty
|
|
||||||
_is_$argv[1]_dirty
|
|
||||||
end
|
|
||||||
|
|
||||||
function _repo_type
|
|
||||||
if _is_hg_repo
|
|
||||||
echo hg
|
|
||||||
return 0
|
|
||||||
else if _is_git_repo
|
|
||||||
echo git
|
|
||||||
return 0
|
|
||||||
end
|
|
||||||
return 1
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
set -l cyan (set_color -o cyan)
|
|
||||||
set -l yellow (set_color -o yellow)
|
|
||||||
set -l red (set_color -o red)
|
|
||||||
set -l green (set_color -o green)
|
|
||||||
set -l blue (set_color -o blue)
|
|
||||||
set -l normal (set_color normal)
|
|
||||||
|
|
||||||
set -l arrow_color "$green"
|
|
||||||
if test $__last_command_exit_status != 0
|
|
||||||
set arrow_color "$red"
|
|
||||||
end
|
|
||||||
|
|
||||||
set -l arrow "$arrow_color➜ "
|
|
||||||
if fish_is_root_user
|
|
||||||
set arrow "$arrow_color# "
|
|
||||||
end
|
|
||||||
|
|
||||||
set -l cwd $cyan(basename (prompt_pwd))
|
|
||||||
|
|
||||||
set -l repo_info
|
|
||||||
if set -l repo_type (_repo_type)
|
|
||||||
set -l repo_branch $red(_repo_branch_name $repo_type)
|
|
||||||
set repo_info "$blue $repo_type:($repo_branch$blue)"
|
|
||||||
|
|
||||||
if _is_repo_dirty $repo_type
|
|
||||||
set -l dirty "$yellow ✗"
|
|
||||||
set repo_info "$repo_info$dirty"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
echo -n -s $arrow ' '$cwd $repo_info $normal ' '
|
|
||||||
end
|
end
|
||||||
|
|
|
||||||
|
|
@ -12,6 +12,15 @@ vim.api.nvim_create_autocmd("TextYankPost", {
|
||||||
end,
|
end,
|
||||||
})
|
})
|
||||||
|
|
||||||
|
-- Close any new tab and reopen its buffer in the previous window
|
||||||
|
vim.api.nvim_create_autocmd("TabNew", {
|
||||||
|
callback = function()
|
||||||
|
local buf = vim.api.nvim_get_current_buf()
|
||||||
|
vim.cmd("tabclose")
|
||||||
|
vim.cmd("buffer " .. buf)
|
||||||
|
end,
|
||||||
|
})
|
||||||
|
|
||||||
-- vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
|
-- vim.api.nvim_create_autocmd({ "CursorHold", "CursorHoldI" }, {
|
||||||
-- desc = "diagnostics on hold",
|
-- desc = "diagnostics on hold",
|
||||||
-- group = vim.api.nvim_create_augroup("diagnostics", { clear = true }),
|
-- group = vim.api.nvim_create_augroup("diagnostics", { clear = true }),
|
||||||
|
|
|
||||||
|
|
@ -117,3 +117,5 @@ map({ "n", "v" }, "<S-CR>", function()
|
||||||
vim.lsp.buf.selection_range(-vim.v.count1)
|
vim.lsp.buf.selection_range(-vim.v.count1)
|
||||||
end
|
end
|
||||||
end, { desc = "Select child treesitter node or inner incremental lsp selections" })
|
end, { desc = "Select child treesitter node or inner incremental lsp selections" })
|
||||||
|
|
||||||
|
map("n", "<leader>se", ":AutoSession search<CR>", { desc = "Search sessions" })
|
||||||
|
|
|
||||||
|
|
@ -87,4 +87,22 @@ vim.diagnostic.config({ virtual_text = true, underline = true })
|
||||||
|
|
||||||
vim.opt.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
|
vim.opt.sessionoptions = "blank,buffers,curdir,folds,help,tabpages,winsize,winpos,terminal,localoptions"
|
||||||
|
|
||||||
|
vim.opt.switchbuf = "useopen,usetab"
|
||||||
|
|
||||||
vim.cmd.packadd("cfilter")
|
vim.cmd.packadd("cfilter")
|
||||||
|
|
||||||
|
if vim.g.neovide then
|
||||||
|
vim.g.neovide_scroll_animation_length = 0.1 -- Put anything you want to happen only in Neovide here
|
||||||
|
vim.g.neovide_scroll_animation_far_lines = 1
|
||||||
|
vim.g.neovide_floating_shadow = false
|
||||||
|
|
||||||
|
local function copy()
|
||||||
|
vim.cmd([[normal! "+y]])
|
||||||
|
end
|
||||||
|
local function paste()
|
||||||
|
vim.api.nvim_paste(vim.fn.getreg("+"), true, -1)
|
||||||
|
end
|
||||||
|
|
||||||
|
vim.keymap.set("v", "<C-c>", copy, { silent = true, desc = "Copy" })
|
||||||
|
vim.keymap.set({ "n", "i", "v", "c", "t" }, "<C-v>", paste, { silent = true, desc = "Paste" })
|
||||||
|
end
|
||||||
|
|
|
||||||
|
|
@ -1,3 +1,3 @@
|
||||||
vim.pack.add({ "https://github.com/sphamba/smear-cursor.nvim" })
|
vim.pack.add({ "https://github.com/sphamba/smear-cursor.nvim" })
|
||||||
|
|
||||||
require("smear_cursor").setup()
|
-- require("smear_cursor").setup()
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,17 @@
|
||||||
vim.pack.add({ "https://github.com/rmagatti/auto-session" })
|
vim.pack.add({ "https://github.com/rmagatti/auto-session" })
|
||||||
|
|
||||||
|
---enables autocomplete for opts
|
||||||
|
---@module "auto-session"
|
||||||
|
---@type AutoSession.Config
|
||||||
require("auto-session").setup({
|
require("auto-session").setup({
|
||||||
suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
|
suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
|
||||||
auto_restore = true,
|
auto_restore = true,
|
||||||
auto_save = true,
|
auto_save = true,
|
||||||
|
session_lens = {
|
||||||
|
picker = "snacks",
|
||||||
|
picker_opts = {
|
||||||
|
preview = false,
|
||||||
|
preset = "dropdown",
|
||||||
|
},
|
||||||
|
},
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -44,6 +44,13 @@ Snacks.setup({
|
||||||
},
|
},
|
||||||
image = { enabled = false },
|
image = { enabled = false },
|
||||||
picker = {
|
picker = {
|
||||||
|
win = {
|
||||||
|
input = {
|
||||||
|
keys = {
|
||||||
|
["<c-v>"] = false, -- disable vertical split action, freeing Ctrl+V for system paste
|
||||||
|
},
|
||||||
|
},
|
||||||
|
},
|
||||||
layout = { fullscreen = true },
|
layout = { fullscreen = true },
|
||||||
sources = {
|
sources = {
|
||||||
select = { layout = { fullscreen = false } },
|
select = { layout = { fullscreen = false } },
|
||||||
|
|
|
||||||
|
|
@ -1,32 +1,43 @@
|
||||||
vim.pack.add({ "https://github.com/nvim-treesitter/nvim-treesitter" })
|
vim.pack.add({
|
||||||
|
"https://github.com/arborist-ts/arborist.nvim",
|
||||||
|
})
|
||||||
|
|
||||||
local ts = require("nvim-treesitter")
|
require("arborist").setup({
|
||||||
|
ignore = {
|
||||||
|
"blink-cmp-documentation",
|
||||||
|
"blink-cmp-signature",
|
||||||
|
},
|
||||||
|
})
|
||||||
|
|
||||||
|
-- vim.pack.add({ "https://github.com/nvim-treesitter/nvim-treesitter" })
|
||||||
|
|
||||||
|
-- local ts = require("nvim-treesitter")
|
||||||
|
|
||||||
-- Installs treesitter for filetype if available
|
-- Installs treesitter for filetype if available
|
||||||
-- enables highlighting and indentation
|
-- enables highlighting and indentation
|
||||||
vim.api.nvim_create_autocmd("FileType", {
|
-- vim.api.nvim_create_autocmd("FileType", {
|
||||||
pattern = { ".*" },
|
-- pattern = { ".*" },
|
||||||
callback = function(args)
|
-- callback = function(args)
|
||||||
local ft = vim.bo[args.buf].filetype
|
-- local ft = vim.bo[args.buf].filetype
|
||||||
local lang = vim.treesitter.language.get_lang(ft)
|
-- local lang = vim.treesitter.language.get_lang(ft)
|
||||||
|
--
|
||||||
if not lang or not vim.treesitter.language.add(lang) then
|
-- if not lang or not vim.treesitter.language.add(lang) then
|
||||||
local available = vim.g.ts_available or ts.get_available()
|
-- local available = vim.g.ts_available or ts.get_available()
|
||||||
if not vim.g.ts_available then
|
-- if not vim.g.ts_available then
|
||||||
vim.g.ts_available = available
|
-- vim.g.ts_available = available
|
||||||
end
|
-- end
|
||||||
if vim.tbl_contains(available, lang) then
|
-- if vim.tbl_contains(available, lang) then
|
||||||
ts.install(lang)
|
-- ts.install(lang)
|
||||||
end
|
-- end
|
||||||
end
|
-- end
|
||||||
|
--
|
||||||
if vim.treesitter.language.add(lang) then
|
-- if vim.treesitter.language.add(lang) then
|
||||||
vim.treesitter.start(args.buf, lang)
|
-- vim.treesitter.start(args.buf, lang)
|
||||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
-- vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||||
vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
-- vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||||
vim.wo[0][0].foldmethod = "expr"
|
-- vim.wo[0][0].foldmethod = "expr"
|
||||||
end
|
-- end
|
||||||
end,
|
-- end,
|
||||||
})
|
-- })
|
||||||
|
--
|
||||||
vim.treesitter.language.register("bash", "env")
|
vim.treesitter.language.register("bash", "env")
|
||||||
|
|
|
||||||
|
|
@ -9,6 +9,10 @@
|
||||||
"rev": "645d108a5242ec7b378cbe643eb6d04d4223f034",
|
"rev": "645d108a5242ec7b378cbe643eb6d04d4223f034",
|
||||||
"src": "https://github.com/stevearc/aerial.nvim"
|
"src": "https://github.com/stevearc/aerial.nvim"
|
||||||
},
|
},
|
||||||
|
"arborist.nvim": {
|
||||||
|
"rev": "6cffbf419a495c84c56b918771a3d004e892e235",
|
||||||
|
"src": "https://github.com/arborist-ts/arborist.nvim"
|
||||||
|
},
|
||||||
"auto-session": {
|
"auto-session": {
|
||||||
"rev": "62437532b38495551410b3f377bcf4aaac574ebe",
|
"rev": "62437532b38495551410b3f377bcf4aaac574ebe",
|
||||||
"src": "https://github.com/rmagatti/auto-session"
|
"src": "https://github.com/rmagatti/auto-session"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue