.
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
|
||||
wfxr/forgit
|
||||
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
|
||||
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
|
||||
set -g __fish_arrow_functions_defined
|
||||
function _git_branch_name
|
||||
set -l branch (git symbolic-ref --quiet HEAD 2>/dev/null)
|
||||
if set -q branch[1]
|
||||
echo (string replace -r '^refs/heads/' '' $branch)
|
||||
else
|
||||
echo (git rev-parse --short HEAD 2>/dev/null)
|
||||
end
|
||||
end
|
||||
# Handle transient prompt (Fish 4.1.0+)
|
||||
# When --final-rendering is passed, show simplified prompt for scrollback
|
||||
if contains -- --final-rendering $argv
|
||||
set --local last_status $exit_codes[-1]
|
||||
|
||||
function _is_git_dirty
|
||||
not command git diff-index --cached --quiet HEAD -- &>/dev/null
|
||||
or not command git diff --no-ext-diff --quiet --exit-code &>/dev/null
|
||||
end
|
||||
|
||||
function _is_git_repo
|
||||
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
|
||||
echo -e -n (_pure_prompt_transient $last_status)
|
||||
echo -e -n (_pure_prompt_ending)
|
||||
return
|
||||
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)
|
||||
_pure_print_prompt_rows # manage default vs. compact prompt
|
||||
_pure_place_iterm2_prompt_mark # place iTerm shell integration mark
|
||||
echo -e -n (_pure_prompt $exit_codes) # print prompt
|
||||
echo -e -n (_pure_prompt_ending) # reset colors and end prompt
|
||||
|
||||
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 ' '
|
||||
set _pure_fresh_session false
|
||||
end
|
||||
|
|
|
|||
|
|
@ -12,6 +12,15 @@ vim.api.nvim_create_autocmd("TextYankPost", {
|
|||
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" }, {
|
||||
-- desc = "diagnostics on hold",
|
||||
-- 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)
|
||||
end
|
||||
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.switchbuf = "useopen,usetab"
|
||||
|
||||
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" })
|
||||
|
||||
require("smear_cursor").setup()
|
||||
-- require("smear_cursor").setup()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,17 @@
|
|||
vim.pack.add({ "https://github.com/rmagatti/auto-session" })
|
||||
|
||||
---enables autocomplete for opts
|
||||
---@module "auto-session"
|
||||
---@type AutoSession.Config
|
||||
require("auto-session").setup({
|
||||
suppressed_dirs = { "~/", "~/Projects", "~/Downloads", "/" },
|
||||
auto_restore = true,
|
||||
auto_save = true,
|
||||
session_lens = {
|
||||
picker = "snacks",
|
||||
picker_opts = {
|
||||
preview = false,
|
||||
preset = "dropdown",
|
||||
},
|
||||
},
|
||||
})
|
||||
|
|
|
|||
|
|
@ -44,6 +44,13 @@ Snacks.setup({
|
|||
},
|
||||
image = { enabled = false },
|
||||
picker = {
|
||||
win = {
|
||||
input = {
|
||||
keys = {
|
||||
["<c-v>"] = false, -- disable vertical split action, freeing Ctrl+V for system paste
|
||||
},
|
||||
},
|
||||
},
|
||||
layout = { fullscreen = true },
|
||||
sources = {
|
||||
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
|
||||
-- enables highlighting and indentation
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = { ".*" },
|
||||
callback = function(args)
|
||||
local ft = vim.bo[args.buf].filetype
|
||||
local lang = vim.treesitter.language.get_lang(ft)
|
||||
|
||||
if not lang or not vim.treesitter.language.add(lang) then
|
||||
local available = vim.g.ts_available or ts.get_available()
|
||||
if not vim.g.ts_available then
|
||||
vim.g.ts_available = available
|
||||
end
|
||||
if vim.tbl_contains(available, lang) then
|
||||
ts.install(lang)
|
||||
end
|
||||
end
|
||||
|
||||
if vim.treesitter.language.add(lang) then
|
||||
vim.treesitter.start(args.buf, lang)
|
||||
vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
vim.wo[0][0].foldmethod = "expr"
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
-- vim.api.nvim_create_autocmd("FileType", {
|
||||
-- pattern = { ".*" },
|
||||
-- callback = function(args)
|
||||
-- local ft = vim.bo[args.buf].filetype
|
||||
-- local lang = vim.treesitter.language.get_lang(ft)
|
||||
--
|
||||
-- if not lang or not vim.treesitter.language.add(lang) then
|
||||
-- local available = vim.g.ts_available or ts.get_available()
|
||||
-- if not vim.g.ts_available then
|
||||
-- vim.g.ts_available = available
|
||||
-- end
|
||||
-- if vim.tbl_contains(available, lang) then
|
||||
-- ts.install(lang)
|
||||
-- end
|
||||
-- end
|
||||
--
|
||||
-- if vim.treesitter.language.add(lang) then
|
||||
-- vim.treesitter.start(args.buf, lang)
|
||||
-- vim.bo.indentexpr = "v:lua.require'nvim-treesitter'.indentexpr()"
|
||||
-- vim.wo[0][0].foldexpr = "v:lua.vim.treesitter.foldexpr()"
|
||||
-- vim.wo[0][0].foldmethod = "expr"
|
||||
-- end
|
||||
-- end,
|
||||
-- })
|
||||
--
|
||||
vim.treesitter.language.register("bash", "env")
|
||||
|
|
|
|||
|
|
@ -9,6 +9,10 @@
|
|||
"rev": "645d108a5242ec7b378cbe643eb6d04d4223f034",
|
||||
"src": "https://github.com/stevearc/aerial.nvim"
|
||||
},
|
||||
"arborist.nvim": {
|
||||
"rev": "6cffbf419a495c84c56b918771a3d004e892e235",
|
||||
"src": "https://github.com/arborist-ts/arborist.nvim"
|
||||
},
|
||||
"auto-session": {
|
||||
"rev": "62437532b38495551410b3f377bcf4aaac574ebe",
|
||||
"src": "https://github.com/rmagatti/auto-session"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue