zed initial setup

This commit is contained in:
js0ny 2025-02-10 22:32:18 +00:00
parent da0cc1d6e8
commit 56faf63bd2
5 changed files with 66 additions and 6 deletions

View file

@ -425,6 +425,12 @@ mapkey(",p", "Switch to GitHub Page", function () {
repo = href.split("/")[4];
window.location.href = gh.pageLink(owner, repo);
}, { domain: /github.com/ });
mapkey(",r", "Copy short [r]efeference owner/repo", function () {
const href = window.location.href;
owner = href.split("/")[3];
repo = href.split("/")[4];
Clipboard.write(`${owner}/${repo}`);
}, { domain: /github.com/ });
// github.dev
mapkey(",r", "Switch to GitHub Repo", function () {
const url = new URL(window.location.href);

View file

@ -37,7 +37,7 @@ noremap J E
" Y to yank to end of line
noremap Y y$
nnoremap <esc> :nohlsearch<CR>
nnoremap <esc> removeSecondaryCursors
" lsp
@ -52,11 +52,12 @@ noremap gr editor.action.goToReferences
noremap gpr editor.action.referenceSearch.trigger
map % extension.matchitJumpItems
" Requires matchit by redguardtoo
" nnoremap % extension.matchitJumpItems
noremap zR editor.foldAll
" keep selection after indent (define in settings.json)
" keep selection after indent
vnoremap < editor.action.outdentLines
vnoremap > editor.action.indentLines
@ -65,3 +66,11 @@ vnoremap > editor.action.indentLines
" Comment if you don't use cjk or the plugin
nmap w cjkWordHandler.cursorWordEndRight
nmap b cjkWordHandler.cursorWordStartLeft
noremap <C-w>n <C-w>j
noremap <C-w>e <C-w>k
noremap <C-w>i <C-w>l
noremap <C-w>x workbench.action.toggleEditorGroupLayout
" Use C-w C-w as original C-w
noremap <C-w><C-w> workbench.action.closeActiveEditor
noremap <C-w><A-n> workbench.action.togglePanel

View file

@ -23,6 +23,8 @@
// from the command palette.
// https://github.com/zed-industries/zed/tree/main/assets/keymaps
// Sequence: https://zed.dev/docs/key-bindings#remapping-keys
[
{
"context": "Workspace",
@ -45,7 +47,19 @@
"bindings": {
"N": "vim::JoinLines",
"l": "vim::InsertBefore",
"L": "vim::InsertFirstNonWhitespace"
"L": "vim::InsertFirstNonWhitespace",
"H": "pane::ActivatePrevItem",
"I": "pane::ActivateNextItem"
}
},
{
"context": "vim_mode == normal || not_editing || EmptyPane",
"bindings": {
"space space": "file_finder::Toggle",
"space ;": "command_palette::Toggle",
"space f c": "zed::OpenSettings",
"space f e c": "zed::OpenSettings"
}
},
{
@ -56,7 +70,9 @@
"e": "vim::Up",
"i": "vim::Right",
"k": "search::SelectNextMatch",
"K": "search::SelectPrevMatch"
"K": "search::SelectPrevMatch",
"N": ["workspace::SendKeystrokes", "n n n n n"],
"E": ["workspace::SendKeystrokes", "e e e e e"]
}
},
{

View file

@ -27,5 +27,7 @@
"light": "Catppuccin Latte",
"dark": "Catppuccin Mocha"
},
"relative_line_numbers": true
"relative_line_numbers": true,
"buffer_font_family": "JetBrainsMono Nerd Font",
"remove_trailing_whitespace_on_save": true
}

View file

@ -0,0 +1,27 @@
{
"src": {
"prefix": "src",
"body": ["#+begin_src $1", "$0", "#+end_src"],
"description": "Source code block"
},
"ex": {
"prefix": "ex",
"body": ["#+begin_example", "$0", "#+end_example"],
"description": "Example block"
},
"begin": {
"prefix": "begin",
"body": ["#+begin_$1", "$0", "#+end_$1"],
"description": "Begin block"
},
"【【": {
"prefix": "[[",
"body": ["[[$0]]"],
"description": "Chinese link"
},
"elisp": {
"prefix": "elisp",
"body": ["#+begin_src emacs-lisp :tangle yes", "$0", "#+end_src"],
"description": "Emacs Lisp code block"
}
}