regular backup

This commit is contained in:
arielherself 2024-12-28 04:04:05 +08:00
parent 8bc4aa5a2b
commit 3954f4b15d
Signed by: arielherself
SSH Key Fingerprint: SHA256:AK3cyo9tFsp7Mox7K0sYphleC8hReXhnRKxwuDT5LBc
4 changed files with 352 additions and 71 deletions

225
.vimrc
View File

@ -1,18 +1,221 @@
" Make the behavior be like debian.vim
set nocompatible
set backspace=indent,eol,start
set history=50
set ruler
set nomodeline
set clipboard=unnamed,unnamedplus
syntax on
" Fix cursor shape
" Reference: https://vim.fandom.com/wiki/Change_cursor_shape_in_different_modes#For_VTE_compatible_terminals_(urxvt,_st,_xterm,_gnome-terminal_3.x,_Konsole_KDE5_and_others),_wsltty_and_Windows_Terminal
let &t_SI = "\<Esc>[6 q"
let &t_SR = "\<Esc>[4 q"
let &t_EI = "\<Esc>[2 q"
set number
set relativenumber
set cursorline
" Common stuff
set encoding=utf-8
set exrc
set undofile
set undodir=~/.vim/undofiles-vanilla
set undolevels=10000
set undoreload=50000
filetype off
set expandtab
set tabstop=4
set softtabstop=4
set shiftwidth=4
set splitright
set splitbelow
set selectmode=key
set keymodel=startsel
set number
set cursorline
set termguicolors
set clipboard=unnamedplus " not `+=` in vim
set updatetime=700
set whichwrap+=<,>,[,]
set relativenumber
set signcolumn=yes
set noequalalways
set scrolloff=10
set list
set listchars=trail:█
set noshowmode
set guicursor=n-v-c:block,i:ver25,a:blinkon0
set incsearch
set hlsearch
" legacy
set nocompatible
set backspace=indent,eol,start
set history=50
set ruler
" set nomodeline
" set clipboard=unnamed,unnamedplus
syntax on
" set number
" set relativenumber
" set cursorline
" set expandtab
" set tabstop=4
" set softtabstop=4
" set shiftwidth=4
set autoindent
set smartindent
let g:mapleader = " "
" Install vim-plug
let data_dir = '~/.vim'
if empty(glob(data_dir . '/autoload/plug.vim'))
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
endif
call plug#begin('~/.vim/plugged')
Plug 'savq/melange-nvim'
Plug 'morhetz/gruvbox'
Plug 'embark-theme/vim'
Plug 'tpope/vim-obsession'
Plug 'dhruvasagar/vim-prosession'
Plug 'vim-airline/vim-airline'
Plug 'itchyny/vim-cursorword'
Plug 'wakatime/vim-wakatime'
Plug 'tpope/vim-surround'
Plug 'tpope/vim-commentary'
Plug 'prabirshrestha/vim-lsp'
Plug 'prabirshrestha/asyncomplete.vim'
Plug 'prabirshrestha/asyncomplete-lsp.vim'
Plug 'mattn/vim-lsp-settings'
Plug 'jdhao/better-escape.vim'
Plug 'jiangmiao/auto-pairs'
Plug 'easymotion/vim-easymotion'
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
Plug 'junegunn/fzf.vim'
Plug 'rhysd/conflict-marker.vim'
Plug 'nathanaelkane/vim-indent-guides'
Plug 'ryanoasis/vim-devicons'
call plug#end()
" Color scheme
set background=dark
let g:embark_terminal_italics = 1
silent! colorscheme embark
" vim-airline
let g:airline#extensions#tabline#enabled = 1
let g:airline_powerline_fonts = 1
nnoremap , <Cmd>bp<CR>
nnoremap . <Cmd>bn<CR>
nnoremap c <Cmd>Bclose<CR>
inoremap <expr> <Tab> pumvisible() ? "\<C-n>" : "\<Tab>"
inoremap <expr> <S-Tab> pumvisible() ? "\<C-p>" : "\<S-Tab>"
inoremap <expr> <cr> pumvisible() ? asyncomplete#close_popup() . "\<cr>" : "\<cr>"
" LSP related
let g:asyncomplete_auto_popup = 1
let g:asyncomplete_popup_delay = 0
let g:lsp_settings = {
\ 'clangd': { 'cmd': [ 'clangd' ] },
\}
" Personal keybindings
nnoremap <leader>h <Plug>(easymotion-bd-w)
vnoremap <leader>h <Plug>(easymotion-bd-w)
nnoremap <leader>o <Cmd>Files<CR>
nnoremap <leader>g <Cmd>Rg<CR>
nnoremap gpd <Cmd>LspPeekDefinition<CR>
nnoremap gd <Cmd>LspDefinition<CR>
nnoremap <leader>dd <Cmd>LspDocumentDiagnostics<CR>
nnoremap <leader>dn <Cmd>LspNextDiagnostic<CR>
nnoremap <leader>dp <Cmd>LspPreviousDiagnostic<CR>
nnoremap <leader>r <Cmd>LspRename<CR>
nnoremap <leader>a <Cmd>LspCodeAction<CR>
nnoremap K <Cmd>LspHover<CR>
nnoremap <leader>` <Cmd>term zsh<CR>
nnoremap Q q
nnoremap q <Nop>
inoremap <C-e> {<ESC>A}<ESC>%li<CR><ESC>$i<CR><ESC>k^i
vnoremap <C-j> dpV`]
vnoremap <C-k> dkPV`]
vnoremap <Tab> >gv
vnoremap <S-Tab> <gv
nnoremap <C-a> ggVG
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" Bclose
" Delete buffer while keeping window layout (don't close buffer's windows).
" Version 2008-11-18 from http://vim.wikia.com/wiki/VimTip165
if v:version < 700 || exists('loaded_bclose') || &cp
finish
endif
let loaded_bclose = 1
if !exists('bclose_multiple')
let bclose_multiple = 1
endif
" Display an error message.
function! s:Warn(msg)
echohl ErrorMsg
echomsg a:msg
echohl NONE
endfunction
" Command ':Bclose' executes ':bd' to delete buffer in current window.
" The window will show the alternate buffer (Ctrl-^) if it exists,
" or the previous buffer (:bp), or a blank buffer if no previous.
" Command ':Bclose!' is the same, but executes ':bd!' (discard changes).
" An optional argument can specify which buffer to close (name or number).
function! s:Bclose(bang, buffer)
if empty(a:buffer)
let btarget = bufnr('%')
elseif a:buffer =~ '^\d\+$'
let btarget = bufnr(str2nr(a:buffer))
else
let btarget = bufnr(a:buffer)
endif
if btarget < 0
call s:Warn('No matching buffer for '.a:buffer)
return
endif
if empty(a:bang) && getbufvar(btarget, '&modified')
call s:Warn('No write since last change for buffer '.btarget.' (use :Bclose!)')
return
endif
" Numbers of windows that view target buffer which we will delete.
let wnums = filter(range(1, winnr('$')), 'winbufnr(v:val) == btarget')
if !g:bclose_multiple && len(wnums) > 1
call s:Warn('Buffer is in multiple windows (use ":let bclose_multiple=1")')
return
endif
let wcurrent = winnr()
for w in wnums
execute w.'wincmd w'
let prevbuf = bufnr('#')
if prevbuf > 0 && buflisted(prevbuf) && prevbuf != btarget
buffer #
else
bprevious
endif
if btarget == bufnr('%')
" Numbers of listed buffers which are not the target to be deleted.
let blisted = filter(range(1, bufnr('$')), 'buflisted(v:val) && v:val != btarget')
" Listed, not target, and not displayed.
let bhidden = filter(copy(blisted), 'bufwinnr(v:val) < 0')
" Take the first buffer, if any (could be more intelligent).
let bjump = (bhidden + blisted + [-1])[0]
if bjump > 0
execute 'buffer '.bjump
else
execute 'enew'.a:bang
endif
endif
endfor
execute 'bdelete'.a:bang.' '.btarget
execute wcurrent.'wincmd w'
endfunction
command! -bang -complete=buffer -nargs=? Bclose call <SID>Bclose(<q-bang>, <q-args>)
""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""
" indent guide
let g:indent_guides_enable_on_vim_startup = 1
let g:indent_guides_guide_size = 1
" Why?!
set noshowmode

41
.wezterm.lua Normal file
View File

@ -0,0 +1,41 @@
local wezterm = require 'wezterm'
local config = wezterm.config_builder()
local mux = wezterm.mux
wezterm.on('gui-startup', function(cmd)
local tab, pane, window = mux.spawn_window(cmd or {})
window:gui_window():maximize()
end)
config.front_end = "WebGpu"
config.max_fps = 120
config.keys = {
{
key = 'F11',
action = wezterm.action.ToggleFullScreen,
}
}
config.default_prog = {"wsl.exe", "--cd", "~", "--", "zsh"}
config.font = wezterm.font_with_fallback {
"BerkeleyMono Nerd Font",
"Symbol Nerd Font",
}
config.font_size = 10
config.allow_square_glyphs_to_overflow_width = "Always"
config.window_padding = {
left = 0,
right = 0,
top = 0,
bottom = 0,
}
config.default_cursor_style = 'SteadyBar'
config.colors = {
cursor_bg = "#ffb6c1",
cursor_border = "#ffb6c1",
}
-- https://wezfurlong.org/wezterm/config/lua/config/term.html
config.term = "wezterm"
return config

View File

@ -47,6 +47,15 @@ in {
helper = store
'';
};
".vimrc" = {
source = config.lib.file.mkOutOfStoreSymlink ../.vimrc;
};
# ".vim/autoload/plug.vim" = {
# source = builtins.fetchGit {
# url = "https://github.com/junegunn/vim-plug";
# ref = "master";
# };
# };
"Documents" = {
source = config.lib.file.mkOutOfStoreSymlink "${config.home.homeDirectory}/Dropbox/arch/Documents";
recursive = false;
@ -153,6 +162,7 @@ in {
# Editor
unstable.neovim
pkgs.vim-full
pkgs.fzf
pkgs.ripgrep
pkgs.clang-tools
@ -204,6 +214,12 @@ in {
pkgs.inetutils
pkgs.samba
# RUST
pkgs.rustc
pkgs.cargo
pkgs.rust-analyzer
pkgs.clippy
# Java
pkgs.jdk23
pkgs.jdt-language-server

View File

@ -172,32 +172,36 @@ local plugins = {
"tpope/vim-obsession",
},
},
-- {
-- "arielherself/arshamiser.nvim", -- status bar
-- branch = "dev",
-- dependencies = {
-- "arsham/arshlib.nvim",
-- "famiu/feline.nvim",
-- "rebelot/heirline.nvim",
-- "nvim-tree/nvim-web-devicons",
-- "lewis6991/gitsigns.nvim",
-- "nanotee/sqls.nvim",
-- "arsham/listish.nvim",
-- },
-- config = function()
-- require('gitsigns').setup()
--
-- -- ignore any parts you don't want to use
-- vim.cmd.colorscheme("arshamiser_dark")
-- -- require("arshamiser.feliniser")
-- -- or:
-- require("arshamiser.heirliniser")
--
-- _G.custom_foldtext = require("arshamiser.folding").foldtext
-- vim.opt.foldtext = "v:lua.custom_foldtext()"
-- -- if you want to draw a tabline:
-- -- vim.api.nvim_set_option("tabline", [[%{%v:lua.require("arshamiser.tabline").draw()%}]])
-- end,
-- },
{
"arielherself/arshamiser.nvim", -- status bar
branch = "dev",
dependencies = {
"arsham/arshlib.nvim",
"famiu/feline.nvim",
"rebelot/heirline.nvim",
"nvim-tree/nvim-web-devicons",
"lewis6991/gitsigns.nvim",
"nanotee/sqls.nvim",
"arsham/listish.nvim",
},
config = function()
require('gitsigns').setup()
-- ignore any parts you don't want to use
vim.cmd.colorscheme("arshamiser_dark")
-- require("arshamiser.feliniser")
-- or:
require("arshamiser.heirliniser")
_G.custom_foldtext = require("arshamiser.folding").foldtext
vim.opt.foldtext = "v:lua.custom_foldtext()"
-- if you want to draw a tabline:
-- vim.api.nvim_set_option("tabline", [[%{%v:lua.require("arshamiser.tabline").draw()%}]])
end,
'nvim-lualine/lualine.nvim',
dependencies = { 'nvim-tree/nvim-web-devicons' }
},
{
'numToStr/Comment.nvim', -- `gc` for commenting
@ -244,10 +248,10 @@ local plugins = {
{
'mawkler/modicator.nvim' -- highlight current line number
},
{
"ecthelionvi/NeoColumn.nvim", -- highlight overflow columns?
opts = {}
},
-- {
-- "ecthelionvi/NeoColumn.nvim", -- highlight overflow columns?
-- opts = {}
-- },
{
"utilyre/barbecue.nvim", -- LSP winbar
name = "barbecue",
@ -278,14 +282,14 @@ local plugins = {
'stevearc/dressing.nvim', -- better UI
opts = {},
},
{
"folke/twilight.nvim", -- Focus on parts that's being edited
opts = {
-- your configuration comes here
-- or leave it empty to use the default settings
-- refer to the configuration section below
}
},
-- {
-- "folke/twilight.nvim", -- Focus on parts that's being edited
-- opts = {
-- -- your configuration comes here
-- -- or leave it empty to use the default settings
-- -- refer to the configuration section below
-- }
-- },
{ "lukas-reineke/indent-blankline.nvim", main = "ibl", opts = {} },
{ 'arielherself/vim-cursorword' },
{ 'm-demare/hlargs.nvim' },
@ -476,7 +480,7 @@ local plugins = {
},
{ 'echasnovski/mini.trailspace', version = '*' },
{ url = 'https://git.sr.ht/~whynothugo/lsp_lines.nvim' },
{ 'glacambre/firenvim', build = ":call firenvim#install(0)" },
-- { 'glacambre/firenvim', build = ":call firenvim#install(0)" },
{ 'nushell/tree-sitter-nu' },
{
"ibhagwan/fzf-lua",
@ -509,13 +513,16 @@ local plugins = {
desc = 'Create a selection for selected text or word under the cursor',
},
},
}
},
-- { 'morhetz/gruvbox' }, -- gruvbox theme
{ 'LunarVim/bigfile.nvim' },
}
require("lazy").setup(plugins, {})
vim.notify = require("notify")
vim.cmd([[colorscheme melange]])
-- vim.cmd([[colorscheme gruvbox]])
local builtin = require("telescope.builtin")
local ext = require("telescope").extensions
@ -575,12 +582,12 @@ vim.keymap.set('n', '<leader>f', '<Cmd>lua require("search").open({ tab_name = "
vim.keymap.set('n', '<leader>g', '<Cmd>lua require("search").open({ tab_name = "Grep" })<CR>')
local config = require("nvim-treesitter.configs")
config.setup({
config.setup {
ensure_installed = {"lua", "cpp", "rust", "javascript", "python", "typescript", "html", "css", "scss"},
auto_install = true,
highlight = { enable = true},
indent = { enable = true},
})
}
-- import nvim-cmp plugin safely
local cmp_status, cmp = pcall(require, "cmp")
@ -813,9 +820,13 @@ vim.keymap.set('c', '<C-k>', '<Up>')
vim.keymap.set('n', '<leader>x', require("mini.trailspace").trim, {noremap=true})
vim.keymap.set('n', '<Del>', vim.notify.dismiss, {noremap=true})
vim.keymap.set({'n', 'v', 'x'}, 'Q', 'q', {noremap=true})
vim.keymap.set({'n', 'v', 'x'}, 'q', '<Nop>', {noremap=true})
vim.keymap.set({'n', 'v', 'x'}, 'q', '<Cmd>lua vim.diagnostic.open_float(0,{scope = "cursor"})<CR>', {noremap=true})
vim.keymap.set('n', 'g ', [[/\v^\s+$<CR>$<Cmd>nohlsearch<CR>]], {noremap=true, silent=true})
vim.keymap.set('n', 'gy', "`[v`]", {noremap=true})
vim.keymap.set('n', '<leader>cn', '<Cmd>GitConflictNextConflict<CR>')
vim.keymap.set('n', '<leader>cp', '<Cmd>GitConflictPrevConflict<CR>')
vim.keymap.set('n', '<leader>co', '<Cmd>GitConflictChooseOurs<CR>')
vim.keymap.set('n', '<leader>ct', '<Cmd>GitConflictChooseTheirs<CR>')
vim.api.nvim_create_user_command('SearchInCurrentFile', function()
vim.ui.input({ prompt = 'Grep ...'}, function(input)
@ -1070,8 +1081,8 @@ local opts = { noremap = true, silent = true }
map('n', '<M-,>', '<Cmd>BufferPrevious<CR>', opts)
map('n', '<M-.>', '<Cmd>BufferNext<CR>', opts)
-- Re-order to previous/next
map('n', '<M-S-,>', '<Cmd>BufferMovePrevious<CR>', opts) -- Configuration for kitty
map('n', '<M-S-.>', '<Cmd>BufferMoveNext<CR>', opts)
map('n', '<M-lt>', '<Cmd>BufferMovePrevious<CR>', opts) -- Configuration for wezterm
map('n', '<M->>', '<Cmd>BufferMoveNext<CR>', opts)
map('n', '<M-p>', '<Cmd>BufferPin<CR>', opts);
map('n', '<M-c>', '<Cmd>BufferClose<CR>', opts)
@ -1090,21 +1101,22 @@ local highlight = {
"RainbowViolet",
"RainbowCyan",
}
local hooks = require "ibl.hooks"
-- create the highlight groups in the highlight setup hook, so they are reset
-- every time the colorscheme changes
hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
end)
-- local hooks = require "ibl.hooks"
-- -- create the highlight groups in the highlight setup hook, so they are reset
-- -- every time the colorscheme changes
-- hooks.register(hooks.type.HIGHLIGHT_SETUP, function()
-- vim.api.nvim_set_hl(0, "RainbowRed", { fg = "#E06C75" })
-- vim.api.nvim_set_hl(0, "RainbowYellow", { fg = "#E5C07B" })
-- vim.api.nvim_set_hl(0, "RainbowBlue", { fg = "#61AFEF" })
-- vim.api.nvim_set_hl(0, "RainbowOrange", { fg = "#D19A66" })
-- vim.api.nvim_set_hl(0, "RainbowGreen", { fg = "#98C379" })
-- vim.api.nvim_set_hl(0, "RainbowViolet", { fg = "#C678DD" })
-- vim.api.nvim_set_hl(0, "RainbowCyan", { fg = "#56B6C2" })
-- end)
require("ibl").setup {
indent = { highlight = highlight, char = "" },
-- indent = { highlight = highlight, char = "⋮" },
indent = { char = "󰇙" },
scope = { enabled = true },
}
@ -1139,8 +1151,6 @@ require('goto-preview').setup {
require('colorizer').setup {}
require('ibl').setup {}
vim.api.nvim_create_autocmd("LspAttach", {
callback = function()
vim.lsp.inlay_hint.enable(true)
@ -1209,3 +1219,14 @@ require('lsp_lines').setup()
require("nvim-lightbulb").setup {
autocmd = { enabled = true }
}
require('lualine').setup {
options = {
-- theme = 'gruvbox'
theme = 'auto'
}
}
vim.g.gruvbox_contrast_light = 'soft'
require('bigfile').setup {}