mirror of
https://github.com/js0ny/dotfiles.git
synced 2025-12-21 08:43:00 +00:00
refractor: Reorganise dotfiles structures
This commit is contained in:
parent
2bd9138a5f
commit
bd5ca49c3e
131 changed files with 43 additions and 114 deletions
360
tools/browser/surfingkeys.js
Normal file
360
tools/browser/surfingkeys.js
Normal file
|
|
@ -0,0 +1,360 @@
|
|||
// Paste this into surfingkeys advanced settings
|
||||
// or use:
|
||||
// Load settings from: https://raw.githubusercontent.com/js0ny/dotfiles/refs/heads/master/browser/surfingkeys.js
|
||||
|
||||
/** Examples
|
||||
|
||||
// an example to create a new mapping `ctrl-y`
|
||||
api.mapkey('<ctrl-y>', 'Show me the money', function() {
|
||||
Front.showPopup('a well-known phrase uttered by characters in the 1996 film Jerry Maguire (Escape to close).');
|
||||
});
|
||||
|
||||
// an example to replace `T` with `gt`, click `Default mappings` to see how `T` works.
|
||||
api.map('gt', 'T');
|
||||
|
||||
|
||||
// an example to remove mapkey `Ctrl-i`
|
||||
api.unmap('<ctrl-i>');
|
||||
|
||||
*/
|
||||
// Settings
|
||||
settings.language = "zh-CN" ;
|
||||
settings.showModeStatus = false;
|
||||
// Keymap, reference https://github.com/texiwustion/colemak_config_for_surfingkeys/tree/main
|
||||
const forward = {
|
||||
add: function (key) { // 转发即将被 unmap 的键
|
||||
return api.map(`for${key}`, key)
|
||||
},
|
||||
cancel: function (key) { // 删除转发生成的键
|
||||
api.unmap(`for${key}`)
|
||||
api.unmap(key)
|
||||
},
|
||||
use: function (key) {
|
||||
return `for${key}`
|
||||
}
|
||||
}
|
||||
|
||||
const colemak = {
|
||||
forward: function (key) { // 转发即将被 unmap 的键
|
||||
api.map(key, `col${key}`)
|
||||
api.unmap(`col${key}`)
|
||||
|
||||
},
|
||||
use: function (key) {
|
||||
return `col${key}`
|
||||
},
|
||||
map: function (a, b) {
|
||||
api.map(colemak.use(a), forward.use(b))
|
||||
}
|
||||
}
|
||||
|
||||
const forwardFactory = {
|
||||
push: function (mapLists) { // forward original keys
|
||||
for (let key in mapLists) {
|
||||
forward.add(mapLists[key])
|
||||
}
|
||||
},
|
||||
map: function (mapLists) {
|
||||
for (let key in mapLists) {
|
||||
colemak.map(key, mapLists[key])
|
||||
}
|
||||
},
|
||||
pull: function (mapLists) {
|
||||
for (let key in mapLists) {
|
||||
forward.cancel(mapLists[key])
|
||||
}
|
||||
for (let key in mapLists) {
|
||||
colemak.forward(key)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
const mapLists = {
|
||||
/// scroll page
|
||||
// Arrow
|
||||
'n': 'j',
|
||||
'e': 'k',
|
||||
'i': 'l',
|
||||
// l <-> i
|
||||
'l': 'i',
|
||||
'L': 'I',
|
||||
// k <-> n
|
||||
'k': 'n',
|
||||
'K': 'N',
|
||||
// j <-> e
|
||||
'j': 'e',
|
||||
'J': 'E',
|
||||
// 缩放
|
||||
'zu': 'zi',
|
||||
'zo': 'ze',
|
||||
'zz': 'zr',
|
||||
}
|
||||
|
||||
forwardFactory.push(mapLists)
|
||||
api.unmap('t')
|
||||
forwardFactory.map(mapLists)
|
||||
// 鼠标点击
|
||||
api.unmap('gi')
|
||||
api.unmap('[[')
|
||||
api.unmap(']]')
|
||||
api.unmap(';m')
|
||||
api.unmap(';fs')
|
||||
api.unmap('O')
|
||||
api.unmap('C')
|
||||
forwardFactory.pull(mapLists)
|
||||
|
||||
|
||||
// Search Alias
|
||||
api.addSearchAlias('f', 'Felo', 'https://felo.ai/search?q=', 's', 'https://duckduckgo.com/ac/?q=', function(response) {
|
||||
var res = JSON.parse(response.text);
|
||||
return res.map(function(r){
|
||||
return r.phrase;
|
||||
});
|
||||
});
|
||||
api.addSearchAlias('p', 'Perplexity', 'https://www.perplexity.ai/?q=', 's', 'https://duckduckgo.com/ac/?q=', function(response) {
|
||||
var res = JSON.parse(response.text);
|
||||
return res.map(function(r){
|
||||
return r.phrase;
|
||||
});
|
||||
});
|
||||
api.addSearchAlias('r', 'Raindrop', 'https://app.raindrop.io/my/0/', 's', 'https://duckduckgo.com/ac/?q=', function(response) {
|
||||
var res = JSON.parse(response.text);
|
||||
return res.map(function(r){
|
||||
return r.phrase;
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
// Theme, reference to https://github.com/Foldex/surfingkeys-config
|
||||
api.Hints.style('border: solid 2px #4C566A; color:#A3BE8C; background: initial; background-color: #3B4252;');
|
||||
api.Hints.style("border: solid 2px #4C566A !important; padding: 1px !important; color: #E5E9F0 !important; background: #3B4252 !important;", "text");
|
||||
api.Visual.style('marks', 'background-color: #A3BE8C99;');
|
||||
api.Visual.style('cursor', 'background-color: #88C0D0;');
|
||||
settings.theme = `
|
||||
fg: #E5E9F0;
|
||||
bg: #3B4252;
|
||||
bg-dark: #2E3440;
|
||||
border: #4C566A;
|
||||
main-fg: #88C0D0;
|
||||
accent-fg: #A3BE8C;
|
||||
info-fg: #5E81AC;
|
||||
select: #4C566A;
|
||||
/* ---------- Generic ---------- */
|
||||
.sk_theme {
|
||||
background: var(--bg);
|
||||
color: var(--fg);
|
||||
background-color: var(--bg);
|
||||
border-color: var(--border);
|
||||
font-family: var(--font);
|
||||
font-size: var(--font-size);
|
||||
font-weight: var(--font-weight);
|
||||
}
|
||||
|
||||
input {
|
||||
font-family: var(--font);
|
||||
font-weight: var(--font-weight);
|
||||
}
|
||||
|
||||
.sk_theme tbody {
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
.sk_theme input {
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
/* Hints */
|
||||
#sk_hints .begin {
|
||||
color: var(--accent-fg) !important;
|
||||
}
|
||||
|
||||
#sk_tabs .sk_tab {
|
||||
background: var(--bg-dark);
|
||||
border: 1px solid var(--border);
|
||||
}
|
||||
|
||||
#sk_tabs .sk_tab_title {
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
#sk_tabs .sk_tab_url {
|
||||
color: var(--main-fg);
|
||||
}
|
||||
|
||||
#sk_tabs .sk_tab_hint {
|
||||
background: var(--bg);
|
||||
border: 1px solid var(--border);
|
||||
color: var(--accent-fg);
|
||||
}
|
||||
|
||||
.sk_theme #sk_frame {
|
||||
background: var(--bg);
|
||||
opacity: 0.2;
|
||||
color: var(--accent-fg);
|
||||
}
|
||||
|
||||
/* ---------- Omnibar ---------- */
|
||||
/* Uncomment this and use settings.omnibarPosition = 'bottom' for Pentadactyl/Tridactyl style bottom bar */
|
||||
/* .sk_theme#sk_omnibar {
|
||||
width: 100%;
|
||||
left: 0;
|
||||
} */
|
||||
|
||||
.sk_theme .title {
|
||||
color: var(--accent-fg);
|
||||
}
|
||||
|
||||
.sk_theme .url {
|
||||
color: var(--main-fg);
|
||||
}
|
||||
|
||||
.sk_theme .annotation {
|
||||
color: var(--accent-fg);
|
||||
}
|
||||
|
||||
.sk_theme .omnibar_highlight {
|
||||
color: var(--accent-fg);
|
||||
}
|
||||
|
||||
.sk_theme .omnibar_timestamp {
|
||||
color: var(--info-fg);
|
||||
}
|
||||
|
||||
.sk_theme .omnibar_visitcount {
|
||||
color: var(--accent-fg);
|
||||
}
|
||||
|
||||
.sk_theme #sk_omnibarSearchResult ul li:nth-child(odd) {
|
||||
background: var(--bg-dark);
|
||||
}
|
||||
|
||||
.sk_theme #sk_omnibarSearchResult ul li.focused {
|
||||
background: var(--border);
|
||||
}
|
||||
|
||||
.sk_theme #sk_omnibarSearchArea {
|
||||
border-top-color: var(--border);
|
||||
border-bottom-color: var(--border);
|
||||
}
|
||||
|
||||
.sk_theme #sk_omnibarSearchArea input,
|
||||
.sk_theme #sk_omnibarSearchArea span {
|
||||
font-size: var(--font-size);
|
||||
}
|
||||
|
||||
.sk_theme .separator {
|
||||
color: var(--accent-fg);
|
||||
}
|
||||
|
||||
/* ---------- Popup Notification Banner ---------- */
|
||||
#sk_banner {
|
||||
font-family: var(--font);
|
||||
font-size: var(--font-size);
|
||||
font-weight: var(--font-weight);
|
||||
background: var(--bg);
|
||||
border-color: var(--border);
|
||||
color: var(--fg);
|
||||
opacity: 0.9;
|
||||
}
|
||||
|
||||
/* ---------- Popup Keys ---------- */
|
||||
#sk_keystroke {
|
||||
background-color: var(--bg);
|
||||
}
|
||||
|
||||
.sk_theme kbd .candidates {
|
||||
color: var(--info-fg);
|
||||
}
|
||||
|
||||
.sk_theme span.annotation {
|
||||
color: var(--accent-fg);
|
||||
}
|
||||
|
||||
/* ---------- Popup Translation Bubble ---------- */
|
||||
#sk_bubble {
|
||||
background-color: var(--bg) !important;
|
||||
color: var(--fg) !important;
|
||||
border-color: var(--border) !important;
|
||||
}
|
||||
|
||||
#sk_bubble * {
|
||||
color: var(--fg) !important;
|
||||
}
|
||||
|
||||
#sk_bubble div.sk_arrow div:nth-of-type(1) {
|
||||
border-top-color: var(--border) !important;
|
||||
border-bottom-color: var(--border) !important;
|
||||
}
|
||||
|
||||
#sk_bubble div.sk_arrow div:nth-of-type(2) {
|
||||
border-top-color: var(--bg) !important;
|
||||
border-bottom-color: var(--bg) !important;
|
||||
}
|
||||
|
||||
/* ---------- Search ---------- */
|
||||
#sk_status,
|
||||
#sk_find {
|
||||
font-size: var(--font-size);
|
||||
border-color: var(--border);
|
||||
}
|
||||
|
||||
.sk_theme kbd {
|
||||
background: var(--bg-dark);
|
||||
border-color: var(--border);
|
||||
box-shadow: none;
|
||||
color: var(--fg);
|
||||
}
|
||||
|
||||
.sk_theme .feature_name span {
|
||||
color: var(--main-fg);
|
||||
}
|
||||
|
||||
/* ---------- ACE Editor ---------- */
|
||||
#sk_editor {
|
||||
background: var(--bg-dark) !important;
|
||||
height: 50% !important;
|
||||
/* Remove this to restore the default editor size */
|
||||
}
|
||||
|
||||
.ace_dialog-bottom {
|
||||
border-top: 1px solid var(--bg) !important;
|
||||
}
|
||||
|
||||
.ace-chrome .ace_print-margin,
|
||||
.ace_gutter,
|
||||
.ace_gutter-cell,
|
||||
.ace_dialog {
|
||||
background: var(--bg) !important;
|
||||
}
|
||||
|
||||
.ace-chrome {
|
||||
color: var(--fg) !important;
|
||||
}
|
||||
|
||||
.ace_gutter,
|
||||
.ace_dialog {
|
||||
color: var(--fg) !important;
|
||||
}
|
||||
|
||||
.ace_cursor {
|
||||
color: var(--fg) !important;
|
||||
}
|
||||
|
||||
.normal-mode .ace_cursor {
|
||||
background-color: var(--fg) !important;
|
||||
border: var(--fg) !important;
|
||||
opacity: 0.7 !important;
|
||||
}
|
||||
|
||||
.ace_marker-layer .ace_selection {
|
||||
background: var(--select) !important;
|
||||
}
|
||||
|
||||
.ace_editor,
|
||||
.ace_dialog span,
|
||||
.ace_dialog input {
|
||||
font-family: var(--font);
|
||||
font-size: var(--font-size);
|
||||
font-weight: var(--font-weight);
|
||||
}`;
|
||||
// click `Save` button to make above settings to take effect.</ctrl-i></ctrl-y>
|
||||
43
tools/ipython/profile_default/ipython_config.py
Normal file
43
tools/ipython/profile_default/ipython_config.py
Normal file
|
|
@ -0,0 +1,43 @@
|
|||
c.TerminalIPythonApp.display_banner = True
|
||||
c.TerminalInteractiveShell.editing_mode = 'vi'
|
||||
c.TerminalInteractiveShell.confirm_exit = False
|
||||
|
||||
# Source: https://ipython.readthedocs.io/en/stable/config/details.html#keyboard-shortcuts
|
||||
def custom_return(shell):
|
||||
|
||||
"""This function is required by the API. It takes a reference to
|
||||
the shell, which is the same thing `get_ipython()` evaluates to.
|
||||
This function must return a function that handles each keypress
|
||||
event. That function, named `handle` here, references `shell`
|
||||
by closure."""
|
||||
|
||||
def handle(event):
|
||||
|
||||
"""This function is called each time `Enter` is pressed,
|
||||
and takes a reference to a Prompt Toolkit event object.
|
||||
If the current input starts with a bang or modulo, then
|
||||
the input is executed, otherwise a newline is entered,
|
||||
followed by any spaces needed to auto-indent."""
|
||||
|
||||
# set up a few handy references to nested items...
|
||||
|
||||
buffer = event.current_buffer
|
||||
document = buffer.document
|
||||
text = document.text
|
||||
|
||||
if text.startswith('!') or text.startswith('%'): # execute the input...
|
||||
|
||||
buffer.accept_action.validate_and_handle(event.cli, buffer)
|
||||
|
||||
else: # insert a newline with auto-indentation...
|
||||
|
||||
if document.line_count > 1: text = text[:document.cursor_position]
|
||||
indent = shell.check_complete(text)[1]
|
||||
buffer.insert_text('\n' + indent)
|
||||
|
||||
# if you just wanted a plain newline without any indentation, you
|
||||
# could use `buffer.insert_text('\n')` instead of the lines above
|
||||
|
||||
return handle
|
||||
|
||||
c.TerminalInteractiveShell.handle_return = custom_return
|
||||
69
tools/ipython/profile_default/starup/keymap.py
Normal file
69
tools/ipython/profile_default/starup/keymap.py
Normal file
|
|
@ -0,0 +1,69 @@
|
|||
from prompt_toolkit.key_binding import KeyBindings
|
||||
from prompt_toolkit.key_binding.vi_state import InputMode
|
||||
from prompt_toolkit.filters import Condition
|
||||
from IPython import get_ipython
|
||||
|
||||
ip = get_ipython()
|
||||
key_bindings = KeyBindings()
|
||||
|
||||
@Condition
|
||||
def in_navigation_mode():
|
||||
return ip.pt_app.app.vi_state.input_mode == InputMode.NAVIGATION
|
||||
|
||||
# colemak keymap hnei
|
||||
@key_bindings.add("n", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Move cursor down by visual line"
|
||||
event.current_buffer.auto_down(count=event.arg)
|
||||
|
||||
@key_bindings.add("e", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Move cursor up by visual line"
|
||||
event.current_buffer.auto_up(count=event.arg)
|
||||
|
||||
@key_bindings.add("i", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Move cursor right"
|
||||
event.current_buffer.cursor_right(count=event.arg)
|
||||
|
||||
# Insert with 'l' and 'L'
|
||||
@key_bindings.add("l", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Enter insert mode (similar position to 'i' in Colemak)"
|
||||
event.app.vi_state.input_mode = InputMode.INSERT
|
||||
|
||||
@key_bindings.add("L", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Enter insert mode at the beginning of the line"
|
||||
event.current_buffer.cursor_position += event.current_buffer.document.get_start_of_line_position()
|
||||
|
||||
# Ne[k]st
|
||||
@key_bindings.add("k", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Find next match"
|
||||
event.current_buffer.forward_search()
|
||||
|
||||
@key_bindings.add("K", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Find previous match"
|
||||
event.current_buffer.reverse_search()
|
||||
|
||||
# [J]ump
|
||||
@key_bindings.add("j", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Move to end of next word"
|
||||
event.current_buffer.cursor_right_word()
|
||||
|
||||
@key_bindings.add("J", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Move to end of next word with capital E"
|
||||
event.current_buffer.cursor_right_word(end=True)
|
||||
|
||||
# Yank to end of line with 'Y'
|
||||
@key_bindings.add("Y", filter=in_navigation_mode)
|
||||
def _(event):
|
||||
"Yank to the end of the line"
|
||||
text_to_yank = event.current_buffer.document.text_after_cursor
|
||||
event.app.clipboard.set_text(text_to_yank)
|
||||
|
||||
ip.pt_app.key_bindings = key_bindings
|
||||
10
tools/ipython/profile_default/starup/magic_ps.py
Normal file
10
tools/ipython/profile_default/starup/magic_ps.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
from IPython.core.magic import register_line_magic
|
||||
|
||||
@register_line_magic
|
||||
def ps(cmd):
|
||||
output = get_ipython().getoutput(f"powershell -Command {cmd}")
|
||||
# If no variable is assigned to the output, print it
|
||||
if get_ipython().last_execution_result is None:
|
||||
print("\n".join(output))
|
||||
else:
|
||||
return "\n".join(output)
|
||||
15
tools/nvim.lazy.d/.neoconf.json
Normal file
15
tools/nvim.lazy.d/.neoconf.json
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
{
|
||||
"neodev": {
|
||||
"library": {
|
||||
"enabled": true,
|
||||
"plugins": true
|
||||
}
|
||||
},
|
||||
"neoconf": {
|
||||
"plugins": {
|
||||
"lua_ls": {
|
||||
"enabled": true
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
22
tools/nvim.lazy.d/.options/obsidian.all.lua
Normal file
22
tools/nvim.lazy.d/.options/obsidian.all.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
return {
|
||||
"epwalsh/obsidian.nvim",
|
||||
version = "*", -- recommended, use latest release instead of latest commit
|
||||
lazy = true,
|
||||
ft = "markdown",
|
||||
dependencies = {
|
||||
-- Required.
|
||||
"nvim-lua/plenary.nvim",
|
||||
|
||||
-- see below for full list of optional dependencies 👇
|
||||
},
|
||||
opts = {
|
||||
workspaces = {
|
||||
{
|
||||
name = "Obsidian",
|
||||
path = "~/Obsidian",
|
||||
},
|
||||
},
|
||||
|
||||
-- see below for full list of options 👇
|
||||
},
|
||||
}
|
||||
8
tools/nvim.lazy.d/README.md
Normal file
8
tools/nvim.lazy.d/README.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# Colemak *LazyVim*
|
||||
|
||||
- Replace the default `hjkl` movement keys with `hnei`
|
||||
- `j->e`, `k->n`, `h->h`, `l->i`
|
||||
|
||||
```sh
|
||||
ln -sf $DOTFILES/.config/nvim/ $XDG_CONFIG_HOME/nvim
|
||||
```
|
||||
8
tools/nvim.lazy.d/init.lua
Normal file
8
tools/nvim.lazy.d/init.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
-- bootstrap lazy.nvim, LazyVim and your plugins
|
||||
if (vim.g.vscode) then
|
||||
print("VSCode detected, skipping lazy loading")
|
||||
require("vscode.code")
|
||||
else
|
||||
require("config.lazy")
|
||||
-- require("config.lazy")
|
||||
end
|
||||
8
tools/nvim.lazy.d/lazy-lock.json
Normal file
8
tools/nvim.lazy.d/lazy-lock.json
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"lazy.nvim": { "branch": "main", "commit": "7967abe55752aa90532e6bb4bd4663fe27a264cb" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "be7bd4c5f860c79da97af3a26d489af50babfd4b" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "c646154d6e4db9b2979eeb517d0b817ad00c9c47" },
|
||||
"nvim-treesitter": { "branch": "master", "commit": "efb2e9c607cab1e4f7171493b7c6f63bd39073fc" },
|
||||
"plenary.nvim": { "branch": "master", "commit": "2d9b06177a975543726ce5c73fca176cedbffe9d" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "85922dde3767e01d42a08e750a773effbffaea3e" }
|
||||
}
|
||||
10
tools/nvim.lazy.d/lazyvim.json
Normal file
10
tools/nvim.lazy.d/lazyvim.json
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
{
|
||||
"extras": [
|
||||
"lazyvim.plugins.extras.ai.copilot",
|
||||
"lazyvim.plugins.extras.ai.copilot-chat"
|
||||
],
|
||||
"news": {
|
||||
"NEWS.md": "7429"
|
||||
},
|
||||
"version": 7
|
||||
}
|
||||
3
tools/nvim.lazy.d/lua/config/autocmds.lua
Normal file
3
tools/nvim.lazy.d/lua/config/autocmds.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
-- Autocmds are automatically loaded on the VeryLazy event
|
||||
-- Default autocmds that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/autocmds.lua
|
||||
-- Add any additional autocmds here
|
||||
146
tools/nvim.lazy.d/lua/config/keymaps.lua
Normal file
146
tools/nvim.lazy.d/lua/config/keymaps.lua
Normal file
|
|
@ -0,0 +1,146 @@
|
|||
-- Keymaps are automatically loaded on the VeryLazy event
|
||||
-- Default keymaps that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/keymaps.lua
|
||||
-- Add any additional keymaps here
|
||||
|
||||
vim.g.mapleader = " "
|
||||
|
||||
-- ================= GENERAL KEYBINDS =================
|
||||
-- SAVE/QUIT {{{
|
||||
vim.keymap.set("n", "Q", "<cmd>q<CR>", { desc = "Q to quit" })
|
||||
vim.keymap.set("n", "<C-s>", "<cmd>w<CR>", { desc = "S to write file" })
|
||||
--}}}
|
||||
|
||||
-- NVIM CONFIG SHORTCUTS {{{
|
||||
-- stylua: ignore
|
||||
vim.keymap.set("n", "<leader>rc", "<cmd>e $HOME/.config/nvim/lua/config/options.lua<CR>", { desc = "Open nvim options.lua" })
|
||||
vim.keymap.set("n", "<leader>rp", "<cmd>e $HOME/.config/nvim/lua/plugins/.<CR>", { desc = "lazy plugins dir" })
|
||||
--}}}
|
||||
|
||||
-- UNDO
|
||||
vim.keymap.set({ "n", "v" }, "l", "u", { desc = "Undo" })
|
||||
|
||||
-- INSERT
|
||||
vim.keymap.set({ "n", "v" }, "l", "i", { desc = "Insert" })
|
||||
vim.keymap.set({ "n", "v" }, "L", "I", { desc = "Insert at line start" })
|
||||
|
||||
-- YANK TO SYSTEM CLIPBOARD
|
||||
vim.keymap.set("v", "Y", '"+y', { desc = "Copy to (System) Clipboard" })
|
||||
|
||||
-- SEARCH {{{
|
||||
vim.keymap.set("n", "<LEADER><CR>", "<CMD>nohlsearch<CR>", { desc = "clear search highlight" })
|
||||
--}}}
|
||||
|
||||
-- SPACE TO TAB{{{
|
||||
vim.keymap.set("n", "<LEADER>tt", "<CMD>%s/ /\t/g<CR>", { desc = "space to tab" })
|
||||
vim.keymap.set("v", "<LEADER>tt", "<CMD>s/ /\t/g<CR>", { desc = "space to tab" })
|
||||
--}}}
|
||||
|
||||
-- MISC {{{
|
||||
vim.keymap.set("n", "<LEADER>o", "za", { desc = "folding" })
|
||||
vim.keymap.set("i", "<C-y>", "<ESC>A {}<ESC>i<CR><ESC>ko", { desc = "insert a pair of {} and goto next line" })
|
||||
--}}}
|
||||
|
||||
-- ================= CURSOR MOVEMENT ===================== {{{
|
||||
-- NEW CURSOR MOVEMENT (ARROW KEY RESIZE WINDOWS)
|
||||
-- ^
|
||||
-- e
|
||||
-- < h i >
|
||||
-- n
|
||||
-- v
|
||||
--
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "e", "k", { desc = "move cursor ⇧" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "n", "j", { desc = "move cursor ⇩" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "h", "h", { desc = "move cursor ⇦" })
|
||||
vim.keymap.set({ "n", "v", "", "s", "x" }, "i", "l", { desc = "move cursor ⇨" })
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "E", "5k", { desc = "Move 5up K -> U" })
|
||||
vim.keymap.set({ "n", "v" }, "N", "5j", { desc = "Move 5down J -> E" })
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "H", "0", { desc = "Move start of line" })
|
||||
vim.keymap.set({ "n", "v" }, "I", "$", { desc = "Move end of line" })
|
||||
|
||||
vim.keymap.set("n", "gu", "gk", { desc = "move up gk -> gu" })
|
||||
vim.keymap.set("n", "ge", "gj", { desc = "move down gj -> ge" })
|
||||
|
||||
vim.keymap.set("n", "\v", "v$h", { desc = "???" })
|
||||
|
||||
-- FASTER IN-LINE NAVIGATION
|
||||
|
||||
-- SET h (SAME AS n, CURSOR LEFT) TO 'END OF WORD'
|
||||
vim.keymap.set("n", "j", "e", { desc = "Move cursor to end of word" })
|
||||
-- CTRL + U OR E WILL MOVE UP/DOWN THE VIEW PORT WITHOUT MOVING THE CURSOR
|
||||
|
||||
vim.keymap.set({ "n", "v" }, "<C-e>", "5<C-y>", { desc = "Move viewport ⇧" })
|
||||
vim.keymap.set({ "n", "v" }, "<C-n>", "5<C-e>", { desc = "Move viewport ⇩" })
|
||||
|
||||
-- INSERT MODE CURSOR MOVEMENT
|
||||
vim.keymap.set("i", "<C-a>", "<ESC>A")
|
||||
|
||||
-- COMMAND MODE CURSOR MOVEMENT
|
||||
vim.keymap.set("c", "<C-a>", "<Home>")
|
||||
vim.keymap.set("c", "<C-e>", "<End>")
|
||||
vim.keymap.set("c", "<C-p>", "<Up>")
|
||||
vim.keymap.set("c", "<C-n>", "<Down>")
|
||||
vim.keymap.set("c", "<C-b>", "<Left>")
|
||||
vim.keymap.set("c", "<C-f>", "<Right>")
|
||||
vim.keymap.set("c", "<M-b>", "<S-Left>")
|
||||
vim.keymap.set("c", "<M-w>", "<S-Right>")
|
||||
--}}}
|
||||
|
||||
-- ================= SPLIT MANAGMENT ===================== {{{
|
||||
vim.keymap.set("n", "<C-w>E", "<CMD>set nosplitbelow<CR><CMD>split<CR><CMD>set splitbelow<CR>", { desc = "Split ⇧" })
|
||||
vim.keymap.set("n", "<C-w>N", "<CMD>set splitbelow<CR><CMD>split<CR>", { desc = "Split ⇩" })
|
||||
vim.keymap.set("n", "<C-w>H", "<CMD>set nosplitright<CR><CMD>vsplit<CR><CMD>set splitright<CR>", { desc = "Split ⇦" })
|
||||
vim.keymap.set("n", "<C-w>I", "<CMD>set splitright<CR><CMD>vsplit<CR>", { desc = "Split ⇨" })
|
||||
|
||||
vim.keymap.set({ "n", "t" }, "<C-w>e", "<C-w>k", { desc = "Move cursor to split ⇧" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-w>n", "<C-w>j", { desc = "Move cursor to split ⇩" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-w>h", "<C-w>h", { desc = "Move cursor to split ⇦" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-w>i", "<C-w>l", { desc = "Move cursor to split ⇨" })
|
||||
|
||||
vim.keymap.set({ "n", "t" }, "<C-e>", "<C-k>", { desc = "Move cursor to split ⇧" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-n>", "<C-j>", { desc = "Move cursor to split ⇩" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-h>", "<C-h>", { desc = "Move cursor to split ⇦" })
|
||||
vim.keymap.set({ "n", "t" }, "<C-i>", "<C-l>", { desc = "Move cursor to split ⇨" })
|
||||
|
||||
vim.keymap.set("n", "<up>", "<CMD>res -5<CR>", { desc = "Resize split 0,-5" })
|
||||
vim.keymap.set("n", "<down>", "<CMD>res +5<CR>", { desc = "Resize split 0,+5" })
|
||||
vim.keymap.set("n", "<left>", "<CMD>vertical resize +5<CR>", { desc = "Resize split +5,0" })
|
||||
vim.keymap.set("n", "<right>", "<CMD>vertical resize -5<CR>", { desc = "Resize split -5,0" })
|
||||
|
||||
vim.keymap.set("n", "<C-w>H", "<C-w>t<C-w>K", { desc = "Make splits [H]orizontal" })
|
||||
vim.keymap.set("n", "<C-w>V", "<C-w>t<C-w>H", { desc = "Make splits [V]ertical" })
|
||||
|
||||
vim.keymap.set("n", "<C-w>ri", "<C-w>b<C-w>K", { desc = "Rotate splits 90" })
|
||||
vim.keymap.set("n", "<C-w>rh", "<C-w>b<C-w>H", { desc = "Rotate splits -90" })
|
||||
|
||||
vim.keymap.set("n", "<LEADER>q", "<C-w>j<CMD>q<CR>", { desc = "Close Split ⇩ (Below)" })
|
||||
--}}}
|
||||
|
||||
-- TAB MANAGEMENT {{{
|
||||
vim.keymap.set("n", "<TAB><TAB>", "<CMD>tabe<CR>", { desc = "New [Tab]" })
|
||||
|
||||
vim.keymap.set("n", "<TAB>h", "<CMD>-tabnext<CR>", { desc = "Select Tab ⇦" })
|
||||
vim.keymap.set("n", "<TAB>i", "<CMD>+tabnext<CR>", { desc = "Select Tab ⇨" })
|
||||
|
||||
vim.keymap.set("n", "<TAB>H", "<CMD>-tabmove<CR>", { desc = "Tab move ⇦" })
|
||||
vim.keymap.set("n", "<TAB>I", "<CMD>+tabmove<CR>", { desc = "Tab move ⇨" })
|
||||
|
||||
-- NOTE: Doesn't seem to work:
|
||||
-- vim.keymap.set("n", "<TAB>c", "<CMD>tab split<CR>", { desc = "New Tab from [C]urrent" })
|
||||
-- vim.keymap.set('n', '<LEADER>dw', '/\(\<\w\+\>\)\_s*\1', {desc='adjacent duplicate words'})
|
||||
|
||||
--vim.keymap.del("n", "<C-w>j")
|
||||
--vim.keymap.del("n", "<C-w>k")
|
||||
--vim.keymap.del("n", "<C-w>l")
|
||||
-- }}}
|
||||
|
||||
-- =================== TERM BEHAVIORS ====================
|
||||
vim.keymap.set("t", "<C-n>", "<C-\\><C-n>", { desc = "escape terminal, allowing excmds" })
|
||||
vim.keymap.set("t", "<C-o>", "<C-\\><C-n><C-o>", { desc = "close terminal" })
|
||||
|
||||
--vim: set fdm=marker fdl=0
|
||||
|
||||
-- buffers
|
||||
vim.keymap.set("n", "<S-h>", "<cmd>bprevious<cr>", { desc = "Prev Buffer" })
|
||||
vim.keymap.set("n", "<S-i>", "<cmd>bnext<cr>", { desc = "Next Buffer" })
|
||||
53
tools/nvim.lazy.d/lua/config/lazy.lua
Normal file
53
tools/nvim.lazy.d/lua/config/lazy.lua
Normal file
|
|
@ -0,0 +1,53 @@
|
|||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||
if vim.v.shell_error ~= 0 then
|
||||
vim.api.nvim_echo({
|
||||
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||
{ out, "WarningMsg" },
|
||||
{ "\nPress any key to exit..." },
|
||||
}, true, {})
|
||||
vim.fn.getchar()
|
||||
os.exit(1)
|
||||
end
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
spec = {
|
||||
-- add LazyVim and import its plugins
|
||||
{ "LazyVim/LazyVim", import = "lazyvim.plugins" },
|
||||
-- import/override with your plugins
|
||||
{ import = "plugins" },
|
||||
},
|
||||
defaults = {
|
||||
-- By default, only LazyVim plugins will be lazy-loaded. Your custom plugins will load during startup.
|
||||
-- If you know what you're doing, you can set this to `true` to have all your custom plugins lazy-loaded by default.
|
||||
lazy = false,
|
||||
-- It's recommended to leave version=false for now, since a lot the plugin that support versioning,
|
||||
-- have outdated releases, which may break your Neovim install.
|
||||
version = false, -- always use the latest git commit
|
||||
-- version = "*", -- try installing the latest stable version for plugins that support semver
|
||||
},
|
||||
install = { colorscheme = { "tokyonight", "habamax" } },
|
||||
checker = {
|
||||
enabled = true, -- check for plugin updates periodically
|
||||
notify = false, -- notify on update
|
||||
}, -- automatically check for plugin updates
|
||||
performance = {
|
||||
rtp = {
|
||||
-- disable some rtp plugins
|
||||
disabled_plugins = {
|
||||
"gzip",
|
||||
-- "matchit",
|
||||
-- "matchparen",
|
||||
-- "netrwPlugin",
|
||||
"tarPlugin",
|
||||
"tohtml",
|
||||
"tutor",
|
||||
"zipPlugin",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
3
tools/nvim.lazy.d/lua/config/options.lua
Normal file
3
tools/nvim.lazy.d/lua/config/options.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
-- Options are automatically loaded before lazy.nvim startup
|
||||
-- Default options that are always set: https://github.com/LazyVim/LazyVim/blob/main/lua/lazyvim/config/options.lua
|
||||
-- Add any additional options here
|
||||
54
tools/nvim.lazy.d/lua/plugins/catppuccin.lua
Normal file
54
tools/nvim.lazy.d/lua/plugins/catppuccin.lua
Normal file
|
|
@ -0,0 +1,54 @@
|
|||
return {
|
||||
"catppuccin/nvim",
|
||||
lazy = true,
|
||||
name = "catppuccin",
|
||||
opts = {
|
||||
integrations = {
|
||||
aerial = true,
|
||||
alpha = true,
|
||||
cmp = true,
|
||||
dashboard = true,
|
||||
flash = true,
|
||||
grug_far = true,
|
||||
gitsigns = true,
|
||||
headlines = true,
|
||||
illuminate = true,
|
||||
indent_blankline = { enabled = true },
|
||||
leap = true,
|
||||
lsp_trouble = true,
|
||||
mason = true,
|
||||
markdown = true,
|
||||
mini = true,
|
||||
native_lsp = {
|
||||
enabled = true,
|
||||
underlines = {
|
||||
errors = { "undercurl" },
|
||||
hints = { "undercurl" },
|
||||
warnings = { "undercurl" },
|
||||
information = { "undercurl" },
|
||||
},
|
||||
},
|
||||
navic = { enabled = true, custom_bg = "lualine" },
|
||||
neotest = true,
|
||||
neotree = true,
|
||||
noice = true,
|
||||
notify = true,
|
||||
semantic_tokens = true,
|
||||
telescope = true,
|
||||
treesitter = true,
|
||||
treesitter_context = true,
|
||||
which_key = true,
|
||||
},
|
||||
},
|
||||
specs = {
|
||||
{
|
||||
"akinsho/bufferline.nvim",
|
||||
optional = true,
|
||||
opts = function(_, opts)
|
||||
if (vim.g.colors_name or ""):find("catppuccin") then
|
||||
opts.highlights = require("catppuccin.groups.integrations.bufferline").get()
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
}
|
||||
13
tools/nvim.lazy.d/lua/plugins/colorscheme.lua
Normal file
13
tools/nvim.lazy.d/lua/plugins/colorscheme.lua
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
return {
|
||||
-- add gruvbox
|
||||
{ "ellisonleao/gruvbox.nvim" },
|
||||
{ "catppuccin/nvim", name = "catppuccin", priority = 1000 },
|
||||
|
||||
-- Configure LazyVim to load gruvbox
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = {
|
||||
colorscheme = "catppuccin",
|
||||
},
|
||||
},
|
||||
}
|
||||
65
tools/nvim.lazy.d/lua/plugins/dashboard.lua
Normal file
65
tools/nvim.lazy.d/lua/plugins/dashboard.lua
Normal file
|
|
@ -0,0 +1,65 @@
|
|||
return {
|
||||
"nvimdev/dashboard-nvim",
|
||||
lazy = false, -- As https://github.com/nvimdev/dashboard-nvim/pull/450, dashboard-nvim shouldn't be lazy-loaded to properly handle stdin.
|
||||
opts = function()
|
||||
local logo = [[
|
||||
██╗ █████╗ ███████╗██╗ ██╗██╗ ██╗██╗███╗ ███╗ Z
|
||||
██║ ██╔══██╗╚══███╔╝╚██╗ ██╔╝██║ ██║██║████╗ ████║ Z
|
||||
██║ ███████║ ███╔╝ ╚████╔╝ ██║ ██║██║██╔████╔██║ z
|
||||
██║ ██╔══██║ ███╔╝ ╚██╔╝ ╚██╗ ██╔╝██║██║╚██╔╝██║ z
|
||||
███████╗██║ ██║███████╗ ██║ ╚████╔╝ ██║██║ ╚═╝ ██║
|
||||
╚══════╝╚═╝ ╚═╝╚══════╝ ╚═╝ ╚═══╝ ╚═╝╚═╝ ╚═╝
|
||||
]]
|
||||
|
||||
-- logo = string.rep("\n", 8) .. logo .. "\n\n"
|
||||
|
||||
local opts = {
|
||||
theme = "doom",
|
||||
hide = {
|
||||
-- this is taken care of by lualine
|
||||
-- enabling this messes up the actual laststatus setting after loading a file
|
||||
statusline = false,
|
||||
},
|
||||
config = {
|
||||
header = vim.split(logo, "\n"),
|
||||
-- stylua: ignore
|
||||
center = {
|
||||
{ action = 'lua LazyVim.pick()()', desc = " Find File", icon = " ", key = "f" },
|
||||
{ action = "ene | startinsert", desc = " New File", icon = " ", key = "n" },
|
||||
{ action = 'lua LazyVim.pick("oldfiles")()', desc = " Recent Files", icon = " ", key = "r" },
|
||||
{ action = 'lua LazyVim.pick("live_grep")()', desc = " Find Text", icon = " ", key = "g" },
|
||||
{ action = 'lua LazyVim.pick.config_files()()', desc = " Config", icon = " ", key = "c" },
|
||||
{ action = 'lua require("persistence").load()', desc = " Restore Session", icon = " ", key = "s" },
|
||||
{ action = "LazyExtras", desc = " Lazy Extras", icon = " ", key = "x" },
|
||||
{ action = "Lazy", desc = " Lazy", icon = " ", key = "l" },
|
||||
{ action = function() vim.api.nvim_input("<cmd>qa<cr>") end, desc = " Quit", icon = " ", key = "q" },
|
||||
},
|
||||
footer = function()
|
||||
local stats = require("lazy").stats()
|
||||
local ms = (math.floor(stats.startuptime * 100 + 0.5) / 100)
|
||||
return { "⚡ Neovim loaded " .. stats.loaded .. "/" .. stats.count .. " plugins in " .. ms .. "ms" }
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
for _, button in ipairs(opts.config.center) do
|
||||
button.desc = button.desc .. string.rep(" ", 43 - #button.desc)
|
||||
button.key_format = " %s"
|
||||
end
|
||||
|
||||
-- open dashboard after closing lazy
|
||||
if vim.o.filetype == "lazy" then
|
||||
vim.api.nvim_create_autocmd("WinClosed", {
|
||||
pattern = tostring(vim.api.nvim_get_current_win()),
|
||||
once = true,
|
||||
callback = function()
|
||||
vim.schedule(function()
|
||||
vim.api.nvim_exec_autocmds("UIEnter", { group = "dashboard" })
|
||||
end)
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return opts
|
||||
end,
|
||||
}
|
||||
197
tools/nvim.lazy.d/lua/plugins/example.lua
Normal file
197
tools/nvim.lazy.d/lua/plugins/example.lua
Normal file
|
|
@ -0,0 +1,197 @@
|
|||
-- since this is just an example spec, don't actually load anything here and return an empty spec
|
||||
-- stylua: ignore
|
||||
if true then return {} end
|
||||
|
||||
-- every spec file under the "plugins" directory will be loaded automatically by lazy.nvim
|
||||
--
|
||||
-- In your plugin files, you can:
|
||||
-- * add extra plugins
|
||||
-- * disable/enabled LazyVim plugins
|
||||
-- * override the configuration of LazyVim plugins
|
||||
return {
|
||||
-- add gruvbox
|
||||
{ "ellisonleao/gruvbox.nvim" },
|
||||
|
||||
-- Configure LazyVim to load gruvbox
|
||||
{
|
||||
"LazyVim/LazyVim",
|
||||
opts = {
|
||||
colorscheme = "gruvbox",
|
||||
},
|
||||
},
|
||||
|
||||
-- change trouble config
|
||||
{
|
||||
"folke/trouble.nvim",
|
||||
-- opts will be merged with the parent spec
|
||||
opts = { use_diagnostic_signs = true },
|
||||
},
|
||||
|
||||
-- disable trouble
|
||||
{ "folke/trouble.nvim", enabled = false },
|
||||
|
||||
-- override nvim-cmp and add cmp-emoji
|
||||
{
|
||||
"hrsh7th/nvim-cmp",
|
||||
dependencies = { "hrsh7th/cmp-emoji" },
|
||||
---@param opts cmp.ConfigSchema
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sources, { name = "emoji" })
|
||||
end,
|
||||
},
|
||||
|
||||
-- change some telescope options and a keymap to browse plugin files
|
||||
{
|
||||
"nvim-telescope/telescope.nvim",
|
||||
keys = {
|
||||
-- add a keymap to browse plugin files
|
||||
-- stylua: ignore
|
||||
{
|
||||
"<leader>fp",
|
||||
function() require("telescope.builtin").find_files({ cwd = require("lazy.core.config").options.root }) end,
|
||||
desc = "Find Plugin File",
|
||||
},
|
||||
},
|
||||
-- change some options
|
||||
opts = {
|
||||
defaults = {
|
||||
layout_strategy = "horizontal",
|
||||
layout_config = { prompt_position = "top" },
|
||||
sorting_strategy = "ascending",
|
||||
winblend = 0,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add pyright to lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- pyright will be automatically installed with mason and loaded with lspconfig
|
||||
pyright = {},
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- add tsserver and setup with typescript.nvim instead of lspconfig
|
||||
{
|
||||
"neovim/nvim-lspconfig",
|
||||
dependencies = {
|
||||
"jose-elias-alvarez/typescript.nvim",
|
||||
init = function()
|
||||
require("lazyvim.util").lsp.on_attach(function(_, buffer)
|
||||
-- stylua: ignore
|
||||
vim.keymap.set( "n", "<leader>co", "TypescriptOrganizeImports", { buffer = buffer, desc = "Organize Imports" })
|
||||
vim.keymap.set("n", "<leader>cR", "TypescriptRenameFile", { desc = "Rename File", buffer = buffer })
|
||||
end)
|
||||
end,
|
||||
},
|
||||
---@class PluginLspOpts
|
||||
opts = {
|
||||
---@type lspconfig.options
|
||||
servers = {
|
||||
-- tsserver will be automatically installed with mason and loaded with lspconfig
|
||||
tsserver = {},
|
||||
},
|
||||
-- you can do any additional lsp server setup here
|
||||
-- return true if you don't want this server to be setup with lspconfig
|
||||
---@type table<string, fun(server:string, opts:_.lspconfig.options):boolean?>
|
||||
setup = {
|
||||
-- example to setup with typescript.nvim
|
||||
tsserver = function(_, opts)
|
||||
require("typescript").setup({ server = opts })
|
||||
return true
|
||||
end,
|
||||
-- Specify * to use this function as a fallback for any server
|
||||
-- ["*"] = function(server, opts) end,
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- for typescript, LazyVim also includes extra specs to properly setup lspconfig,
|
||||
-- treesitter, mason and typescript.nvim. So instead of the above, you can use:
|
||||
{ import = "lazyvim.plugins.extras.lang.typescript" },
|
||||
|
||||
-- add more treesitter parsers
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"bash",
|
||||
"html",
|
||||
"javascript",
|
||||
"json",
|
||||
"lua",
|
||||
"markdown",
|
||||
"markdown_inline",
|
||||
"python",
|
||||
"query",
|
||||
"regex",
|
||||
"tsx",
|
||||
"typescript",
|
||||
"vim",
|
||||
"yaml",
|
||||
},
|
||||
},
|
||||
},
|
||||
|
||||
-- since `vim.tbl_deep_extend`, can only merge tables and not lists, the code above
|
||||
-- would overwrite `ensure_installed` with the new value.
|
||||
-- If you'd rather extend the default config, use the code below instead:
|
||||
{
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
opts = function(_, opts)
|
||||
-- add tsx and treesitter
|
||||
vim.list_extend(opts.ensure_installed, {
|
||||
"tsx",
|
||||
"typescript",
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- the opts function can also be used to change the default opts:
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function(_, opts)
|
||||
table.insert(opts.sections.lualine_x, {
|
||||
function()
|
||||
return "😄"
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
|
||||
-- or you can return new options to override all the defaults
|
||||
{
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = function()
|
||||
return {
|
||||
--[[add your custom lualine config here]]
|
||||
}
|
||||
end,
|
||||
},
|
||||
|
||||
-- use mini.starter instead of alpha
|
||||
{ import = "lazyvim.plugins.extras.ui.mini-starter" },
|
||||
|
||||
-- add jsonls and schemastore packages, and setup treesitter for json, json5 and jsonc
|
||||
{ import = "lazyvim.plugins.extras.lang.json" },
|
||||
|
||||
-- add any tools you want to have installed below
|
||||
{
|
||||
"williamboman/mason.nvim",
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
"stylua",
|
||||
"shellcheck",
|
||||
"shfmt",
|
||||
"flake8",
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
4
tools/nvim.lazy.d/lua/plugins/just.lua
Normal file
4
tools/nvim.lazy.d/lua/plugins/just.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
"NoahTheDuke/vim-just",
|
||||
ft = { "just" },
|
||||
}
|
||||
126
tools/nvim.lazy.d/lua/plugins/lualine.lua
Normal file
126
tools/nvim.lazy.d/lua/plugins/lualine.lua
Normal file
|
|
@ -0,0 +1,126 @@
|
|||
return {
|
||||
"nvim-lualine/lualine.nvim",
|
||||
event = "VeryLazy",
|
||||
init = function()
|
||||
vim.g.lualine_laststatus = vim.o.laststatus
|
||||
if vim.fn.argc(-1) > 0 then
|
||||
-- set an empty statusline till lualine loads
|
||||
vim.o.statusline = " "
|
||||
else
|
||||
-- hide the statusline on the starter page
|
||||
vim.o.laststatus = 0
|
||||
end
|
||||
end,
|
||||
opts = function()
|
||||
-- PERF: we don't need this lualine require madness 🤷
|
||||
local lualine_require = require("lualine_require")
|
||||
lualine_require.require = require
|
||||
|
||||
local icons = LazyVim.config.icons
|
||||
|
||||
vim.o.laststatus = vim.g.lualine_laststatus
|
||||
|
||||
local opts = {
|
||||
options = {
|
||||
theme = "auto",
|
||||
globalstatus = vim.o.laststatus == 3,
|
||||
disabled_filetypes = { statusline = { "dashboard", "alpha", "ministarter", "snacks_dashboard", "NvimTree_1" } },
|
||||
},
|
||||
sections = {
|
||||
lualine_a = { "mode" },
|
||||
lualine_b = { "branch" },
|
||||
|
||||
lualine_c = {
|
||||
LazyVim.lualine.root_dir(),
|
||||
{
|
||||
"diagnostics",
|
||||
symbols = {
|
||||
error = icons.diagnostics.Error,
|
||||
warn = icons.diagnostics.Warn,
|
||||
info = icons.diagnostics.Info,
|
||||
hint = icons.diagnostics.Hint,
|
||||
},
|
||||
},
|
||||
{ "filetype", icon_only = true, separator = "", padding = { left = 1, right = 0 } },
|
||||
{ LazyVim.lualine.pretty_path() },
|
||||
},
|
||||
lualine_x = {
|
||||
-- stylua: ignore
|
||||
{
|
||||
function() return require("noice").api.status.command.get() end,
|
||||
cond = function() return package.loaded["noice"] and require("noice").api.status.command.has() end,
|
||||
color = function() return LazyVim.ui.fg("Statement") end,
|
||||
},
|
||||
-- stylua: ignore
|
||||
{
|
||||
function() return require("noice").api.status.mode.get() end,
|
||||
cond = function() return package.loaded["noice"] and require("noice").api.status.mode.has() end,
|
||||
color = function() return LazyVim.ui.fg("Constant") end,
|
||||
},
|
||||
-- stylua: ignore
|
||||
{
|
||||
function() return " " .. require("dap").status() end,
|
||||
cond = function() return package.loaded["dap"] and require("dap").status() ~= "" end,
|
||||
color = function() return LazyVim.ui.fg("Debug") end,
|
||||
},
|
||||
-- stylua: ignore
|
||||
{
|
||||
require("lazy.status").updates,
|
||||
cond = require("lazy.status").has_updates,
|
||||
color = function() return LazyVim.ui.fg("Special") end,
|
||||
},
|
||||
{
|
||||
"diff",
|
||||
symbols = {
|
||||
added = icons.git.added,
|
||||
modified = icons.git.modified,
|
||||
removed = icons.git.removed,
|
||||
},
|
||||
source = function()
|
||||
local gitsigns = vim.b.gitsigns_status_dict
|
||||
if gitsigns then
|
||||
return {
|
||||
added = gitsigns.added,
|
||||
modified = gitsigns.changed,
|
||||
removed = gitsigns.removed,
|
||||
}
|
||||
end
|
||||
end,
|
||||
},
|
||||
},
|
||||
lualine_y = {
|
||||
{ "progress", separator = " ", padding = { left = 1, right = 0 } },
|
||||
{ "location", padding = { left = 0, right = 1 } },
|
||||
},
|
||||
lualine_z = {
|
||||
function()
|
||||
return " " .. os.date("%R")
|
||||
end,
|
||||
},
|
||||
},
|
||||
extensions = { "neo-tree", "lazy" },
|
||||
}
|
||||
|
||||
-- do not add trouble symbols if aerial is enabled
|
||||
-- And allow it to be overriden for some buffer types (see autocmds)
|
||||
if vim.g.trouble_lualine and LazyVim.has("trouble.nvim") then
|
||||
local trouble = require("trouble")
|
||||
local symbols = trouble.statusline({
|
||||
mode = "symbols",
|
||||
groups = {},
|
||||
title = false,
|
||||
filter = { range = true },
|
||||
format = "{kind_icon}{symbol.name:Normal}",
|
||||
hl_group = "lualine_c_normal",
|
||||
})
|
||||
table.insert(opts.sections.lualine_c, {
|
||||
symbols and symbols.get,
|
||||
cond = function()
|
||||
return vim.b.trouble_lualine ~= false and symbols.has()
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
return opts
|
||||
end,
|
||||
}
|
||||
138
tools/nvim.lazy.d/lua/plugins/neo-tree.lua
Normal file
138
tools/nvim.lazy.d/lua/plugins/neo-tree.lua
Normal file
|
|
@ -0,0 +1,138 @@
|
|||
return {
|
||||
"nvim-neo-tree/neo-tree.nvim",
|
||||
cmd = "Neotree",
|
||||
keys = {
|
||||
{
|
||||
"<leader>fe",
|
||||
function()
|
||||
require("neo-tree.command").execute({ toggle = true, dir = LazyVim.root() })
|
||||
end,
|
||||
desc = "Explorer NeoTree (Root Dir)",
|
||||
},
|
||||
{
|
||||
"<leader>fE",
|
||||
function()
|
||||
require("neo-tree.command").execute({ toggle = true, dir = vim.uv.cwd() })
|
||||
end,
|
||||
desc = "Explorer NeoTree (cwd)",
|
||||
},
|
||||
{ "<leader>e", "<leader>fe", desc = "Explorer NeoTree (Root Dir)", remap = true },
|
||||
{ "<leader>E", "<leader>fE", desc = "Explorer NeoTree (cwd)", remap = true },
|
||||
{
|
||||
"<leader>ge",
|
||||
function()
|
||||
require("neo-tree.command").execute({ source = "git_status", toggle = true })
|
||||
end,
|
||||
desc = "Git Explorer",
|
||||
},
|
||||
{
|
||||
"<leader>be",
|
||||
function()
|
||||
require("neo-tree.command").execute({ source = "buffers", toggle = true })
|
||||
end,
|
||||
desc = "Buffer Explorer",
|
||||
},
|
||||
},
|
||||
deactivate = function()
|
||||
vim.cmd([[Neotree close]])
|
||||
end,
|
||||
init = function()
|
||||
-- FIX: use `autocmd` for lazy-loading neo-tree instead of directly requiring it,
|
||||
-- because `cwd` is not set up properly.
|
||||
vim.api.nvim_create_autocmd("BufEnter", {
|
||||
group = vim.api.nvim_create_augroup("Neotree_start_directory", { clear = true }),
|
||||
desc = "Start Neo-tree with directory",
|
||||
once = true,
|
||||
callback = function()
|
||||
if package.loaded["neo-tree"] then
|
||||
return
|
||||
else
|
||||
local stats = vim.uv.fs_stat(vim.fn.argv(0))
|
||||
if stats and stats.type == "directory" then
|
||||
require("neo-tree")
|
||||
end
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
opts = {
|
||||
sources = { "filesystem", "buffers", "git_status" },
|
||||
open_files_do_not_replace_types = { "terminal", "Trouble", "trouble", "qf", "Outline" },
|
||||
filesystem = {
|
||||
hide_dotfiles = false,
|
||||
hide_hidden = false,
|
||||
bind_to_cwd = false,
|
||||
follow_current_file = { enabled = true },
|
||||
use_libuv_file_watcher = true,
|
||||
hide_by_name = {
|
||||
".git",
|
||||
"node_modules",
|
||||
"requirements.txt",
|
||||
"desktop.ini",
|
||||
},
|
||||
never_show = {
|
||||
".DS_Store",
|
||||
},
|
||||
},
|
||||
window = {
|
||||
mappings = {
|
||||
-- MARKED
|
||||
["i"] = "open",
|
||||
-- MARKED
|
||||
["e"] = "noop",
|
||||
["h"] = "close_node",
|
||||
["<space>"] = "none",
|
||||
["Y"] = {
|
||||
function(state)
|
||||
local node = state.tree:get_node()
|
||||
local path = node:get_id()
|
||||
vim.fn.setreg("+", path, "c")
|
||||
end,
|
||||
desc = "Copy Path to Clipboard",
|
||||
},
|
||||
["O"] = {
|
||||
function(state)
|
||||
require("lazy.util").open(state.tree:get_node().path, { system = true })
|
||||
end,
|
||||
desc = "Open with System Application",
|
||||
},
|
||||
["P"] = { "toggle_preview", config = { use_float = false } },
|
||||
},
|
||||
},
|
||||
default_component_configs = {
|
||||
indent = {
|
||||
with_expanders = true, -- if nil and file nesting is enabled, will enable expanders
|
||||
expander_collapsed = "",
|
||||
expander_expanded = "",
|
||||
expander_highlight = "NeoTreeExpander",
|
||||
},
|
||||
git_status = {
|
||||
symbols = {
|
||||
unstaged = "",
|
||||
staged = "",
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
local function on_move(data)
|
||||
LazyVim.lsp.on_rename(data.source, data.destination)
|
||||
end
|
||||
|
||||
local events = require("neo-tree.events")
|
||||
opts.event_handlers = opts.event_handlers or {}
|
||||
vim.list_extend(opts.event_handlers, {
|
||||
{ event = events.FILE_MOVED, handler = on_move },
|
||||
{ event = events.FILE_RENAMED, handler = on_move },
|
||||
})
|
||||
require("neo-tree").setup(opts)
|
||||
vim.api.nvim_create_autocmd("TermClose", {
|
||||
pattern = "*lazygit",
|
||||
callback = function()
|
||||
if package.loaded["neo-tree.sources.git_status"] then
|
||||
require("neo-tree.sources.git_status").refresh()
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
11
tools/nvim.lazy.d/lua/plugins/nvim-tree.lua
Normal file
11
tools/nvim.lazy.d/lua/plugins/nvim-tree.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
version = "*",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
config = function()
|
||||
require("nvim-tree").setup({})
|
||||
end,
|
||||
}
|
||||
22
tools/nvim.lazy.d/lua/plugins/obsidian.lua
Normal file
22
tools/nvim.lazy.d/lua/plugins/obsidian.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
return {
|
||||
"epwalsh/obsidian.nvim",
|
||||
version = "*", -- recommended, use latest release instead of latest commit
|
||||
lazy = true,
|
||||
ft = "markdown",
|
||||
dependencies = {
|
||||
-- Required.
|
||||
"nvim-lua/plenary.nvim",
|
||||
|
||||
-- see below for full list of optional dependencies 👇
|
||||
},
|
||||
opts = {
|
||||
workspaces = {
|
||||
{
|
||||
name = "Obsidian",
|
||||
path = "/mnt/c/Users/citoy/Obsidian",
|
||||
},
|
||||
},
|
||||
|
||||
-- see below for full list of options 👇
|
||||
},
|
||||
}
|
||||
3
tools/nvim.lazy.d/lua/plugins/wakatime.lua
Normal file
3
tools/nvim.lazy.d/lua/plugins/wakatime.lua
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
return {
|
||||
{ 'wakatime/vim-wakatime', lazy = false },
|
||||
}
|
||||
3
tools/nvim.lazy.d/stylua.toml
Normal file
3
tools/nvim.lazy.d/stylua.toml
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
column_width = 120
|
||||
12
tools/nvim/.editorconfig
Normal file
12
tools/nvim/.editorconfig
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
[*]
|
||||
indent_style = space
|
||||
indent_size = 2
|
||||
end_of_line = lf
|
||||
charset = utf-8
|
||||
trim_trailing_whitespace = true
|
||||
insert_final_newline = true
|
||||
|
||||
[*.lua]
|
||||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
column_width = 120
|
||||
1
tools/nvim/.gitignore
vendored
Normal file
1
tools/nvim/.gitignore
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
lazy-lock.json
|
||||
28
tools/nvim/init.lua
Normal file
28
tools/nvim/init.lua
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
--[[
|
||||
-*- coding: utf-8 -*-
|
||||
@Filename init.lua
|
||||
@Author js0ny
|
||||
@Date 2024-11-27
|
||||
@Description neovim 配置文件
|
||||
]]
|
||||
-- 针对特定文件类型设置快捷键
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "markdown", -- 指定文件类型
|
||||
callback = function()
|
||||
vim.api.nvim_buf_set_keymap(0, "v", "`", "c`<C-r>\"`<Esc>", { noremap = true, silent = true, desc = "Wrap selection with backticks" })
|
||||
end,
|
||||
})
|
||||
|
||||
-- 加载配置
|
||||
require("config.options")
|
||||
-- 加载键位映射
|
||||
require("config.keymaps")
|
||||
|
||||
-- 加载插件
|
||||
require("config.plugins")
|
||||
|
||||
-- 加载主题
|
||||
require("config.colorscheme")
|
||||
|
||||
|
||||
-- vim.api.nvim_create_autocmd({ "VimEnter" }, { callback = open_nvim_tree })
|
||||
1
tools/nvim/lua/config/colorscheme.lua
Normal file
1
tools/nvim/lua/config/colorscheme.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
vim.cmd.colorscheme("catppuccin")
|
||||
2
tools/nvim/lua/config/keymaps.lua
Normal file
2
tools/nvim/lua/config/keymaps.lua
Normal file
|
|
@ -0,0 +1,2 @@
|
|||
require("keymaps")
|
||||
|
||||
52
tools/nvim/lua/config/options.lua
Normal file
52
tools/nvim/lua/config/options.lua
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
-- <leader> is space
|
||||
vim.g.mapleader = " "
|
||||
vim.g.maplocalleader = "\\"
|
||||
-- Disable netrw
|
||||
vim.g.loaded_netrw = 1
|
||||
vim.g.loaded_netrwPlugin = 1
|
||||
-- Disable Perl
|
||||
vim.g.loaded_perl_provider = 0 -- Don't load Perl
|
||||
|
||||
vim.g.autoformat = true
|
||||
|
||||
local opt = vim.opt
|
||||
|
||||
-- Clipboard
|
||||
opt.clipboard = vim.env.SSH_TTY and "" or "unnamedplus"
|
||||
-- Line number
|
||||
opt.number = true
|
||||
opt.relativenumber = true
|
||||
|
||||
opt.confirm = true
|
||||
|
||||
-- Word wrap
|
||||
opt.linebreak = true
|
||||
|
||||
-- Indentation
|
||||
opt.expandtab = true
|
||||
opt.shiftwidth = 4
|
||||
opt.shiftround = true
|
||||
|
||||
-- Case
|
||||
opt.ignorecase = true
|
||||
opt.smartcase = true
|
||||
|
||||
opt.cursorline = true
|
||||
-- Terminal GUI
|
||||
opt.termguicolors = true
|
||||
|
||||
-- Fold
|
||||
opt.foldlevel = 99
|
||||
opt.foldmethod = "expr"
|
||||
|
||||
-- Statusline
|
||||
opt.laststatus = 0
|
||||
|
||||
-- Hide Command Line if empty
|
||||
opt.cmdheight = 0
|
||||
|
||||
-- Scroll
|
||||
opt.scrolloff = 5
|
||||
opt.sidescrolloff = 10
|
||||
|
||||
opt.conceallevel = 2
|
||||
1
tools/nvim/lua/config/plugins.lua
Normal file
1
tools/nvim/lua/config/plugins.lua
Normal file
|
|
@ -0,0 +1 @@
|
|||
require("plugins")
|
||||
34
tools/nvim/lua/config/servers.lua
Normal file
34
tools/nvim/lua/config/servers.lua
Normal file
|
|
@ -0,0 +1,34 @@
|
|||
--- Available LSP goes here
|
||||
--- Check https://github.com/neovim/nvim-lspconfig/blob/master/doc/configs.md
|
||||
--- for available server and name
|
||||
local M = {}
|
||||
M.servers = {
|
||||
"arduino_language_server", -- Arduino
|
||||
"bashls", -- Bash
|
||||
"clangd", -- C/C++
|
||||
-- "cmake", -- CMake
|
||||
"eslint", -- JavaScript
|
||||
"gopls", -- Go
|
||||
"html", -- HTML
|
||||
"julials", -- Julia
|
||||
"lua_ls", -- Lua
|
||||
"omnisharp", -- C# & F#
|
||||
"powershell_es", -- PowerShell
|
||||
"pyright", -- Python
|
||||
"rust_analyzer", -- Rust
|
||||
"taplo", -- TOML
|
||||
"vimls", -- vimscript
|
||||
}
|
||||
|
||||
M.server_config = {
|
||||
lua_ls = {
|
||||
capabilities = vim.lsp.protocol.make_client_capabilities(),
|
||||
settings = {
|
||||
Lua = {
|
||||
diagnostics = { globals = { "vim" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
return M
|
||||
20
tools/nvim/lua/keymaps/basic.lua
Normal file
20
tools/nvim/lua/keymaps/basic.lua
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
local mode_arrow = { "n", "v", "o", "s", "x" }
|
||||
|
||||
local keymaps_basic = { -- Modification of Original Keymap - Colemak
|
||||
{ mode = mode_arrow, keys = "n", cmd = "j" },
|
||||
{ mode = mode_arrow, keys = "e", cmd = "k" },
|
||||
{ mode = mode_arrow, keys = "i", cmd = "l" },
|
||||
{ keys = "H", cmd = ":bprevious<CR>" },
|
||||
{ keys = "N", cmd = "J" },
|
||||
{ keys = "E", cmd = "K" },
|
||||
{ keys = "I", cmd = ":bnext<CR>" },
|
||||
{ keys = "l", cmd = "i" },
|
||||
{ keys = "L", cmd = "I" },
|
||||
{ keys = "k", cmd = "n" },
|
||||
{ keys = "K", cmd = "N" },
|
||||
{ keys = "j", cmd = "e" },
|
||||
{ keys = "J", cmd = "E" },
|
||||
{ keys = "Y", cmd = "y$"},
|
||||
}
|
||||
|
||||
return keymaps_basic
|
||||
52
tools/nvim/lua/keymaps/init.lua
Normal file
52
tools/nvim/lua/keymaps/init.lua
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
local M = {}
|
||||
local global_default_opts = { noremap = true, silent = true }
|
||||
local global_default_mode = { "n" }
|
||||
-- local mode_arrow = { "n", "v", "o", "s", "x" }
|
||||
|
||||
local function set_keymaps(maps, default_opts, default_mode)
|
||||
for _, map in ipairs(maps) do
|
||||
local opts = vim.tbl_extend("force", default_opts, map.opts or {})
|
||||
local mode = map.mode or default_mode
|
||||
vim.keymap.set(mode, map.keys, map.cmd, opts)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
||||
local keymaps_basic = require("keymaps.basic")
|
||||
local keymaps_nvim_tree_general = require("keymaps.nvim-tree").global
|
||||
local keymaps_leader = require("keymaps.leaders")
|
||||
|
||||
set_keymaps(keymaps_basic, global_default_opts, global_default_mode)
|
||||
set_keymaps(keymaps_nvim_tree_general, global_default_opts, global_default_mode)
|
||||
set_keymaps(keymaps_leader, global_default_opts, global_default_mode)
|
||||
|
||||
M.nvim_tree_keymaps = require("keymaps.nvim-tree").plugin
|
||||
|
||||
--- `map` default for `cmp.mapping`
|
||||
function M.cmp_nvim_keymaps(map)
|
||||
return {
|
||||
{ keys = "<C-n>", cmd = map.select_next_item(), desc = "Select next completion item" },
|
||||
{ keys = "<C-p>", cmd = map.select_prev_item(), desc = "Select previous completion item" },
|
||||
{ keys = "<C-y>", cmd = map.confirm({ select = true }), desc = "Confirm completion" },
|
||||
{ keys = "<Tab>", cmd = map.confirm({ select = true }), desc = "Confirm completion" },
|
||||
{ keys = "<C-Space>", cmd = map.complete(), desc = "Trigger completion" },
|
||||
{ keys = "<C-e>", cmd = map.abort(), desc = "Abort completion" },
|
||||
}
|
||||
end
|
||||
|
||||
local function set_markdown_keymaps(bufnr)
|
||||
local opts = { noremap = true, silent = true, buffer = bufnr }
|
||||
vim.keymap.set("v", "`", "c`<C-r>\"`<Esc>", opts)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "markdown",
|
||||
callback = function()
|
||||
set_markdown_keymaps(0)
|
||||
end,
|
||||
})
|
||||
|
||||
require("keymaps.language")
|
||||
|
||||
return M
|
||||
28
tools/nvim/lua/keymaps/language.lua
Normal file
28
tools/nvim/lua/keymaps/language.lua
Normal file
|
|
@ -0,0 +1,28 @@
|
|||
local M = {}
|
||||
|
||||
|
||||
-- Markdown
|
||||
|
||||
local function set_markdown_keymaps(bufnr)
|
||||
local markdown_opt = { noremap = true, silent = true, buffer = bufnr }
|
||||
for _, map in ipairs(M.markdown) do
|
||||
local opts = vim.tbl_extend("force", markdown_opt, map.opts or {})
|
||||
vim.keymap.set(map.mode, map.keys, map.cmd, opts)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
M.markdown = {
|
||||
{ mode = "v", keys = "`", cmd = "c`<Esc>pi`<Esc>" , desc = "Wrap selection in ` for inline code" },
|
||||
{ mode = "v", keys = "*", cmd = "c**<Esc>pi**<Esc>" , desc = "Wrap selection in ** for bold" },
|
||||
{ mode = "v", keys = "_", cmd = "c*<Esc>pi*<Esc>" , desc = "Wrap selection in * for italic" },
|
||||
}
|
||||
|
||||
vim.api.nvim_create_autocmd("FileType", {
|
||||
pattern = "markdown",
|
||||
callback = function()
|
||||
set_markdown_keymaps(0)
|
||||
end,
|
||||
})
|
||||
|
||||
return M
|
||||
79
tools/nvim/lua/keymaps/leaders.lua
Normal file
79
tools/nvim/lua/keymaps/leaders.lua
Normal file
|
|
@ -0,0 +1,79 @@
|
|||
local M = {}
|
||||
|
||||
local leader_general = {
|
||||
{ keys = "<space>", cmd = ":Telescope find_files<CR>", desc = "Find Files" },
|
||||
{ keys = "/", cmd = ":Telescope live_grep<CR>", desc = "Grep Files" },
|
||||
}
|
||||
|
||||
for _,map in ipairs(leader_general) do
|
||||
map.keys = "<leader>" .. map.keys
|
||||
table.insert(M, map)
|
||||
end
|
||||
|
||||
local leader_q = { -- leader q: Quit
|
||||
{ keys = "q", cmd = ":q<CR>", desc = "Quit" },
|
||||
{ keys = "Q", cmd = ":qa!<CR>", desc = "Force Quit" },
|
||||
{ keys = "w", cmd = ":wq<CR>", desc = "Write and Quit" },
|
||||
{ keys = "W", cmd = ":wall<CR>:qa!<CR>", desc = "Write all and Force Quit" },
|
||||
}
|
||||
|
||||
local leader_w = { -- leader w: Windows Management
|
||||
{ keys = "h", cmd = "<C-w>h", desc = "Left Window" },
|
||||
{ keys = "n", cmd = "<C-w>j", desc = "Down Window" },
|
||||
{ keys = "e", cmd = "<C-w>k", desc = "Up Window" },
|
||||
{ keys = "i", cmd = "<C-w>l", desc = "Right Window" },
|
||||
{ keys = "-", cmd = ":split<CR>", desc = "Split to down" },
|
||||
{ keys = "|", cmd = ":vsplit<CR>", desc = "Split to right" },
|
||||
{ keys = "c", cmd = "<C-w>c", desc = "Close Window" },
|
||||
{ keys = "o", cmd = "<C-w>o", desc = "Close Other Windows" },
|
||||
{ keys = "r", cmd = "<C-w>r", desc = "Rotate Windows" },
|
||||
{ keys = "R", cmd = "<C-w>R", desc = "Reverse Rotate Windows" },
|
||||
{ keys = "t", cmd = "<C-w>T", desc = "Move Window to New Tab" },
|
||||
{ keys = "H", cmd = ":vertical resize -5<CR>", desc = "Decrease Window Height" },
|
||||
{ keys = "N", cmd = ":resize +5<CR>", desc = "Increase Window Height" },
|
||||
{ keys = "E", cmd = ":vertical resize +5<CR>", desc = "Increase Window Width" },
|
||||
{ keys = "I", cmd = ":resize -5<CR>", desc = "Decrease Window Width" },
|
||||
}
|
||||
|
||||
local leader_f = { -- leader f: Files/Find
|
||||
{ keys = "f", cmd = ":Telescope fd<CR>", desc = "Find Files"},
|
||||
{ keys = "s", cmd = ":Telescope live_grep<CR>", desc = "Grep Files"},
|
||||
{ keys = "b", cmd = ":Telescope buffers<CR>", desc = "List Buffers"},
|
||||
{ keys = "e", cmd = ":NvimTreeToggle<CR>", desc = "Toggle File Explorer" },
|
||||
}
|
||||
|
||||
local leader_p = { -- leader p: Project
|
||||
}
|
||||
|
||||
local leader_b = { -- leader b: Buffer
|
||||
{ keys = "d", cmd = ":bdelete<CR>", desc = "Delete Buffer" },
|
||||
{ keys = "h", cmd = ":bprevious<CR>", desc = "Previous Buffer" },
|
||||
{ keys = "i", cmd = ":bnext<CR>", desc = "Next Buffer" },
|
||||
{ keys = "H", cmd = ":bfirst<CR>", desc = "First Buffer" },
|
||||
{ keys = "I", cmd = ":blast<CR>", desc = "Last Buffer" },
|
||||
{ keys = "0", cmd = ":bfirst<CR>", desc = "First Buffer" },
|
||||
{ keys = "^", cmd = ":bfirst<CR>", desc = "First Buffer" },
|
||||
{ keys = "$", cmd = ":blast<CR>", desc = "Last Buffer" },
|
||||
}
|
||||
|
||||
for _, map in ipairs(leader_q) do
|
||||
map.keys = "<leader>q" .. map.keys
|
||||
table.insert(M, map)
|
||||
end
|
||||
|
||||
for _, map in ipairs(leader_w) do
|
||||
map.keys = "<leader>w" .. map.keys
|
||||
table.insert(M, map)
|
||||
end
|
||||
|
||||
for _, map in ipairs(leader_f) do
|
||||
map.keys = "<leader>f" .. map.keys
|
||||
table.insert(M, map)
|
||||
end
|
||||
|
||||
for _, map in ipairs(leader_b) do
|
||||
map.keys = "<leader>b" .. map.keys
|
||||
table.insert(M, map)
|
||||
end
|
||||
|
||||
return M
|
||||
81
tools/nvim/lua/keymaps/nvim-tree.lua
Normal file
81
tools/nvim/lua/keymaps/nvim-tree.lua
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
local M = {}
|
||||
|
||||
M.global = {
|
||||
{ mode = "n", keys = "<leader>e", cmd = ":NvimTreeToggle<CR>" },
|
||||
}
|
||||
|
||||
function M.plugin(api, opts)
|
||||
-- mode is set to "n" by default, in `./lua/plugins/nvim-tree.lua`
|
||||
return {
|
||||
-- Toggle
|
||||
{ keys = "<leader>e", cmd = ":NvimTreeToggle<CR>", opts = opts("Toggle") },
|
||||
-- Arrow 箭头 hnei
|
||||
{ keys = "h", cmd = api.node.navigate.parent_close, opts = opts("Close node") },
|
||||
{ keys = "i", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "H", cmd = api.tree.toggle_hidden_filter, opts = opts("Toggle Dotfiles") },
|
||||
{ keys = "N", cmd = api.node.navigate.sibling.next, opts = opts("Next Sibling") },
|
||||
{ keys = "E", cmd = api.node.navigate.sibling.prev, opts = opts("Previous Sibling") },
|
||||
{ keys = "I", cmd = api.tree.toggle_gitignore_filter, opts = opts("Toggle GitIgnored") },
|
||||
-- CONTROL KEYS 控制键
|
||||
{ keys = "<BS>", cmd = api.node.navigate.parent_close, opts = opts("Close node") },
|
||||
{ keys = "<CR>", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "<Tab>", cmd = api.node.open.preview, opts = opts("Open Preview") },
|
||||
-- Alpha 字母键
|
||||
{ keys = "a", cmd = api.fs.create, opts = opts("Create") },
|
||||
{ keys = "A", cmd = api.fs.create, opts = opts("Create") },
|
||||
{ keys = "bd", cmd = api.marks.bulk.delete, opts = opts("Delete Bookmarked") },
|
||||
{ keys = "bt", cmd = api.marks.bulk.trash, opts = opts("Trash Bookmarked") },
|
||||
{ keys = "bmv", cmd = api.marks.bulk.move, opts = opts("Move Bookmarked") },
|
||||
{ keys = "B", cmd = api.tree.toggle_no_buffer_filter, opts = opts("Toggle Filter: No Buffer") },
|
||||
{ keys = "c", cmd = api.fs.copy.node, opts = opts("Copy") },
|
||||
{ keys = "C", cmd = api.fs.copy.filename, opts = opts("Copy") },
|
||||
{ keys = "d", cmd = api.fs.remove, opts = opts("Delete") },
|
||||
{ keys = "D", cmd = api.fs.trash, opts = opts("Trash") },
|
||||
{ keys = "]e", cmd = api.node.navigate.diagnostics.next, opts = opts("Next Diagnostic") },
|
||||
{ keys = "[e", cmd = api.node.navigate.diagnostics.prev, opts = opts("Prev Diagnostic") },
|
||||
{ keys = "F", cmd = api.live_filter.clear, opts = opts("Live Filter: Clear") },
|
||||
{ keys = "f", cmd = api.live_filter.start, opts = opts("Live Filter: Start") },
|
||||
{ keys = "[g", cmd = api.node.navigate.git.prev, opts = opts("Prev Git") },
|
||||
{ keys = "]g", cmd = api.node.navigate.git.next, opts = opts("Next Git") },
|
||||
{ keys = "L", cmd = api.node.open.toggle_group_empty, opts = opts("Toggle Group Empty") },
|
||||
{ keys = "M", cmd = api.tree.toggle_no_bookmark_filter, opts = opts("Toggle Filter: No Bookmark") },
|
||||
{ keys = "m", cmd = api.marks.toggle, opts = opts("Toggle Bookmark") },
|
||||
{ keys = "o", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "O", cmd = api.node.open.no_window_picker, opts = opts("Open: No Window Picker") },
|
||||
{ keys = "p", cmd = api.fs.paste, opts = opts("Paste") },
|
||||
{ keys = "P", cmd = api.node.navigate.parent, opts = opts("Parent Directory") },
|
||||
{ keys = "q", cmd = api.tree.close, opts = opts("Close") },
|
||||
{ keys = "r", cmd = api.fs.rename, opts = opts("Rename") },
|
||||
{ keys = "R", cmd = api.tree.reload, opts = opts("Refresh") },
|
||||
{ keys = "s", cmd = api.node.run.system, opts = opts("Run System") },
|
||||
{ keys = "S", cmd = api.tree.search_node, opts = opts("Search") },
|
||||
{ keys = "u", cmd = api.fs.rename_full, opts = opts("Rename: Full Path") },
|
||||
{ keys = "U", cmd = api.tree.toggle_custom_filter, opts = opts("Toggle Filter: Hidden") },
|
||||
{ keys = "W", cmd = api.tree.collapse_all, opts = opts("Collapse") },
|
||||
{ keys = "x", cmd = api.fs.cut, opts = opts("Cut") },
|
||||
{ keys = "y", cmd = api.fs.copy.relative_path, opts = opts("Copy Relative Path") },
|
||||
{ keys = "Y", cmd = api.fs.copy.absolute_path, opts = opts("Copy Absolute Path") },
|
||||
-- Numeric 数字键
|
||||
{ keys = "!", cmd = api.node.run.cmd, opts = opts("Run Command") },
|
||||
-- Non-Alphanumeric 非字母数字键
|
||||
{ keys = "?", cmd = api.tree.toggle_help, opts = opts("Help") },
|
||||
{ keys = ">", cmd = api.node.navigate.sibling.next, opts = opts("Next Sibling") },
|
||||
{ keys = "<", cmd = api.node.navigate.sibling.prev, opts = opts("Previous Sibling") },
|
||||
{ keys = ".", cmd = api.node.run.cmd, opts = opts("Run Command") },
|
||||
{ keys = ";", cmd = api.node.run.cmd, opts = opts("Run Command") },
|
||||
{ keys = "-", cmd = api.tree.change_root_to_parent, opts = opts("Up") },
|
||||
-- MOD KEYS Ctrl+
|
||||
{ keys = "<C-]>", cmd = api.tree.change_root_to_node, opts = opts("CD") },
|
||||
{ keys = "<C-e>", cmd = api.node.open.replace_tree_buffer, opts = opts("Open: In Place") },
|
||||
{ keys = "<C-k>", cmd = api.node.show_info_popup, opts = opts("Info") },
|
||||
{ keys = "<C-r>", cmd = api.fs.rename_sub, opts = opts("Rename: Omit Filename") },
|
||||
{ keys = "<C-t>", cmd = api.node.open.tab, opts = opts("Open: New Tab") },
|
||||
{ keys = "<C-v>", cmd = api.node.open.vertical, opts = opts("Open: Vertical Split") },
|
||||
{ keys = "<C-h>", cmd = api.node.open.horizontal, opts = opts("Open: Horizontal Split") },
|
||||
-- Mouse 鼠标键
|
||||
{ keys = "<2-LeftMouse>", cmd = api.node.open.edit, opts = opts("Open") },
|
||||
{ keys = "<2-RightMouse>", cmd = api.tree.change_root_to_node, opts = opts("CD") },
|
||||
}
|
||||
end
|
||||
|
||||
return M
|
||||
26
tools/nvim/lua/plugins/appearance.lua
Normal file
26
tools/nvim/lua/plugins/appearance.lua
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
return {
|
||||
{ "catppuccin/nvim", name = "catppuccin" },
|
||||
{ "RRethy/vim-illuminate" },
|
||||
{
|
||||
'nvim-lualine/lualine.nvim',
|
||||
dependencies = { 'nvim-tree/nvim-web-devicons' },
|
||||
config = function()
|
||||
require("plugins.mod.lualine")
|
||||
end,
|
||||
},
|
||||
{
|
||||
"gbprod/yanky.nvim",
|
||||
config = function()
|
||||
require("yanky").setup({
|
||||
highlight = {
|
||||
on_put = true,
|
||||
on_yank = true,
|
||||
timer = 500,
|
||||
},
|
||||
})
|
||||
end
|
||||
},
|
||||
{ import = "plugins.mod.alpha-nvim" },
|
||||
{ import = "plugins.mod.winbar-nvim"},
|
||||
{ import = "plugins.mod.bufferline" },
|
||||
}
|
||||
8
tools/nvim/lua/plugins/completion.lua
Normal file
8
tools/nvim/lua/plugins/completion.lua
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
return {
|
||||
{ import = "plugins.mod.nvim-cmp" },
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
dependencies = { "rafamadriz/friendly-snippets" },
|
||||
},
|
||||
{ "rafamadriz/friendly-snippets" },
|
||||
}
|
||||
6
tools/nvim/lua/plugins/fileutils.lua
Normal file
6
tools/nvim/lua/plugins/fileutils.lua
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
return {
|
||||
{ import = "plugins.mod.auto-session" },
|
||||
{ import = "plugins.mod.nvim-tree" },
|
||||
{ "nvim-telescope/telescope.nvim", dependencies = { "nvim-lua/plenary.nvim" } },
|
||||
{ import = "plugins.mod.projects" }
|
||||
}
|
||||
22
tools/nvim/lua/plugins/init.lua
Normal file
22
tools/nvim/lua/plugins/init.lua
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
-- Entry point of the plugin manager
|
||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
vim.fn.system({
|
||||
"git",
|
||||
"clone",
|
||||
"--filter=blob:none",
|
||||
"https://github.com/folke/lazy.nvim.git",
|
||||
"--branch=stable",
|
||||
lazypath,
|
||||
})
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
require("lazy").setup({
|
||||
{ import = "plugins.appearance" },
|
||||
{ import = "plugins.completion" },
|
||||
{ import = "plugins.fileutils" },
|
||||
{ import = "plugins.lsp" },
|
||||
{ import = "plugins.syntax" },
|
||||
{ import = "plugins.misc" },
|
||||
})
|
||||
21
tools/nvim/lua/plugins/lsp.lua
Normal file
21
tools/nvim/lua/plugins/lsp.lua
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
|
||||
return {
|
||||
{ import = "plugins.mod.lspconfig" },
|
||||
{ "williamboman/mason.nvim", config = true },
|
||||
{
|
||||
"williamboman/mason-lspconfig.nvim",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
{ "williamboman/mason.nvim" },
|
||||
{ "neovim/nvim-lspconfig" },
|
||||
},
|
||||
config = function()
|
||||
local mason_lspconfig = require("mason-lspconfig")
|
||||
local servers = require("config.servers").servers
|
||||
|
||||
mason_lspconfig.setup({
|
||||
ensure_installed = servers,
|
||||
})
|
||||
end
|
||||
},
|
||||
}
|
||||
26
tools/nvim/lua/plugins/misc.lua
Normal file
26
tools/nvim/lua/plugins/misc.lua
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
return {
|
||||
{ 'wakatime/vim-wakatime', lazy = false },
|
||||
{ import = "plugins.mod.obsidian-nvim" },
|
||||
{
|
||||
"folke/which-key.nvim",
|
||||
event = "VeryLazy",
|
||||
opts = {
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- refer to the configuration section below
|
||||
},
|
||||
keys = {
|
||||
{
|
||||
"<leader>?",
|
||||
function()
|
||||
require("which-key").show({ global = false })
|
||||
end,
|
||||
desc = "Buffer Local Keymaps (which-key)",
|
||||
},
|
||||
},
|
||||
},
|
||||
{
|
||||
"github/copilot.vim",
|
||||
lazy = false,
|
||||
}
|
||||
}
|
||||
52
tools/nvim/lua/plugins/mod/alpha-nvim.lua
Normal file
52
tools/nvim/lua/plugins/mod/alpha-nvim.lua
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
-- alpha-nvim.lua
|
||||
return {
|
||||
{
|
||||
'goolord/alpha-nvim',
|
||||
dependencies = {
|
||||
-- 'echasnovski/mini.icons',
|
||||
-- 'nvim-lua/plenary.nvim'
|
||||
},
|
||||
config = function ()
|
||||
local alpha = require'alpha'
|
||||
local dashboard = require'alpha.themes.dashboard'
|
||||
dashboard.section.header.val = {
|
||||
" ",
|
||||
"================= =============== =============== ======== ========",
|
||||
"\\\\ . . . . . . .\\\\ //. . . . . . .\\\\ //. . . . . . .\\\\ \\\\. . .\\\\// . . //",
|
||||
"||. . ._____. . .|| ||. . ._____. . .|| ||. . ._____. . .|| || . . .\\/ . . .||",
|
||||
"|| . .|| ||. . || || . .|| ||. . || || . .|| ||. . || ||. . . . . . . ||",
|
||||
"||. . || || . .|| ||. . || || . .|| ||. . || || . .|| || . | . . . . .||",
|
||||
"|| . .|| ||. _-|| ||-_ .|| ||. . || || . .|| ||. _-|| ||-_.|\\ . . . . ||",
|
||||
"||. . || ||-' || || `-|| || . .|| ||. . || ||-' || || `|\\_ . .|. .||",
|
||||
"|| . _|| || || || || ||_ . || || . _|| || || || |\\ `-_/| . ||",
|
||||
"||_-' || .|/ || || \\|. || `-_|| ||_-' || .|/ || || | \\ / |-_.||",
|
||||
"|| ||_-' || || `-_|| || || ||_-' || || | \\ / | `||",
|
||||
"|| `' || || `' || || `' || || | \\ / | ||",
|
||||
"|| .===' `===. .==='.`===. .===' /==. | \\/ | ||",
|
||||
"|| .==' \\_|-_ `===. .===' _|_ `===. .===' _-|/ `== \\/ | ||",
|
||||
"|| .==' _-' `-_ `=' _-' `-_ `=' _-' `-_ /| \\/ | ||",
|
||||
"|| .==' _-' `-__\\._-' `-_./__-' `' |. /| | ||",
|
||||
"||.==' _-' `' | /==.||",
|
||||
"==' _-' j s 0 n y N E O V I M \\/ `==",
|
||||
"\\ _-' `-_ /",
|
||||
" `'' ``' ",
|
||||
}
|
||||
dashboard.section.buttons.val.leader = "SPC"
|
||||
dashboard.section.buttons.val = {
|
||||
-- leader = "SPC",
|
||||
dashboard.button('p', ' 查找项目', ':Telescope projects<CR>'),
|
||||
dashboard.button('h', ' 历史文件', ':Telescope oldfiles<CR>'),
|
||||
dashboard.button('l', ' 加载会话', ':SessionSearch<CR>'),
|
||||
dashboard.button('c', ' 转到设置', ':Telescope find_files cwd=~/.config/nvim<CR>'),
|
||||
dashboard.button('SPC q', ' 退出', ':qa<CR>'),
|
||||
}
|
||||
dashboard.section.footer.val = "今日 " .. os.date("%Y-%m-%d %A") .. " "
|
||||
|
||||
dashboard.config.opts.noautocmd = true
|
||||
|
||||
-- vim.cmd[[autocmd User AlphaReady echo 'Alpha ready!']]
|
||||
|
||||
alpha.setup(dashboard.config)
|
||||
end
|
||||
};
|
||||
}
|
||||
15
tools/nvim/lua/plugins/mod/auto-session.lua
Normal file
15
tools/nvim/lua/plugins/mod/auto-session.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
---@diagnostic disable: undefined-doc-name
|
||||
return {
|
||||
{
|
||||
'rmagatti/auto-session',
|
||||
lazy = false,
|
||||
|
||||
---enables autocomplete for opts
|
||||
---@module "auto-session"
|
||||
---@type AutoSession.Config
|
||||
opts = {
|
||||
suppressed_dirs = { '~/', '~/Projects', '~/Downloads', '/' },
|
||||
-- log_level = 'debug',
|
||||
}
|
||||
}
|
||||
}
|
||||
17
tools/nvim/lua/plugins/mod/bufferline.lua
Normal file
17
tools/nvim/lua/plugins/mod/bufferline.lua
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
return {
|
||||
"akinsho/bufferline.nvim",
|
||||
dependencies = "nvim-tree/nvim-web-devicons", -- 图标支持
|
||||
config = function()
|
||||
require("bufferline").setup({
|
||||
options = {
|
||||
numbers = "ordinal", -- 显示 buffer 序号
|
||||
close_command = "bdelete! %d", -- 关闭 buffer 的命令
|
||||
right_mouse_command = "bdelete! %d", -- 右键关闭
|
||||
offsets = {
|
||||
{ filetype = "NvimTree", text = "资源管理器", text_align = "center" },
|
||||
},
|
||||
separator_style = "thin",
|
||||
},
|
||||
})
|
||||
end,
|
||||
}
|
||||
4
tools/nvim/lua/plugins/mod/lspconfig.lua
Normal file
4
tools/nvim/lua/plugins/mod/lspconfig.lua
Normal file
|
|
@ -0,0 +1,4 @@
|
|||
return {
|
||||
"neovim/nvim-lspconfig",
|
||||
lazy = false
|
||||
}
|
||||
240
tools/nvim/lua/plugins/mod/lualine.lua
Normal file
240
tools/nvim/lua/plugins/mod/lualine.lua
Normal file
|
|
@ -0,0 +1,240 @@
|
|||
-- Author: shadmansaleh
|
||||
-- Credit: glepnir
|
||||
local lualine = require('lualine')
|
||||
|
||||
-- Color table for highlights
|
||||
-- stylua: ignore
|
||||
local colors = {
|
||||
bg = '#202328',
|
||||
fg = '#bbc2cf',
|
||||
yellow = '#ECBE7B',
|
||||
cyan = '#008080',
|
||||
darkblue = '#081633',
|
||||
green = '#98be65',
|
||||
orange = '#FF8800',
|
||||
violet = '#a9a1e1',
|
||||
magenta = '#c678dd',
|
||||
blue = '#51afef',
|
||||
red = '#ec5f67',
|
||||
}
|
||||
|
||||
local conditions = {
|
||||
buffer_not_empty = function()
|
||||
return vim.fn.empty(vim.fn.expand('%:t')) ~= 1
|
||||
end,
|
||||
hide_in_width = function()
|
||||
return vim.fn.winwidth(0) > 80
|
||||
end,
|
||||
check_git_workspace = function()
|
||||
local filepath = vim.fn.expand('%:p:h')
|
||||
local gitdir = vim.fn.finddir('.git', filepath .. ';')
|
||||
return gitdir and #gitdir > 0 and #gitdir < #filepath
|
||||
end,
|
||||
}
|
||||
|
||||
-- Config
|
||||
local config = {
|
||||
options = {
|
||||
disabled_filetypes = {
|
||||
statusline = { "NvimTree", "alpha" }
|
||||
},
|
||||
-- Disable sections and component separators
|
||||
component_separators = '',
|
||||
section_separators = '',
|
||||
theme = {
|
||||
-- We are going to use lualine_c an lualine_x as left and
|
||||
-- right section. Both are highlighted by c theme . So we
|
||||
-- are just setting default looks o statusline
|
||||
normal = { c = { fg = colors.fg, bg = colors.bg } },
|
||||
inactive = { c = { fg = colors.fg, bg = colors.bg } },
|
||||
},
|
||||
},
|
||||
sections = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
-- These will be filled later
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
},
|
||||
inactive_sections = {
|
||||
-- these are to remove the defaults
|
||||
lualine_a = {},
|
||||
lualine_b = {},
|
||||
lualine_y = {},
|
||||
lualine_z = {},
|
||||
lualine_c = {},
|
||||
lualine_x = {},
|
||||
},
|
||||
}
|
||||
|
||||
-- Inserts a component in lualine_c at left section
|
||||
local function ins_left(component)
|
||||
table.insert(config.sections.lualine_c, component)
|
||||
end
|
||||
|
||||
-- Inserts a component in lualine_x at right section
|
||||
local function ins_right(component)
|
||||
table.insert(config.sections.lualine_x, component)
|
||||
end
|
||||
|
||||
ins_left {
|
||||
function()
|
||||
return '▊'
|
||||
end,
|
||||
color = { fg = colors.blue }, -- Sets highlighting of component
|
||||
padding = { left = 0, right = 1 }, -- We don't need space before this
|
||||
}
|
||||
|
||||
ins_left {
|
||||
-- mode component
|
||||
function()
|
||||
return ''
|
||||
end,
|
||||
color = function()
|
||||
-- auto change color according to neovims mode
|
||||
local mode_color = {
|
||||
n = colors.red,
|
||||
i = colors.green,
|
||||
v = colors.blue,
|
||||
[''] = colors.blue,
|
||||
V = colors.blue,
|
||||
c = colors.magenta,
|
||||
no = colors.red,
|
||||
s = colors.orange,
|
||||
S = colors.orange,
|
||||
[''] = colors.orange,
|
||||
ic = colors.yellow,
|
||||
R = colors.violet,
|
||||
Rv = colors.violet,
|
||||
cv = colors.red,
|
||||
ce = colors.red,
|
||||
r = colors.cyan,
|
||||
rm = colors.cyan,
|
||||
['r?'] = colors.cyan,
|
||||
['!'] = colors.red,
|
||||
t = colors.red,
|
||||
}
|
||||
return { fg = mode_color[vim.fn.mode()] }
|
||||
end,
|
||||
padding = { right = 1 },
|
||||
}
|
||||
|
||||
-- ins_left {
|
||||
-- -- filesize component
|
||||
-- 'filesize',
|
||||
-- cond = conditions.buffer_not_empty,
|
||||
-- }
|
||||
|
||||
-- ins_left {
|
||||
-- 'filename',
|
||||
-- cond = conditions.buffer_not_empty,
|
||||
-- color = { fg = colors.magenta, gui = 'bold' },
|
||||
-- }
|
||||
|
||||
|
||||
-- ins_left { 'location' }
|
||||
|
||||
ins_right { 'progress', color = { fg = colors.fg, gui = 'bold' } }
|
||||
|
||||
ins_left {
|
||||
'diagnostics',
|
||||
sources = { 'nvim_diagnostic' },
|
||||
symbols = { error = ' ', warn = ' ', info = ' ' },
|
||||
diagnostics_color = {
|
||||
error = { fg = colors.red },
|
||||
warn = { fg = colors.yellow },
|
||||
info = { fg = colors.cyan },
|
||||
},
|
||||
}
|
||||
|
||||
ins_left {
|
||||
function()
|
||||
return vim.bo.filetype
|
||||
end,
|
||||
color = { fg = colors.blue, gui = 'bold' },
|
||||
}
|
||||
|
||||
ins_left {
|
||||
function()
|
||||
return vim.bo.shiftwidth .. " space"
|
||||
end,
|
||||
}
|
||||
|
||||
|
||||
|
||||
ins_left {
|
||||
-- Lsp server name .
|
||||
function()
|
||||
local msg = 'No Active Lsp'
|
||||
local buf_ft = vim.api.nvim_get_option_value('filetype', { buf = 0 })
|
||||
local clients = vim.lsp.get_clients()
|
||||
if next(clients) == nil then
|
||||
return msg
|
||||
end
|
||||
for _, client in ipairs(clients) do
|
||||
local filetypes = client.config.filetypes
|
||||
if filetypes and vim.fn.index(filetypes, buf_ft) ~= -1 then
|
||||
return client.name
|
||||
end
|
||||
end
|
||||
return msg
|
||||
end,
|
||||
icon = ' ',
|
||||
color = { fg = '#ffffff', gui = 'bold' },
|
||||
}
|
||||
|
||||
-- Insert mid section. You can make any number of sections in neovim :)
|
||||
-- for lualine it's any number greater then 2
|
||||
ins_left {
|
||||
function()
|
||||
return '%='
|
||||
end,
|
||||
}
|
||||
|
||||
-- Add components to right sections
|
||||
ins_right {
|
||||
'o:encoding', -- option component same as &encoding in viml
|
||||
fmt = string.upper, -- I'm not sure why it's upper case either ;)
|
||||
cond = conditions.hide_in_width,
|
||||
color = { fg = colors.green, gui = 'bold' },
|
||||
}
|
||||
|
||||
ins_right {
|
||||
'fileformat',
|
||||
fmt = string.upper,
|
||||
icons_enabled = false, -- I think icons are cool but Eviline doesn't have them. sigh
|
||||
color = { fg = colors.green, gui = 'bold' },
|
||||
}
|
||||
|
||||
ins_right {
|
||||
'branch',
|
||||
icon = '',
|
||||
color = { fg = colors.violet, gui = 'bold' },
|
||||
}
|
||||
|
||||
|
||||
ins_right {
|
||||
'diff',
|
||||
-- Is it me or the symbol for modified us really weird
|
||||
symbols = { added = ' ', modified = ' ', removed = ' ' },
|
||||
diff_color = {
|
||||
added = { fg = colors.green },
|
||||
modified = { fg = colors.orange },
|
||||
removed = { fg = colors.red },
|
||||
},
|
||||
cond = conditions.hide_in_width,
|
||||
}
|
||||
|
||||
ins_right {
|
||||
function()
|
||||
return '▊'
|
||||
end,
|
||||
color = { fg = colors.blue },
|
||||
padding = { left = 1 },
|
||||
}
|
||||
|
||||
-- Now don't forget to initialize lualine
|
||||
lualine.setup(config)
|
||||
68
tools/nvim/lua/plugins/mod/nvim-cmp.lua
Normal file
68
tools/nvim/lua/plugins/mod/nvim-cmp.lua
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
local function set_keymaps(keymaps_cmp)
|
||||
local mappings = {}
|
||||
for _, map in ipairs(keymaps_cmp) do
|
||||
mappings[map.keys] = map.cmd
|
||||
end
|
||||
return mappings
|
||||
end
|
||||
|
||||
return {
|
||||
"hrsh7th/nvim-cmp",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"hrsh7th/cmp-nvim-lsp",
|
||||
"hrsh7th/cmp-buffer",
|
||||
"hrsh7th/cmp-path",
|
||||
"hrsh7th/cmp-cmdline",
|
||||
"L3MON4D3/LuaSnip",
|
||||
"saadparwaiz1/cmp_luasnip",
|
||||
},
|
||||
config = function()
|
||||
local cmp = require("cmp")
|
||||
local lspconfig = require("lspconfig")
|
||||
local capabilities = require("cmp_nvim_lsp").default_capabilities()
|
||||
local servers_module = require("config.servers")
|
||||
local servers = servers_module.servers
|
||||
local servers_config = servers_module.server_config
|
||||
-- 默认 LSP 配置
|
||||
local default_server_config = {
|
||||
capabilities = capabilities,
|
||||
}
|
||||
|
||||
local raw_keymaps = require("keymaps").cmp_nvim_keymaps(cmp.mapping)
|
||||
local mapped = set_keymaps(raw_keymaps)
|
||||
-- 配置 nvim-cmp
|
||||
cmp.setup({
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
require("luasnip").lsp_expand(args.body)
|
||||
end,
|
||||
},
|
||||
mapping = cmp.mapping.preset.insert(mapped),
|
||||
sources = cmp.config.sources({
|
||||
{ name = "nvim_lsp" },
|
||||
{ name = "luasnip" },
|
||||
{ name = "copilot" },
|
||||
}, {
|
||||
{ name = "buffer" },
|
||||
{ name = "path" },
|
||||
}),
|
||||
})
|
||||
|
||||
-- 配置 cmdline 模式
|
||||
cmp.setup.cmdline(":", {
|
||||
mapping = cmp.mapping.preset.cmdline(),
|
||||
sources = {
|
||||
{ name = "cmdline" },
|
||||
-- path completion is slow under WSL
|
||||
-- Since WSL loads Windows Environment Variables
|
||||
},
|
||||
})
|
||||
|
||||
-- 配置 LSP
|
||||
for _, server in ipairs(servers) do
|
||||
local config = vim.tbl_deep_extend("force", default_server_config, servers_config[server] or {})
|
||||
lspconfig[server].setup(config)
|
||||
end
|
||||
end,
|
||||
}
|
||||
37
tools/nvim/lua/plugins/mod/nvim-tree.lua
Normal file
37
tools/nvim/lua/plugins/mod/nvim-tree.lua
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
local function my_on_attach(bufnr)
|
||||
-- local keymaps = require("config.keymaps")
|
||||
local api = require "nvim-tree.api"
|
||||
local default_mode = { "n" }
|
||||
local keymaps = require("keymaps")
|
||||
|
||||
local function opts(desc)
|
||||
return { desc = "nvim-tree: " .. desc, buffer = bufnr, noremap = true, silent = true, nowait = true }
|
||||
end
|
||||
|
||||
|
||||
local function set_keymaps(maps)
|
||||
for _, map in ipairs(maps) do
|
||||
local mode = map.mode or default_mode
|
||||
vim.keymap.set(mode, map.keys, map.cmd, map.opts)
|
||||
end
|
||||
end
|
||||
|
||||
local raw_keymaps = require("keymaps.nvim-tree").plugin(api, opts)
|
||||
set_keymaps(raw_keymaps)
|
||||
end
|
||||
|
||||
return {
|
||||
"nvim-tree/nvim-tree.lua",
|
||||
version = "*",
|
||||
lazy = false,
|
||||
dependencies = {
|
||||
"nvim-tree/nvim-web-devicons",
|
||||
},
|
||||
config = function()
|
||||
require("nvim-tree").setup {
|
||||
on_attach = my_on_attach,
|
||||
sync_root_with_cwd = true,
|
||||
respect_buf_cwd = true,
|
||||
}
|
||||
end
|
||||
}
|
||||
11
tools/nvim/lua/plugins/mod/nvim-treesitter.lua
Normal file
11
tools/nvim/lua/plugins/mod/nvim-treesitter.lua
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
return {
|
||||
"nvim-treesitter/nvim-treesitter",
|
||||
run = ":TSUpdate",
|
||||
config = function()
|
||||
require("nvim-treesitter.configs").setup({
|
||||
ensure_installed = { "markdown", "markdown_inline" },
|
||||
highlight = { enable = true },
|
||||
indent = { enable = true },
|
||||
})
|
||||
end,
|
||||
}
|
||||
33
tools/nvim/lua/plugins/mod/obsidian-nvim.lua
Normal file
33
tools/nvim/lua/plugins/mod/obsidian-nvim.lua
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
return {
|
||||
"epwalsh/obsidian.nvim",
|
||||
version = "*", -- recommended, use latest release instead of latest commit
|
||||
lazy = true,
|
||||
ft = "markdown",
|
||||
-- Replace the above line with this if you only want to load obsidian.nvim for markdown files in your vault:
|
||||
-- event = {
|
||||
-- -- If you want to use the home shortcut '~' here you need to call 'vim.fn.expand'.
|
||||
-- -- E.g. "BufReadPre " .. vim.fn.expand "~" .. "/my-vault/*.md"
|
||||
-- -- refer to `:h file-pattern` for more examples
|
||||
-- "BufReadPre path/to/my-vault/*.md",
|
||||
-- "BufNewFile path/to/my-vault/*.md",
|
||||
-- },
|
||||
dependencies = {
|
||||
-- Required.
|
||||
"nvim-lua/plenary.nvim",
|
||||
|
||||
-- see below for full list of optional dependencies 👇
|
||||
},
|
||||
opts = {
|
||||
workspaces = {
|
||||
{
|
||||
name = "personal",
|
||||
path = "/mnt/c/Users/citoy/Obsidian",
|
||||
},
|
||||
},
|
||||
completion = {
|
||||
nvim_cmp = true,
|
||||
min_chars = 2
|
||||
}
|
||||
-- see below for full list of options 👇
|
||||
},
|
||||
}
|
||||
15
tools/nvim/lua/plugins/mod/projects.lua
Normal file
15
tools/nvim/lua/plugins/mod/projects.lua
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
return {
|
||||
"ahmedkhalf/project.nvim",
|
||||
config = function()
|
||||
require("project_nvim").setup({
|
||||
detection_methods = { "lsp", "pattern" },
|
||||
patterns = { ".git", "Makefile", "package.json" },
|
||||
sync_root_with_cwd = true,
|
||||
silent_chdir = true,
|
||||
scope_chdir = "global",
|
||||
})
|
||||
|
||||
require("telescope").load_extension("projects")
|
||||
end,
|
||||
dependencies = { "nvim-telescope/telescope.nvim" },
|
||||
}
|
||||
39
tools/nvim/lua/plugins/mod/winbar-nvim.lua
Normal file
39
tools/nvim/lua/plugins/mod/winbar-nvim.lua
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
return {
|
||||
{
|
||||
"fgheng/winbar.nvim",
|
||||
config = function()
|
||||
require("winbar").setup({
|
||||
enabled = true,
|
||||
show_file_path = true,
|
||||
show_symbols = true,
|
||||
colors = {
|
||||
path = '#9c1d91',
|
||||
file_name = '',
|
||||
symbols = '',
|
||||
},
|
||||
icons = {
|
||||
file_icon_default = '',
|
||||
seperator = '>',
|
||||
editor_state = '●',
|
||||
lock_icon = '',
|
||||
},
|
||||
exclude_filetype = {
|
||||
'help',
|
||||
'startify',
|
||||
'dashboard',
|
||||
'packer',
|
||||
'neogitstatus',
|
||||
'NvimTree',
|
||||
'Trouble',
|
||||
'alpha',
|
||||
'lir',
|
||||
'Outline',
|
||||
'spectre_panel',
|
||||
'toggleterm',
|
||||
'qf',
|
||||
}
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
9
tools/nvim/lua/plugins/syntax.lua
Normal file
9
tools/nvim/lua/plugins/syntax.lua
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
return {
|
||||
{ import = "plugins.mod.nvim-treesitter", },
|
||||
{ 'echasnovski/mini.pairs', version = false,
|
||||
config = function()
|
||||
require("mini.pairs").setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
|
||||
5
tools/nvim/stylua.toml
Normal file
5
tools/nvim/stylua.toml
Normal file
|
|
@ -0,0 +1,5 @@
|
|||
indent_type = "Spaces"
|
||||
indent_width = 2
|
||||
column_width = 120
|
||||
[sort_requires]
|
||||
enabled = true
|
||||
46
tools/powershell/Aliases.ps1
Normal file
46
tools/powershell/Aliases.ps1
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
### VARIABLES ###
|
||||
$EDITOR = "code"
|
||||
# Shell Equivalents #
|
||||
Set-Alias "touch" "New-Item"
|
||||
${function:ll} = { Get-ChildItem -Force }
|
||||
|
||||
# Shell Configurations #
|
||||
${function:shcfg} = { code $PROFILE }
|
||||
Set-Alias "pwshcfg" "shcfg"
|
||||
${function:reload} = { . $PROFILE }
|
||||
${function:pulldots} = { Set-Location -Path $DOTFILES && git pull }
|
||||
|
||||
# Editors #
|
||||
Set-Alias "v" "nvim"
|
||||
Set-Alias "c" "code"
|
||||
Set-Alias "gvi" "neovide"
|
||||
|
||||
# File Creation #
|
||||
function mkcd { param ( [string] $dirname) mkdir $dirname && Set-Location $dirname }
|
||||
function tc { param ( [string] $filename) New-Item $filename && code $filename }
|
||||
function tv { param ( [string] $filename) New-Item $filename && nvim $filename }
|
||||
function cdls { param( [string] $dirname) Set-Location $dirname && Get-ChildItem }
|
||||
|
||||
### Dev ###
|
||||
|
||||
# .NET #
|
||||
${function:csi} = { dotnet repl --default-kernel csharp}
|
||||
${function:fsi} = { dotnet repl --default-kernel fsharp}
|
||||
|
||||
# Python & Conda #
|
||||
Set-Alias "py" "python"
|
||||
Set-Alias "ipy" "ipython"
|
||||
${function:pyact} = { conda activate $args[0] }
|
||||
${function:pydact} = { conda deactivate }
|
||||
${function:pylsenvs} = { conda env list }
|
||||
${function:pymkenv} = { conda create --name $args[0] }
|
||||
${function:pyrmenv} = { conda remove --name $args[0] --all }
|
||||
|
||||
# Winget #
|
||||
|
||||
if ($isWindows) {
|
||||
${function:wini} = { winget install $args }
|
||||
${function:winr} = { winget uninstall $args }
|
||||
${function:wins} = { winget search $args }
|
||||
${function:winu} = { winget upgrade $args }
|
||||
}
|
||||
9
tools/powershell/Completions.ps1
Normal file
9
tools/powershell/Completions.ps1
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
function Invoke-Completion {
|
||||
param ([string]$command)
|
||||
switch ($command) {
|
||||
'docker' { docker completion powershell | Out-String | Invoke-Expression }
|
||||
'git' { Import-Module Posh-Git }
|
||||
'hugo' { hugo completion powershell | Out-String | Invoke-Expression }
|
||||
'pip' { pip completion --powershell | Out-String | Invoke-Expression }
|
||||
}
|
||||
}
|
||||
7
tools/powershell/Config.ps1
Normal file
7
tools/powershell/Config.ps1
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
# Use XDG Base Directory Specification and its similar structure for Windows
|
||||
|
||||
# wget
|
||||
${function:wget} = {wget --hsts-file $XDG_CACHE_HOME/wget-hsts $args}
|
||||
|
||||
# yarn v1
|
||||
${function:yarn} = {yarn --use-yarnrc $XDG_CONFIG_HOME/yarn/config.yaml $args}
|
||||
25
tools/powershell/Keymap.ps1
Normal file
25
tools/powershell/Keymap.ps1
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
# aka PSReadLine
|
||||
# PSReadLineOptions
|
||||
Set-PSReadLineOption -EditMode Vi # Vi Keybindings
|
||||
Set-PSReadLineOption -PredictionViewStyle ListView
|
||||
Set-PSReadLineOption -PredictionSource HistoryAndPlugin
|
||||
# Set-PSReadLineOption -ContinuationPrompt "`e[36m CR > " # Use Starship instead
|
||||
# PSReadLineKeyHandlers
|
||||
## Colemak hnei
|
||||
Set-PSReadLineKeyHandler -Chord "n" -Function NextHistory -ViMode Command
|
||||
Set-PSReadLineKeyHandler -Chord "e" -Function PreviousHistory -ViMode Command
|
||||
Set-PSReadLineKeyHandler -Chord "i" -Function ViForwardChar -ViMode Command
|
||||
## Similar position to [i] in QWERTY
|
||||
Set-PSReadLineKeyHandler -Chord "l" -Function ViInsertMode -ViMode Command
|
||||
Set-PSReadlineKeyHandler -Chord "L" -Function ViInsertAtBegining -ViMode Command
|
||||
## Ne{[k]s}t
|
||||
Set-PSReadLineKeyHandler -Chord "k" -Function RepeatSearch -ViMode Command
|
||||
Set-PSReadLineKeyHandler -Chord "K" -Function RepeatSearchBackward -ViMode Command
|
||||
## [j]ump
|
||||
Set-PSReadLineKeyHandler -Chord "j" -Function NextWordEnd -ViMode Command
|
||||
Set-PSReadLineKeyHandler -Chord "J" -Function ViEndOfGlob -ViMode Command
|
||||
## Use N to Join
|
||||
Set-PSReadLineKeyHandler -Chord "N" -Function ViJoinLines -ViMode Command
|
||||
Set-PSReadLineKeyHandler -Chord "Control+Oem4" -Function ViCommandMode -ViMode Insert # ^[ to Escape
|
||||
Set-PSReadLineKeyHandler -Chord "Ctrl+a" -Function BeginningOfLine
|
||||
Set-PSReadLineKeyHandler -Chord "Ctrl+e" -Function EndOfLine
|
||||
9
tools/powershell/Modules.ps1
Normal file
9
tools/powershell/Modules.ps1
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
Import-Module -Name Terminal-Icons
|
||||
Import-Module -Name CompletionPredictor
|
||||
if ($IsWindows) {
|
||||
# Chocolatey
|
||||
$ChocolateyProfile = "$env:ChocolateyInstall\helpers\chocolateyProfile.psm1"
|
||||
if (Test-Path($ChocolateyProfile)) { Import-Module "$ChocolateyProfile" }
|
||||
# WinGet
|
||||
Import-Module -Name Microsoft.WinGet.CommandNotFound #f45873b3-b655-43a6-b217-97c00aa0db58
|
||||
}
|
||||
15
tools/powershell/Navigation.ps1
Normal file
15
tools/powershell/Navigation.ps1
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
# ${function:~} = { Set-Location -Path ~ } cd is better
|
||||
${function:...} = { Set-Location -Path ..\.. }
|
||||
${function:....} = { Set-Location -Path ..\..\.. }
|
||||
${function:.....} = { Set-Location -Path ..\..\..\.. }
|
||||
${function:......} = { Set-Location -Path ..\..\..\..\.. }
|
||||
|
||||
# Absolute navigation
|
||||
${function:docs} = { Set-Location -Path ~/Documents }
|
||||
${function:down} = { Set-Location -Path ~/Downloads }
|
||||
${function:dt} = { Set-Location -Path ~/Desktop }
|
||||
${function:mytmp} = { Set-Location -Path ~/Temp }
|
||||
${function:one} = { Set-Location -Path ~/OneDrive }
|
||||
${function:doku} = { Set-Location -Path ~/doku && Get-ChildItem }
|
||||
|
||||
Invoke-Expression (& { (zoxide init powershell | Out-String) })
|
||||
92
tools/powershell/Prompt.ps1
Normal file
92
tools/powershell/Prompt.ps1
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
# Use starship to set prompt
|
||||
$ENV:STARSHIP_CONFIG = "$DOTFILES/.config/starship/starship_pwsh.toml"
|
||||
|
||||
Invoke-Expression (&starship init powershell)
|
||||
|
||||
# Below is the backup of original prompt function
|
||||
# $promptTime = $true
|
||||
# # $promptWeather = $false
|
||||
|
||||
# function prompt {
|
||||
# $prompt = "`e[35m"
|
||||
# # Time
|
||||
# if ($promptTime) {
|
||||
# $promptTime = Get-Date -Format HH:mm
|
||||
# $prompt += "`[$promptTime]"
|
||||
# }
|
||||
# # UserInfo
|
||||
# $prompt += " $Env:Username @ $Env:Userdomain"
|
||||
# # Directory
|
||||
# $promptCurrentDirectory = $(PWD).Path
|
||||
# $promptCurrentDirectory = $promptCurrentDirectory.Replace("$HOME", "~")
|
||||
# $prompt += "`e[0m in `e[33m$promptCurrentDirectory "
|
||||
# # Git
|
||||
# if ($(git rev-parse --is-inside-work-tree 2> $null) -eq "true") {
|
||||
# $prompt += "`e[32m`u{e702} $(git branch --show-current)"
|
||||
# }
|
||||
# # Conda
|
||||
# if ( $Env:CONDA_PROMPT_MODIFIER ) {
|
||||
# $promptConda = $Env:CONDA_PROMPT_MODIFIER.Replace("`(","").Replace(")","")
|
||||
# $pythonVersion = $(python --version).Split(" ")[1]
|
||||
# $prompt += " `e[33m`u{e73c} $promptConda $pythonVersion"
|
||||
# }
|
||||
# # Programming Language (by Get-ChildItem)
|
||||
# ## Python
|
||||
# if (Test-Path -Path "$PWD\pyproject.toml") {
|
||||
# $pythonVersion = $(python --version).Split(" ")[1]
|
||||
# $prompt += " `e[33m`u{e73c} $pythonVersion"
|
||||
# }
|
||||
# ## Node.js
|
||||
# if (Test-Path -Path "$PWD\package.json") {
|
||||
# $nodeVersion = $(node --version)
|
||||
# $prompt += " `e[32m`u{e3a0} $nodeVersion"
|
||||
# # Locked
|
||||
# if (Test-Path -Path "$PWD\yarn.lock" || Test-Path -Path "$PWD\package-lock.json") {
|
||||
# $prompt += "`u{f023}"
|
||||
# }
|
||||
# }
|
||||
# ## .NET
|
||||
# ### C Sharp
|
||||
# if (Test-Path -Path "$PWD\*.csproj") {
|
||||
# $dotnetVersion = $(dotnet --version)
|
||||
# $prompt += " `e[34m`u{e648} $dotnetVersion"
|
||||
# }
|
||||
# ### F Sharp
|
||||
# if (Test-Path -Path "$PWD\*.fsproj") {
|
||||
# $dotnetVersion = $(dotnet --version)
|
||||
# $prompt += " `e[35m`u{e65a} $dotnetVersion"
|
||||
# }
|
||||
# ## Rust
|
||||
# if (Test-Path -Path "$PWD\Cargo.toml") {
|
||||
# $rustVersion = $(cargo --version).Split(" ")[1]
|
||||
# $prompt += " `e[31m`u{e7a8} $rustVersion"
|
||||
# }
|
||||
# ## Java
|
||||
# if (Test-Path -Path "$PWD\pom.xml" || Test-Path -Path "$PWD\build.gradle") {
|
||||
# $javaVersion = $(java --version).Split(" ")[1]
|
||||
# $prompt += " `e[31m`u{e738} $javaVersion"
|
||||
# }
|
||||
# ## Makefile
|
||||
# if (Test-Path -Path "$PWD\Makefile") {
|
||||
# $prompt += " `e[32m`u{e673}"
|
||||
# }
|
||||
# if (Test-Path -Path "$PWD\CMakeLists.txt") {
|
||||
# $prompt += " `e[32m `u{e61d}"
|
||||
# }
|
||||
# # Docker
|
||||
# if (Test-Path -Path "$PWD\Dockerfile" || Test-Path -Path "$PWD\docker-compose.yml") {
|
||||
# $prompt += " `e[33m`u{f21f}"
|
||||
# }
|
||||
# # Weather
|
||||
# # if ( $global:promptWeather ) {
|
||||
# # $prompt += $(Write-WeatherCurrent -City "Edinburgh" -Country "UK" -Unit "metric" -Inline -Apikey $Env:WEATHER_API_KEY)
|
||||
# # }
|
||||
# # Error on last command
|
||||
# ## TODO: Seems does not work
|
||||
# if ($?) {
|
||||
# $prompt += "`n`e[32m PS > `e[0m"
|
||||
# } else {
|
||||
# $prompt += "`n`e[31m PS > `e[0m"
|
||||
# }
|
||||
# return $prompt
|
||||
# }
|
||||
17
tools/powershell/Scripts.ps1
Normal file
17
tools/powershell/Scripts.ps1
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
function CsvToMarkdown {
|
||||
param( [string]$csv)
|
||||
$counter = 0
|
||||
$column = $csv.Split("`n")[0].Split(",").Length
|
||||
$aHeader = " --- |"
|
||||
$header = "|" + $aHeader * $column
|
||||
$csv.replace(",", " | ").Split("`n") | ForEach-Object {
|
||||
if ($counter -eq 0) {
|
||||
Write-Output "| $_ |"
|
||||
$counter++
|
||||
Write-Output $header
|
||||
}
|
||||
else {
|
||||
Write-Output "| $_ |"
|
||||
}
|
||||
}
|
||||
}
|
||||
23
tools/powershell/readme.md
Normal file
23
tools/powershell/readme.md
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# PowerShell Profile
|
||||
|
||||
This is the cross-platform PowerShell profile for PowerShell Core
|
||||
|
||||
```text
|
||||
.
|
||||
├── Aliases.ps1
|
||||
├── Keymap.ps1 # keymaps, optimize for Vi-Mode and Colemak
|
||||
├── Modules.ps1
|
||||
├── Navigation.ps1
|
||||
├── Prompt.ps1
|
||||
├── readme.md
|
||||
└── Scripts.ps1
|
||||
|
||||
1 directory, 7 files
|
||||
```
|
||||
|
||||
| Keymap | Action | Mode |
|
||||
| --- | --- | --- |
|
||||
| `^a` | To Beginning of Line | All |
|
||||
| `^e` | To End of Line | All |
|
||||
| `^[` | To Normal Mode | Insert |
|
||||
|
||||
202
tools/starship/starship.toml
Normal file
202
tools/starship/starship.toml
Normal file
|
|
@ -0,0 +1,202 @@
|
|||
# starship.toml
|
||||
# ~/.config/starship.toml
|
||||
format = '''$os$time $username @ $hostname $directory $all$character'''
|
||||
|
||||
add_newline = true
|
||||
|
||||
[time]
|
||||
disabled = false
|
||||
format = '[\[$time\]](purple)'
|
||||
time_format = '%H:%M'
|
||||
|
||||
[username]
|
||||
format = '[$user](bold)'
|
||||
show_always = true
|
||||
|
||||
[hostname]
|
||||
ssh_only = false
|
||||
ssh_symbol = ' '
|
||||
|
||||
[directory]
|
||||
truncation_length = 2
|
||||
truncate_to_repo = true
|
||||
read_only = " "
|
||||
style ="bold cyan"
|
||||
truncation_symbol = ".../"
|
||||
|
||||
[directory.substitutions]
|
||||
"~/Documents" = " "
|
||||
"~/Downloads" = " "
|
||||
"~/Music" = " "
|
||||
"~/Pictures" = " "
|
||||
"Source" = " "
|
||||
"src" = " "
|
||||
|
||||
[aws]
|
||||
symbol = " "
|
||||
|
||||
[buf]
|
||||
symbol = " "
|
||||
|
||||
[c]
|
||||
symbol = " "
|
||||
|
||||
[conda]
|
||||
symbol = " "
|
||||
|
||||
[crystal]
|
||||
symbol = " "
|
||||
|
||||
[dart]
|
||||
symbol = " "
|
||||
|
||||
|
||||
[docker_context]
|
||||
symbol = " "
|
||||
|
||||
[elixir]
|
||||
symbol = " "
|
||||
|
||||
[elm]
|
||||
symbol = " "
|
||||
|
||||
[fennel]
|
||||
symbol = " "
|
||||
|
||||
[fossil_branch]
|
||||
symbol = " "
|
||||
|
||||
[git_branch]
|
||||
symbol = " "
|
||||
|
||||
[git_commit]
|
||||
tag_symbol = ' '
|
||||
|
||||
[golang]
|
||||
symbol = " "
|
||||
|
||||
[guix_shell]
|
||||
symbol = " "
|
||||
|
||||
[haskell]
|
||||
symbol = " "
|
||||
|
||||
[haxe]
|
||||
symbol = " "
|
||||
|
||||
[hg_branch]
|
||||
symbol = " "
|
||||
|
||||
[java]
|
||||
symbol = " "
|
||||
|
||||
[julia]
|
||||
symbol = " "
|
||||
|
||||
[kotlin]
|
||||
symbol = " "
|
||||
|
||||
[lua]
|
||||
symbol = " "
|
||||
|
||||
[memory_usage]
|
||||
symbol = " "
|
||||
|
||||
[meson]
|
||||
symbol = " "
|
||||
|
||||
[nim]
|
||||
symbol = " "
|
||||
|
||||
[nix_shell]
|
||||
symbol = " "
|
||||
|
||||
[nodejs]
|
||||
symbol = " "
|
||||
|
||||
[ocaml]
|
||||
symbol = " "
|
||||
|
||||
[os]
|
||||
disabled = false
|
||||
|
||||
[os.symbols]
|
||||
Alpaquita = " "
|
||||
Alpine = " "
|
||||
AlmaLinux = " "
|
||||
Amazon = " "
|
||||
Android = " "
|
||||
Arch = " "
|
||||
Artix = " "
|
||||
CentOS = " "
|
||||
Debian = " "
|
||||
DragonFly = " "
|
||||
Emscripten = " "
|
||||
EndeavourOS = " "
|
||||
Fedora = " "
|
||||
FreeBSD = " "
|
||||
Garuda = " "
|
||||
Gentoo = " "
|
||||
HardenedBSD = " "
|
||||
Illumos = " "
|
||||
Kali = " "
|
||||
Linux = " "
|
||||
Mabox = " "
|
||||
Macos = " "
|
||||
Manjaro = " "
|
||||
Mariner = " "
|
||||
MidnightBSD = " "
|
||||
Mint = " "
|
||||
NetBSD = " "
|
||||
NixOS = " "
|
||||
OpenBSD = " "
|
||||
openSUSE = " "
|
||||
OracleLinux = " "
|
||||
Pop = " "
|
||||
Raspbian = " "
|
||||
Redhat = " "
|
||||
RedHatEnterprise = " "
|
||||
RockyLinux = " "
|
||||
Redox = " "
|
||||
Solus = " "
|
||||
SUSE = " "
|
||||
Ubuntu = " "
|
||||
Unknown = " "
|
||||
Void = " "
|
||||
Windows = " "
|
||||
|
||||
[package]
|
||||
symbol = " "
|
||||
|
||||
[perl]
|
||||
symbol = " "
|
||||
|
||||
[php]
|
||||
symbol = " "
|
||||
|
||||
[pijul_channel]
|
||||
symbol = " "
|
||||
|
||||
[python]
|
||||
symbol = " "
|
||||
|
||||
[rlang]
|
||||
symbol = " "
|
||||
|
||||
[ruby]
|
||||
symbol = " "
|
||||
|
||||
[rust]
|
||||
symbol = " "
|
||||
|
||||
[scala]
|
||||
symbol = " "
|
||||
|
||||
[swift]
|
||||
symbol = " "
|
||||
|
||||
[zig]
|
||||
symbol = " "
|
||||
|
||||
[gradle]
|
||||
symbol = " "
|
||||
210
tools/starship/starship_nu.toml
Normal file
210
tools/starship/starship_nu.toml
Normal file
|
|
@ -0,0 +1,210 @@
|
|||
# starship.toml
|
||||
# ~/.config/starship.toml
|
||||
format = '''$os$time $username @ $hostname $directory $all$character'''
|
||||
continuation_prompt = "[ cr >](bold cyan) "
|
||||
|
||||
add_newline = true
|
||||
|
||||
[time]
|
||||
disabled = false
|
||||
format = '[\[$time\]](purple)'
|
||||
time_format = '%H:%M'
|
||||
|
||||
[username]
|
||||
format = '[$user](bold)'
|
||||
show_always = true
|
||||
|
||||
[hostname]
|
||||
ssh_only = false
|
||||
ssh_symbol = ' '
|
||||
|
||||
# Currently vimcmd_symbol is not supported in Nu, define in `config.nu` instead
|
||||
[character]
|
||||
success_symbol = ""
|
||||
error_symbol = ""
|
||||
vimcmd_symbol = ""
|
||||
|
||||
|
||||
[directory]
|
||||
truncation_length = 2
|
||||
truncate_to_repo = true
|
||||
read_only = " "
|
||||
style ="bold cyan"
|
||||
truncation_symbol = ".../"
|
||||
|
||||
[directory.substitutions]
|
||||
"~/Documents" = " "
|
||||
"~/Downloads" = " "
|
||||
"~/Music" = " "
|
||||
"~/Pictures" = " "
|
||||
"Source" = " "
|
||||
"src" = " "
|
||||
|
||||
[aws]
|
||||
symbol = " "
|
||||
|
||||
[buf]
|
||||
symbol = " "
|
||||
|
||||
[c]
|
||||
symbol = " "
|
||||
|
||||
[conda]
|
||||
symbol = " "
|
||||
|
||||
[crystal]
|
||||
symbol = " "
|
||||
|
||||
[dart]
|
||||
symbol = " "
|
||||
|
||||
|
||||
[docker_context]
|
||||
symbol = " "
|
||||
|
||||
[elixir]
|
||||
symbol = " "
|
||||
|
||||
[elm]
|
||||
symbol = " "
|
||||
|
||||
[fennel]
|
||||
symbol = " "
|
||||
|
||||
[fossil_branch]
|
||||
symbol = " "
|
||||
|
||||
[git_branch]
|
||||
symbol = " "
|
||||
|
||||
[git_commit]
|
||||
tag_symbol = ' '
|
||||
|
||||
[golang]
|
||||
symbol = " "
|
||||
|
||||
[guix_shell]
|
||||
symbol = " "
|
||||
|
||||
[haskell]
|
||||
symbol = " "
|
||||
|
||||
[haxe]
|
||||
symbol = " "
|
||||
|
||||
[hg_branch]
|
||||
symbol = " "
|
||||
|
||||
[java]
|
||||
symbol = " "
|
||||
|
||||
[julia]
|
||||
symbol = " "
|
||||
|
||||
[kotlin]
|
||||
symbol = " "
|
||||
|
||||
[lua]
|
||||
symbol = " "
|
||||
|
||||
[memory_usage]
|
||||
symbol = " "
|
||||
|
||||
[meson]
|
||||
symbol = " "
|
||||
|
||||
[nim]
|
||||
symbol = " "
|
||||
|
||||
[nix_shell]
|
||||
symbol = " "
|
||||
|
||||
[nodejs]
|
||||
symbol = " "
|
||||
|
||||
[ocaml]
|
||||
symbol = " "
|
||||
|
||||
[os]
|
||||
disabled = false
|
||||
|
||||
[os.symbols]
|
||||
Alpaquita = " "
|
||||
Alpine = " "
|
||||
AlmaLinux = " "
|
||||
Amazon = " "
|
||||
Android = " "
|
||||
Arch = " "
|
||||
Artix = " "
|
||||
CentOS = " "
|
||||
Debian = " "
|
||||
DragonFly = " "
|
||||
Emscripten = " "
|
||||
EndeavourOS = " "
|
||||
Fedora = " "
|
||||
FreeBSD = " "
|
||||
Garuda = " "
|
||||
Gentoo = " "
|
||||
HardenedBSD = " "
|
||||
Illumos = " "
|
||||
Kali = " "
|
||||
Linux = " "
|
||||
Mabox = " "
|
||||
Macos = " "
|
||||
Manjaro = " "
|
||||
Mariner = " "
|
||||
MidnightBSD = " "
|
||||
Mint = " "
|
||||
NetBSD = " "
|
||||
NixOS = " "
|
||||
OpenBSD = " "
|
||||
openSUSE = " "
|
||||
OracleLinux = " "
|
||||
Pop = " "
|
||||
Raspbian = " "
|
||||
Redhat = " "
|
||||
RedHatEnterprise = " "
|
||||
RockyLinux = " "
|
||||
Redox = " "
|
||||
Solus = " "
|
||||
SUSE = " "
|
||||
Ubuntu = " "
|
||||
Unknown = " "
|
||||
Void = " "
|
||||
Windows = " "
|
||||
|
||||
[package]
|
||||
symbol = " "
|
||||
|
||||
[perl]
|
||||
symbol = " "
|
||||
|
||||
[php]
|
||||
symbol = " "
|
||||
|
||||
[pijul_channel]
|
||||
symbol = " "
|
||||
|
||||
[python]
|
||||
symbol = " "
|
||||
|
||||
[rlang]
|
||||
symbol = " "
|
||||
|
||||
[ruby]
|
||||
symbol = " "
|
||||
|
||||
[rust]
|
||||
symbol = " "
|
||||
|
||||
[scala]
|
||||
symbol = " "
|
||||
|
||||
[swift]
|
||||
symbol = " "
|
||||
|
||||
[zig]
|
||||
symbol = " "
|
||||
|
||||
[gradle]
|
||||
symbol = " "
|
||||
208
tools/starship/starship_pwsh.toml
Normal file
208
tools/starship/starship_pwsh.toml
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
# starship.toml
|
||||
# ~/.config/starship.toml
|
||||
format = '''$os$time $username @ $hostname $directory $all$character'''
|
||||
continuation_prompt = "[CR > ](bold cyan) "
|
||||
|
||||
add_newline = true
|
||||
|
||||
[time]
|
||||
disabled = false
|
||||
format = '[\[$time\]](purple)'
|
||||
time_format = '%H:%M'
|
||||
|
||||
[username]
|
||||
format = '[$user](bold)'
|
||||
show_always = true
|
||||
|
||||
[hostname]
|
||||
ssh_only = false
|
||||
ssh_symbol = ' '
|
||||
|
||||
[character]
|
||||
success_symbol = "[PS > ](bold green)"
|
||||
error_symbol = "[PS > ](bold red)"
|
||||
vimcmd_symbol = "[Vi < ](bold green)"
|
||||
|
||||
[directory]
|
||||
truncation_length = 2
|
||||
truncate_to_repo = true
|
||||
read_only = " "
|
||||
style ="bold cyan"
|
||||
truncation_symbol = ".../"
|
||||
|
||||
[directory.substitutions]
|
||||
"~/Documents" = " "
|
||||
"~/Downloads" = " "
|
||||
"~/Music" = " "
|
||||
"~/Pictures" = " "
|
||||
"Source" = " "
|
||||
"src" = " "
|
||||
|
||||
[aws]
|
||||
symbol = " "
|
||||
|
||||
[buf]
|
||||
symbol = " "
|
||||
|
||||
[c]
|
||||
symbol = " "
|
||||
|
||||
[conda]
|
||||
symbol = " "
|
||||
|
||||
[crystal]
|
||||
symbol = " "
|
||||
|
||||
[dart]
|
||||
symbol = " "
|
||||
|
||||
|
||||
[docker_context]
|
||||
symbol = " "
|
||||
|
||||
[elixir]
|
||||
symbol = " "
|
||||
|
||||
[elm]
|
||||
symbol = " "
|
||||
|
||||
[fennel]
|
||||
symbol = " "
|
||||
|
||||
[fossil_branch]
|
||||
symbol = " "
|
||||
|
||||
[git_branch]
|
||||
symbol = " "
|
||||
|
||||
[git_commit]
|
||||
tag_symbol = ' '
|
||||
|
||||
[golang]
|
||||
symbol = " "
|
||||
|
||||
[guix_shell]
|
||||
symbol = " "
|
||||
|
||||
[haskell]
|
||||
symbol = " "
|
||||
|
||||
[haxe]
|
||||
symbol = " "
|
||||
|
||||
[hg_branch]
|
||||
symbol = " "
|
||||
|
||||
[java]
|
||||
symbol = " "
|
||||
|
||||
[julia]
|
||||
symbol = " "
|
||||
|
||||
[kotlin]
|
||||
symbol = " "
|
||||
|
||||
[lua]
|
||||
symbol = " "
|
||||
|
||||
[memory_usage]
|
||||
symbol = " "
|
||||
|
||||
[meson]
|
||||
symbol = " "
|
||||
|
||||
[nim]
|
||||
symbol = " "
|
||||
|
||||
[nix_shell]
|
||||
symbol = " "
|
||||
|
||||
[nodejs]
|
||||
symbol = " "
|
||||
|
||||
[ocaml]
|
||||
symbol = " "
|
||||
|
||||
[os]
|
||||
disabled = false
|
||||
|
||||
[os.symbols]
|
||||
Alpaquita = " "
|
||||
Alpine = " "
|
||||
AlmaLinux = " "
|
||||
Amazon = " "
|
||||
Android = " "
|
||||
Arch = " "
|
||||
Artix = " "
|
||||
CentOS = " "
|
||||
Debian = " "
|
||||
DragonFly = " "
|
||||
Emscripten = " "
|
||||
EndeavourOS = " "
|
||||
Fedora = " "
|
||||
FreeBSD = " "
|
||||
Garuda = " "
|
||||
Gentoo = " "
|
||||
HardenedBSD = " "
|
||||
Illumos = " "
|
||||
Kali = " "
|
||||
Linux = " "
|
||||
Mabox = " "
|
||||
Macos = " "
|
||||
Manjaro = " "
|
||||
Mariner = " "
|
||||
MidnightBSD = " "
|
||||
Mint = " "
|
||||
NetBSD = " "
|
||||
NixOS = " "
|
||||
OpenBSD = " "
|
||||
openSUSE = " "
|
||||
OracleLinux = " "
|
||||
Pop = " "
|
||||
Raspbian = " "
|
||||
Redhat = " "
|
||||
RedHatEnterprise = " "
|
||||
RockyLinux = " "
|
||||
Redox = " "
|
||||
Solus = " "
|
||||
SUSE = " "
|
||||
Ubuntu = " "
|
||||
Unknown = " "
|
||||
Void = " "
|
||||
Windows = " "
|
||||
|
||||
[package]
|
||||
symbol = " "
|
||||
|
||||
[perl]
|
||||
symbol = " "
|
||||
|
||||
[php]
|
||||
symbol = " "
|
||||
|
||||
[pijul_channel]
|
||||
symbol = " "
|
||||
|
||||
[python]
|
||||
symbol = " "
|
||||
|
||||
[rlang]
|
||||
symbol = " "
|
||||
|
||||
[ruby]
|
||||
symbol = " "
|
||||
|
||||
[rust]
|
||||
symbol = " "
|
||||
|
||||
[scala]
|
||||
symbol = " "
|
||||
|
||||
[swift]
|
||||
symbol = " "
|
||||
|
||||
[zig]
|
||||
symbol = " "
|
||||
|
||||
[gradle]
|
||||
symbol = " "
|
||||
208
tools/starship/starship_zsh.toml
Normal file
208
tools/starship/starship_zsh.toml
Normal file
|
|
@ -0,0 +1,208 @@
|
|||
# starship.toml
|
||||
# ~/.config/starship.toml
|
||||
format = '''$os$time $username @ $hostname $directory $all$character'''
|
||||
continuation_prompt = "[r % ](bold cyan) "
|
||||
|
||||
add_newline = true
|
||||
|
||||
[time]
|
||||
disabled = false
|
||||
format = '[\[$time\]](purple)'
|
||||
time_format = '%H:%M'
|
||||
|
||||
[username]
|
||||
format = '[$user](bold)'
|
||||
show_always = true
|
||||
|
||||
[hostname]
|
||||
ssh_only = false
|
||||
ssh_symbol = ' '
|
||||
|
||||
[character]
|
||||
success_symbol = "[z % ](bold green)"
|
||||
error_symbol = "[z % ](bold red)"
|
||||
vimcmd_symbol = "[v ! ](bold green)"
|
||||
|
||||
[directory]
|
||||
truncation_length = 2
|
||||
truncate_to_repo = true
|
||||
read_only = " "
|
||||
style ="bold cyan"
|
||||
truncation_symbol = ".../"
|
||||
|
||||
[directory.substitutions]
|
||||
"~/Documents" = " "
|
||||
"~/Downloads" = " "
|
||||
"~/Music" = " "
|
||||
"~/Pictures" = " "
|
||||
"Source" = " "
|
||||
"src" = " "
|
||||
|
||||
[aws]
|
||||
symbol = " "
|
||||
|
||||
[buf]
|
||||
symbol = " "
|
||||
|
||||
[c]
|
||||
symbol = " "
|
||||
|
||||
[conda]
|
||||
symbol = " "
|
||||
|
||||
[crystal]
|
||||
symbol = " "
|
||||
|
||||
[dart]
|
||||
symbol = " "
|
||||
|
||||
|
||||
[docker_context]
|
||||
symbol = " "
|
||||
|
||||
[elixir]
|
||||
symbol = " "
|
||||
|
||||
[elm]
|
||||
symbol = " "
|
||||
|
||||
[fennel]
|
||||
symbol = " "
|
||||
|
||||
[fossil_branch]
|
||||
symbol = " "
|
||||
|
||||
[git_branch]
|
||||
symbol = " "
|
||||
|
||||
[git_commit]
|
||||
tag_symbol = ' '
|
||||
|
||||
[golang]
|
||||
symbol = " "
|
||||
|
||||
[guix_shell]
|
||||
symbol = " "
|
||||
|
||||
[haskell]
|
||||
symbol = " "
|
||||
|
||||
[haxe]
|
||||
symbol = " "
|
||||
|
||||
[hg_branch]
|
||||
symbol = " "
|
||||
|
||||
[java]
|
||||
symbol = " "
|
||||
|
||||
[julia]
|
||||
symbol = " "
|
||||
|
||||
[kotlin]
|
||||
symbol = " "
|
||||
|
||||
[lua]
|
||||
symbol = " "
|
||||
|
||||
[memory_usage]
|
||||
symbol = " "
|
||||
|
||||
[meson]
|
||||
symbol = " "
|
||||
|
||||
[nim]
|
||||
symbol = " "
|
||||
|
||||
[nix_shell]
|
||||
symbol = " "
|
||||
|
||||
[nodejs]
|
||||
symbol = " "
|
||||
|
||||
[ocaml]
|
||||
symbol = " "
|
||||
|
||||
[os]
|
||||
disabled = false
|
||||
|
||||
[os.symbols]
|
||||
Alpaquita = " "
|
||||
Alpine = " "
|
||||
AlmaLinux = " "
|
||||
Amazon = " "
|
||||
Android = " "
|
||||
Arch = " "
|
||||
Artix = " "
|
||||
CentOS = " "
|
||||
Debian = " "
|
||||
DragonFly = " "
|
||||
Emscripten = " "
|
||||
EndeavourOS = " "
|
||||
Fedora = " "
|
||||
FreeBSD = " "
|
||||
Garuda = " "
|
||||
Gentoo = " "
|
||||
HardenedBSD = " "
|
||||
Illumos = " "
|
||||
Kali = " "
|
||||
Linux = " "
|
||||
Mabox = " "
|
||||
Macos = " "
|
||||
Manjaro = " "
|
||||
Mariner = " "
|
||||
MidnightBSD = " "
|
||||
Mint = " "
|
||||
NetBSD = " "
|
||||
NixOS = " "
|
||||
OpenBSD = " "
|
||||
openSUSE = " "
|
||||
OracleLinux = " "
|
||||
Pop = " "
|
||||
Raspbian = " "
|
||||
Redhat = " "
|
||||
RedHatEnterprise = " "
|
||||
RockyLinux = " "
|
||||
Redox = " "
|
||||
Solus = " "
|
||||
SUSE = " "
|
||||
Ubuntu = " "
|
||||
Unknown = " "
|
||||
Void = " "
|
||||
Windows = " "
|
||||
|
||||
[package]
|
||||
symbol = " "
|
||||
|
||||
[perl]
|
||||
symbol = " "
|
||||
|
||||
[php]
|
||||
symbol = " "
|
||||
|
||||
[pijul_channel]
|
||||
symbol = " "
|
||||
|
||||
[python]
|
||||
symbol = " "
|
||||
|
||||
[rlang]
|
||||
symbol = " "
|
||||
|
||||
[ruby]
|
||||
symbol = " "
|
||||
|
||||
[rust]
|
||||
symbol = " "
|
||||
|
||||
[scala]
|
||||
symbol = " "
|
||||
|
||||
[swift]
|
||||
symbol = " "
|
||||
|
||||
[zig]
|
||||
symbol = " "
|
||||
|
||||
[gradle]
|
||||
symbol = " "
|
||||
1038
tools/vscode/hsnips/latex.hsnips
Normal file
1038
tools/vscode/hsnips/latex.hsnips
Normal file
File diff suppressed because it is too large
Load diff
1009
tools/vscode/hsnips/markdown.hsnips
Normal file
1009
tools/vscode/hsnips/markdown.hsnips
Normal file
File diff suppressed because it is too large
Load diff
8
tools/vscode/hsnips/readme.md
Normal file
8
tools/vscode/hsnips/readme.md
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
# VSCode HyperSnips Snippets
|
||||
|
||||
## Navigator
|
||||
|
||||
- [C](./c.hsnips)
|
||||
- [$\LaTeX$](./latex.hsnips)
|
||||
- [Markdown](./markdown.hsnips)
|
||||
- [Typst](./typst.hsnips)
|
||||
133
tools/vscode/hsnips/typst.hsnips
Normal file
133
tools/vscode/hsnips/typst.hsnips
Normal file
|
|
@ -0,0 +1,133 @@
|
|||
snippet mk "inline Math" iwA
|
||||
$${1}$
|
||||
endsnippet
|
||||
|
||||
snippet dmi "display Math" iwA
|
||||
$ ${1} $
|
||||
endsnippet
|
||||
|
||||
snippet dmm "display Math" iwA
|
||||
$
|
||||
${1}
|
||||
$
|
||||
endsnippet
|
||||
|
||||
snippet pp "parenthesis" iAm
|
||||
(${1})
|
||||
endsnippet
|
||||
|
||||
snippet lim "limit" iAm
|
||||
lim_(${1:n} -> ${2:oo})
|
||||
endsnippet
|
||||
|
||||
snippet derive "derive" iAm
|
||||
derive(${1:f}, ${2:x})
|
||||
endsnippet
|
||||
|
||||
snippet part "partial" iAm
|
||||
(diff ${1:f})/(diff ${3:x})
|
||||
endsnippet
|
||||
|
||||
snippet sb "subscript" iAm
|
||||
_(${1:2})
|
||||
endsnippet
|
||||
|
||||
snippet sr "square" iAm
|
||||
^2
|
||||
endsnippet
|
||||
|
||||
snippet pow "to the ... power" iAm
|
||||
^(${1:3})
|
||||
endsnippet
|
||||
|
||||
snippet veps "epsilon.alt" iAm
|
||||
epsilon.alt
|
||||
endsnippet
|
||||
|
||||
snippet ;; "\;" iAm
|
||||
\;
|
||||
endsnippet
|
||||
|
||||
snippet ,, "\," iAm
|
||||
\,
|
||||
endsnippet
|
||||
|
||||
snippet `([A-Za-z\)])(\d)` "auto subscript" iAm
|
||||
`` rv = m[1] + "_" + m[2]``
|
||||
endsnippet
|
||||
|
||||
snippet `([A-Za-z\)])_(\d{2})` "auto subscript" iAm
|
||||
`` rv = m[1] + "_(" + m[2] + ")" ``
|
||||
endsnippet
|
||||
|
||||
snippet `(?<![A-Za-z])([A-Za-hk-z])([acdijkmnpqrstABCDIJKMNPQRST])\2` "auto subscript" iAm
|
||||
`` rv = m[1] + "_" + m[2] ``
|
||||
endsnippet
|
||||
|
||||
# Custom: Add more greek letters
|
||||
|
||||
snippet `(\)|mu|alpha|sigma|rho|beta|gamma|delta|zeta|eta|varepsilon|epsilon|theta|iota|kappa|vartheta|lambda|nu|pi|rho|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)([acdijkmnpqrstABCDIJKMNPQRST])\2` "auto subscript for greek letter" iAm
|
||||
`` rv = m[1] + "_" + m[2].substring(0, 1) ``
|
||||
endsnippet
|
||||
|
||||
snippet `(?<![A-Za-z])([A-Za-hk-z01])(grave|acute|hat|tilde|macron|breve|dot|ddot|dddot|ddddot|diaer|circle|caron|vec|upright|italic|b|sans|frak|mono|bb|cal|ov)` "hat" iAm
|
||||
``
|
||||
const map = { "ddot": "dot.double", "dddot": "dot.triple", "ddddot": "dot.quad", "vec": "arrow", "b": "bold", "ov": "overline" }
|
||||
rv = (map[m[2]] || m[2]) + "(" + m[1] + ")"
|
||||
``
|
||||
endsnippet
|
||||
|
||||
snippet `(mu|alpha|sigma|rho|beta|gamma|delta|zeta|eta|varepsilon|epsilon|theta|iota|kappa|vartheta|lambda|nu|pi|rho|tau|upsilon|phi|chi|psi|omega|Gamma|Delta|Theta|Lambda|Xi|Pi|Sigma|Upsilon|Phi|Psi|Omega)(grave|acute|hat|tilde|macron|breve|dot|ddot|dddot|ddddot|diaer|circle|caron|vec|upright|italic|b|sans|frak|mono|bb|cal|ov)` "hat" iAm
|
||||
``
|
||||
const map = { "ddot": "dot.double", "dddot": "dot.triple", "ddddot": "dot.quad", "vec": "arrow", "b": "bold", "ov": "overline" }
|
||||
rv = (map[m[2]] || m[2]) + "(" + m[1] + ")"
|
||||
``
|
||||
endsnippet
|
||||
|
||||
snippet `((grave|acute|hat|tilde|macron|breve|dot|dot\.double|dot\.triple|dot\.quad|diaer|circle|acute\.double|caron|arrow|arrow\.l|upright|italic|bold|sans|frak|mono|bb|cal)\([a-zA-Z\d]+\))(grave|acute|hat|tilde|macron|breve|dot|ddot|dddot|ddddot|diaer|circle|caron|vec|upright|italic|b|sans|frak|mono|bb|cal|ov)` "hat" iAm
|
||||
``
|
||||
const map = { "ddot": "dot.double", "dddot": "dot.triple", "ddddot": "dot.quad", "vec": "arrow", "b": "bold", "ov": "overline" }
|
||||
rv = (map[m[3]] || m[3]) + "(" + m[1] + ")"
|
||||
``
|
||||
endsnippet
|
||||
|
||||
snippet `(?<!\.)alt` "alt" iAm
|
||||
.alt
|
||||
endsnippet
|
||||
|
||||
snippet invs "inverse" iAm
|
||||
^(-1)
|
||||
endsnippet
|
||||
|
||||
snippet xl "vector" iAm
|
||||
arrow(${1:x})
|
||||
endsnippet
|
||||
|
||||
snippet @< "angle" iAm
|
||||
angle.l ${1:x} angle.r
|
||||
endsnippet
|
||||
|
||||
|
||||
snippet HL "highlight" iA
|
||||
#highlight[${VISUAL}]
|
||||
endsnippet
|
||||
|
||||
snippet iiint "triple integral" iAm
|
||||
integral.triple ${1}
|
||||
endsnippet
|
||||
|
||||
snippet oint "closed line integral" iAm
|
||||
integral.cont ${1}
|
||||
endsnippet
|
||||
|
||||
snippet iint "double integral" iAm
|
||||
integral.double ${1}
|
||||
endsnippet
|
||||
|
||||
snippet int "integral" iAm
|
||||
integral ${1}
|
||||
endsnippet
|
||||
|
||||
snippet // "frac" iAm
|
||||
frac(${1:1}, ${2:2})
|
||||
endsnippet
|
||||
23
tools/vscode/vscode.vimrc
Normal file
23
tools/vscode/vscode.vimrc
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
" ~/.config/vscode/vscode.vimrc
|
||||
" New-Item -ItemType SymbolicLink -Path ~\.config\vscode\vscode.vimrc -Target ~\.dotfiles\vscode\vscode.vimrc
|
||||
" ln -sf $DOTFILES/vscode/vscode.vimrc $XDG_CONFIG_HOME/vscode/vscode.vimrc
|
||||
" And go to vscode vim setting:
|
||||
"vim.vimrc.path": "$HOME/.config/vscode/vscode.vimrc",
|
||||
|
||||
" Arrow remap
|
||||
noremap n j
|
||||
noremap e k
|
||||
noremap i l
|
||||
|
||||
" Similar position to i
|
||||
noremap l i
|
||||
noremap L I
|
||||
" ne[k]st
|
||||
noremap k n
|
||||
noremap K N
|
||||
" [j]ump
|
||||
noremap j e
|
||||
noremap J E
|
||||
|
||||
" Y to yank to end of line
|
||||
noremap Y y$
|
||||
20
tools/zsh/.zshenv
Normal file
20
tools/zsh/.zshenv
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
# ~/.zshenv
|
||||
# ln -s $DOTFILES/zsh/.zshenv $ZDOTDIR/.zshenv
|
||||
# This file is sourced by all zsh sessions upon startup.
|
||||
|
||||
# Use XDG Base Directory Specification
|
||||
export XDG_CONFIG_HOME="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
export XDG_DATA_HOME="${XDG_DATA_HOME:-$HOME/.local/share}"
|
||||
export XDG_STATE_HOME="${XDG_STATE_HOME:-$HOME/.local/state}"
|
||||
export XDG_CACHE_HOME="${XDG_CACHE_HOME:-$HOME/.cache}"
|
||||
export XDG_RUNTIME_DIR="/run/user/$(id -u)"
|
||||
# Disable shell sessions on macOS when using default terminal
|
||||
SHELL_SESSIONS_DISABLE=1
|
||||
|
||||
# Zsh
|
||||
export ZDOTDIR="${XDG_CONFIG_HOME}/zsh"
|
||||
|
||||
# Also put in /etc/zsh/zshenv
|
||||
# or /etc/zshenv in macOS
|
||||
# sudo cp $DOTFILES/zsh/.zshenv /etc/zsh/zshenv
|
||||
# sudo cp $DOTFILES/zsh/.zshenv /etc/zshenv
|
||||
50
tools/zsh/alias.zsh
Normal file
50
tools/zsh/alias.zsh
Normal file
|
|
@ -0,0 +1,50 @@
|
|||
# PowerShell Equivalent #
|
||||
alias ni=touch
|
||||
alias cls=clear
|
||||
alias ii=open
|
||||
|
||||
# Dev #
|
||||
alias g++='g++ -std=c++2b' # Set the default C++ standard to C++20
|
||||
alias gcc='gcc -std=c99' # Set the default C standard to C99
|
||||
alias cl='clang -std=c99'
|
||||
alias clpp='clang++ -std=c++2b'
|
||||
alias python=python3 # Set the default Python version to Python 3
|
||||
alias py=python # Alias for Python
|
||||
alias pip=pip3 # Alias for pip
|
||||
# alias bashcfg="nvim ~/.bashrc"
|
||||
alias zshcfg="nvim $ZDOTDIR/.zshrc"
|
||||
alias shcfg=zshcfg
|
||||
alias reload="source $ZDOTDIR/.zshrc"
|
||||
alias nvimrc="nvim $XDG_CONFIG_HOME/nvim/"
|
||||
alias ohmyzsh="code ~/.oh-my-zsh"
|
||||
alias pulldots="cd $DOTFILES && git pull"
|
||||
|
||||
# Conda #
|
||||
alias pyact="conda activate"
|
||||
alias pydact="conda deactivate"
|
||||
alias pylsenv="conda env list"
|
||||
alias pymkenv="conda create --name"
|
||||
|
||||
# Editors #
|
||||
alias v=nvim
|
||||
alias c=code
|
||||
|
||||
# lsd #
|
||||
alias ls='lsd -a'
|
||||
alias l='lsd -lah'
|
||||
# Misc #
|
||||
alias cf=cfiles
|
||||
|
||||
# Functions #
|
||||
mkcd() {
|
||||
mkdir -p $1 && cd $1
|
||||
}
|
||||
cdls(){
|
||||
cd $1 && ls
|
||||
}
|
||||
tc(){
|
||||
touch $1 && code $1
|
||||
}
|
||||
tv(){
|
||||
touch $1 && nvim $1
|
||||
}
|
||||
98
tools/zsh/config.zsh
Normal file
98
tools/zsh/config.zsh
Normal file
|
|
@ -0,0 +1,98 @@
|
|||
# ZSH Config #
|
||||
export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
|
||||
export PATH=$HOME/.local/share/gem/ruby/3.3.0/bin:$PATH # Ruby Executables
|
||||
HIST_STAMPS="yyyy-mm-dd"
|
||||
HISTSIZE=10000
|
||||
SAVEHIST=10000
|
||||
|
||||
export NVM_DIR="$HOME/.config/nvm"
|
||||
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
|
||||
|
||||
# plugins=(git web-search jsontools z vi-mode zsh-syntax-highlighting zsh-autosuggestions)
|
||||
|
||||
# Plugins (Manually Managed) #
|
||||
# $ZDOTDIR/plugins
|
||||
|
||||
# echo "[DEBUG] Loading plugins..."
|
||||
# echo $ZDOTDIR
|
||||
# Load zsh-syntax-highlighting before zsh-history-substring-search
|
||||
# Reference: https://github.com/zsh-users/zsh-history-substring-search?tab=readme-ov-file#usage
|
||||
source $ZDOTDIR/plugins/zsh-autosuggestions/zsh-autosuggestions.zsh
|
||||
source $ZDOTDIR/plugins/zsh-syntax-highlighting/zsh-syntax-highlighting.zsh
|
||||
source $ZDOTDIR/plugins/zsh-history-substring-search/zsh-history-substring-search.zsh
|
||||
|
||||
# Tools Related Environment Variables #
|
||||
|
||||
PAGER="less"
|
||||
EDITOR="nvim"
|
||||
VISUAL="nvim"
|
||||
|
||||
# Use XDG Base Directory Specification #
|
||||
|
||||
# ~/.azure/ -> $XDG_DATA_HOME/azure/
|
||||
export AZURE_CONFIG_DIR="$XDG_DATA_HOME"/azure
|
||||
# ~/.cargo/ -> $XDG_DATA_HOME/cargo
|
||||
export CARGO_HOME="$XDG_DATA_HOME"/cargo
|
||||
# ~/.cgdb/ -> $XDG_CONFIG_HOME/cgdb/
|
||||
export CGDB_DIR="$XDG_CONFIG_HOME"/cgdb
|
||||
# ~/.docker -> $XDG_CONFIG_HOME/docker
|
||||
export DOCKER_CONFIG="$XDG_CONFIG_HOME"/docker
|
||||
# ~/.dotnet -> $XDG_DATA_HOME/dotnet
|
||||
# Not working
|
||||
# export DOTNET_CLI_HOME="$XDG_DATA_HOME"/dotnet
|
||||
# ~/.gnupg -> $XDG_CONFIG_HOME/gnupg
|
||||
export GNUPGHOME="$XDG_DATA_HOME"/gnupg
|
||||
# ~/go -> $XDG_DATA_HOME/go
|
||||
export GOPATH="$XDG_DATA_HOME"/go
|
||||
# ~/.inputrc -> $XDG_CONFIG_HOME/readline/inputrc
|
||||
export INPUTRC="$XDG_CONFIG_HOME"/readline/inputrc
|
||||
# ~/.juliaup/ -> $XDG_DATA_HOME/julia/
|
||||
export JULIA_DEPOT_PATH="$XDG_DATA_HOME/julia:$JULIA_DEPOT_PATH"
|
||||
# Check if node is installed
|
||||
if command -v node > /dev/null; then
|
||||
# ~/.node_repl_history -> $XDG_STATE_HOME/node/repl_history
|
||||
export NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/repl_history
|
||||
# ~/.ts_node_repl_history -> $XDG_STATE_HOME/node/ts_node_repl_history
|
||||
export TS_NODE_REPL_HISTORY="$XDG_STATE_HOME"/node/ts_node_repl_history
|
||||
# ~/.npmrc -> $XDG_CONFIG_HOME/npm/npmrc
|
||||
export NPM_CONFIG_USERCONFIG="$XDG_CONFIG_HOME"/npm/npmrc
|
||||
# ~/.npm -> $XDG_CACHE_HOME/npm
|
||||
export NPM_CONFIG_INIT_MODULE="$XDG_CONFIG_HOME"/npm/config/npm-init.js
|
||||
export NPM_CONFIG_CACHE="$XDG_CACHE_HOME"/npm
|
||||
export NPM_CONFIG_TMP="$XDG_RUNTIME_DIR"/npm
|
||||
fi
|
||||
# ~/.nv -> $XDG_CACHE_HOME/nv (CUDA)
|
||||
# macOS does not have Cuda; Check if CUDA is installed
|
||||
if [ "$(uname)" != "Darwin" ] && [ -d "/usr/local/cuda" ]; then
|
||||
export CUDA_CACHE_PATH="$XDG_CACHE_HOME"/nv
|
||||
fi
|
||||
# ~/,parallel -> $XDG_CONFIG_HOME/parallel
|
||||
export PARALLEL_HOME="$XDG_CONFIG_HOME"/parallel
|
||||
# ~/.python_history -> $XDG_DATA_HOME/python/history
|
||||
# Works only with Python 3.13.0a3 and later
|
||||
export PYTHON_HISTORY="$XDG_DATA_HOME"/python/history
|
||||
# ~/.screenrc -> $XDG_CONFIG_HOME/screen/screenrc
|
||||
export SCREENRC="$XDG_CONFIG_HOME"/screen/screenrc
|
||||
# ~/.screen/ -> $XDG_RUNTIME_DIR/screen
|
||||
export SCREENDIR="${XDG_RUNTIME_DIR}/screen"
|
||||
# ~/.spacemacs/ -> $XDG_CONFIG_HOME/spacemacs
|
||||
export SPACEMACSDIR="$XDG_CONFIG_HOME"/spacemacs
|
||||
# ~/.tldrc/ -> $XDG_CACHE_HOME/tldr
|
||||
export TLDR_CACHE_DIR="$XDG_CACHE_HOME"/tldr
|
||||
# ~/.w3m -> $XDG_DATA_HOME/w3m
|
||||
export W3M_DIR="$XDG_DATA_HOME"/w3m
|
||||
# ~/.wakatime.cfg -> $XDG_CONFIG_HOME/wakatime.cfg
|
||||
# ~/.wakatime/ -> $XDG_CONFIG_HOME/wakatime/
|
||||
export WAKATIME_HOME="$XDG_CONFIG_HOME/wakatime"
|
||||
# ~/.wget-hsts -> $XDG_DATA_HOME/wget-hsts
|
||||
alias wget='wget --hsts-file="$XDG_CACHE_HOME/wget-hsts"'
|
||||
# ~/.z -> $XDG_DATA_HOME/z
|
||||
export _Z_DATA="$XDG_DATA_HOME/z"
|
||||
# ~/.zcompdump* -> $XDG_CACHE_HOME/zsh/zcompdump*
|
||||
# compinit -d "$XDG_CACHE_HOME"/zsh/zcompdump-"$ZSH_VERSION"
|
||||
# ~/.zsh_history -> $XDG_STATE_HOME/zsh/history
|
||||
export HISTFILE="$XDG_STATE_HOME"/zsh/history
|
||||
|
||||
# https://unix.stackexchange.com/questions/33994/
|
||||
# Use `set -k` to mark leading `#` as a comment character
|
||||
set -k
|
||||
23
tools/zsh/keymap.zsh
Normal file
23
tools/zsh/keymap.zsh
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
# $DOTFILES/keymap.zsh
|
||||
bindkey -v # Vi Keybindings
|
||||
|
||||
# Colemak hnei
|
||||
# bindkey -M vicmd 'h' vi-backward-char # No change
|
||||
bindkey -M vicmd 'n' down-line-or-history
|
||||
bindkey -M vicmd 'e' up-line-or-history
|
||||
bindkey -M vicmd 'i' vi-forward-char
|
||||
|
||||
# Similar position to [i] in QWERTY
|
||||
bindkey -M vicmd 'l' vi-insert
|
||||
bindkey -M vicmd 'L' vi-insert-bol
|
||||
# Ne{[k]s}t
|
||||
bindkey -M vicmd 'k' vi-repeat-search
|
||||
bindkey -M vicmd 'K' vi-rev-repeat-search
|
||||
# [J]ump
|
||||
bindkey -M vicmd 'j' vi-forward-word-end
|
||||
bindkey -M vicmd 'J' vi-forward-blank-word-end
|
||||
# Use N to Join
|
||||
bindkey -M vicmd 'N' vi-join
|
||||
|
||||
# Search History with [r]everse (default emacs keybinding)
|
||||
bindkey '^R' history-incremental-search-backward
|
||||
11
tools/zsh/navi.zsh
Normal file
11
tools/zsh/navi.zsh
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
|
||||
# Relative navigation
|
||||
alias ..="cd .."
|
||||
alias ...="cd ../.."
|
||||
alias ....="cd ../../.."
|
||||
alias .....="cd ../../../.."
|
||||
alias ......="cd ../../../../.."
|
||||
|
||||
function - { cd - }
|
||||
|
||||
eval "$(zoxide init zsh)"
|
||||
3
tools/zsh/prompt.zsh
Normal file
3
tools/zsh/prompt.zsh
Normal file
|
|
@ -0,0 +1,3 @@
|
|||
export STARSHIP_CONFIG=$DOTFILES/.config/starship/starship_zsh.toml
|
||||
|
||||
eval "$(starship init zsh)"
|
||||
19
tools/zsh/update.sh
Normal file
19
tools/zsh/update.sh
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
# $DOTFILES/zsh/update.sh
|
||||
|
||||
# This file won't be sourced by zsh by default
|
||||
# Use `source` to run this file for updating plugins
|
||||
|
||||
# Plugins #
|
||||
# Auto `git pull` on $ZDOTDIR/plugins
|
||||
for plugin in $ZDOTDIR/plugins/*; do
|
||||
if [ -d "$plugin" ]; then
|
||||
cd $plugin
|
||||
git pull --quiet --no-edit
|
||||
fi
|
||||
done
|
||||
|
||||
if [ which brew > /dev/null ]; then
|
||||
brew update
|
||||
brew upgrade
|
||||
fi
|
||||
|
||||
Loading…
Add table
Add a link
Reference in a new issue