-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ed4ceb2
Showing
15 changed files
with
622 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
name: pre-commit | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: [main] | ||
|
||
jobs: | ||
pre-commit: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
# Give the default GITHUB_TOKEN write permission to commit and push the | ||
# added or changed files to the repository. | ||
contents: write | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
- name: Install pre-commit | ||
run: pip install pre-commit | ||
|
||
- name: Run pre-commit | ||
run: pre-commit run --all-files | ||
continue-on-error: true # Continue even if pre-commit fails | ||
|
||
# Commit all changed files back to the repository | ||
- uses: stefanzweifel/git-auto-commit-action@v5 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lts/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: "v4.0.0-alpha.8" | ||
hooks: | ||
- id: prettier | ||
# Those are not supported by biomejs yet, refer https://biomejs.dev/internals/language-support/ | ||
types_or: [html, css, markdown] | ||
description: "Prettify files for the files which Biomejs doesn't support yet" | ||
- repo: https://github.com/biomejs/pre-commit | ||
rev: "v0.1.0" | ||
hooks: | ||
- id: biome-check | ||
additional_dependencies: ["@biomejs/[email protected]"] | ||
description: "Format, organize imports, lint, and apply safe fixes to the committed files" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Huynh Duc Dung | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,171 @@ | ||
<h1 align="center">Welcome to zed-101-setup 👋</h1> | ||
<p> | ||
Zed Editor 101 setup | ||
</p> | ||
|
||
## Nerd Font - https://github.com/getnf/getnf | ||
|
||
```sh | ||
curl -fsSL https://raw.githubusercontent.com/getnf/getnf/main/install.sh | bash | ||
``` | ||
|
||
## Vim mode - https://zed.dev/docs/vim | ||
|
||
### Settings | ||
|
||
```json | ||
// settings.json | ||
{ | ||
"theme": "Dracula", | ||
"ui_font_size": 16, | ||
"buffer_font_size": 18, | ||
"buffer_font_family": "JetBrainsMono Nerd Font", | ||
// Vim mode settings | ||
"vim_mode": true, | ||
// use relative line numbers | ||
"relative_line_numbers": true, | ||
"tab_bar": { | ||
"show": false | ||
}, | ||
"scrollbar": { | ||
"show": "never" | ||
}, | ||
// Local AI with Ollama, refer https://zed.dev/docs/assistant-panel#using-ollama-on-macos | ||
"assistant": { | ||
"version": "1", | ||
"provider": { | ||
"name": "openai", | ||
"type": "openai", | ||
"default_model": "gpt-4-turbo-preview", | ||
"api_url": "http://localhost:11434/v1" | ||
} | ||
}, | ||
"languages": { | ||
"TypeScript": { | ||
"inlay_hints": { | ||
"enabled": true | ||
} | ||
} | ||
} | ||
} | ||
``` | ||
|
||
## Keymaps | ||
|
||
```json | ||
// keymap.json | ||
[ | ||
{ | ||
"context": "Editor && (vim_mode == normal || vim_mode == visual) && !VimWaiting && !menu", | ||
"bindings": { | ||
// put key-bindings here if you want them to work in normal & visual mode | ||
// Git | ||
"space g h d": "editor::ToggleHunkDiff", | ||
"space g h r": "editor::RevertSelectedHunks" | ||
} | ||
}, | ||
{ | ||
"context": "Editor && vim_mode == normal && !VimWaiting && !menu", | ||
"bindings": { | ||
// put key-bindings here if you want them to work only in normal mode | ||
// Window movement bindings | ||
// Ctrl jklk to move between panes | ||
"ctrl-h": ["workspace::ActivatePaneInDirection", "Left"], | ||
"ctrl-l": ["workspace::ActivatePaneInDirection", "Right"], | ||
"ctrl-k": ["workspace::ActivatePaneInDirection", "Up"], | ||
"ctrl-j": ["workspace::ActivatePaneInDirection", "Down"], | ||
// LSP | ||
"g d": "editor::GoToDefinition", | ||
"g D": "editor::GoToDefinitionSplit", | ||
"g i": "editor::GoToImplementation", | ||
"g I": "editor::GoToImplementationSplit", | ||
"g t": "editor::GoToTypeDefinition", | ||
"g T": "editor::GoToTypeDefinitionSplit", | ||
"g r": "editor::FindAllReferences", | ||
"] d": "editor::GoToDiagnostic", | ||
"[ d": "editor::GoToPrevDiagnostic", | ||
// Symbol search | ||
"s s": "outline::Toggle", | ||
// Project diagnostic | ||
"space x x": "diagnostics::Deploy", | ||
// Switch between buffers | ||
"shift-h": "pane::ActivatePrevItem", | ||
"shift-l": "pane::ActivateNextItem", | ||
// Close active panel | ||
"shift-q": "pane::CloseActiveItem", | ||
// File finder | ||
"space space": "file_finder::Toggle" | ||
} | ||
}, | ||
// Comment code | ||
{ | ||
"context": "Editor && vim_mode == visual && !VimWaiting && !menu", | ||
"bindings": { | ||
// visual, visual line & visual block modes | ||
"g c": "editor::ToggleComments" | ||
} | ||
}, | ||
{ | ||
"context": "Editor && vim_mode == insert && !menu", | ||
"bindings": { | ||
// put key-bindings here if you want them to work in insert mode | ||
"j j": "vim::NormalBefore" // remap jj in insert mode to escape | ||
} | ||
}, | ||
// Rename | ||
{ | ||
"context": "Editor && vim_operator == c", | ||
"bindings": { | ||
"c": "vim::CurrentLine", | ||
"r": "editor::Rename" // zed specific | ||
} | ||
}, | ||
// Code Action | ||
{ | ||
"context": "Editor && vim_operator == c", | ||
"bindings": { | ||
"c": "vim::CurrentLine", | ||
"a": "editor::ToggleCodeActions" // zed specific | ||
} | ||
}, | ||
// Toggle terminal | ||
{ | ||
"context": "Workspace", | ||
"bindings": { | ||
// Toggle terminal | ||
"ctrl-\\": "terminal_panel::ToggleFocus" | ||
} | ||
}, | ||
{ | ||
"context": "Terminal", | ||
"bindings": {} | ||
}, | ||
// File panel (netrw) | ||
{ | ||
"context": "ProjectPanel && not_editing", | ||
"bindings": { | ||
"a": "project_panel::NewFile", | ||
"A": "project_panel::NewDirectory", | ||
"r": "project_panel::Rename", | ||
"d": "project_panel::Delete", | ||
"x": "project_panel::Cut", | ||
"c": "project_panel::Copy", | ||
"p": "project_panel::Paste" | ||
} | ||
} | ||
] | ||
``` | ||
|
||
Please | ||
|
||
## Setup local AI with Ollama - https://zed.dev/docs/assistant-panel#using-ollama-on-macos | ||
|
||
## Resources | ||
|
||
- [Text Manipulation Kung Fu for the Aspiring Black Belt](https://zed.dev/blog/text-manipulation) | ||
- [Vim - Zed](https://zed.dev/docs/vim) | ||
- [JavaScript - Zed](https://zed.dev/docs/languages/javascript) | ||
|
||
## Show your support | ||
|
||
Give a ⭐️ if this project helped you! |
Oops, something went wrong.