ved
vid macos
自 2017 年 6 月以來,我一直使用 Ved 作為我的主要編輯器(2018 年 6 月用 V 重寫)。
它可能不適合所有人。目前存在一些必須解決的限制。我們正在努力慢慢提高 ved 的穩定性和使用者體驗。
若要配置編輯器,請參閱配置部分。
在 Linux 上,您需要安裝一些使用 X11 函式庫所需的軟體包,因為 Ved 是一個圖形應用程式。在 Macos 和 Windows 上,可以跳過。然後安裝V並編譯ved。這將需要幾秒鐘。
git clone https://github.com/vlang/ved
cd ved
v .
./ved
Ved 應該在一秒鐘內完成建造。
預設使用 V 內建的字體渲染,但可以選擇使用 freetype,這可能會為某些使用者提供更好的渲染:
v -d use_freetype .
要使用 freetype,必須先將其安裝在您的系統上。請按照以下適合您的平台的步驟進行操作。
烏班圖:
sudo apt install libfreetype6-dev libx11-dev libxrandr-dev mesa-common-dev libxi-dev libxcursor-dev
軟呢帽:
sudo dnf install freetype-devel libXcursor-devel libXi-devel
拱:
pacman -S freetype2
蘋果系統:
brew install freetype
視窗:
v setup-freetype
Discord(主要社區):https://discord.gg/vlang。加入#ved
頻道。
Ved 在$HOME/.ved
中建立一個設定目錄,其中儲存工作區、會話、任務和設定檔。設定檔只是一個名為conf.toml
的 TOML 檔案。它提供了一種更改一些基本設定和編輯器顏色的方法。
如果您不想觸及配置文件,則永遠不必這樣做! Ved 本身不會創建它,它提供了合理的預設值來幫助您入門。如果您更喜歡冒險,這裡是一個範例配置文件,其中包含所有可能的設定:
# To get started, create a file called "conf.toml" in $HOME/.ved
# Most of the settings are contained inside this "editor" table.
[ editor ]
dark_mode = false # Ved comes with a light and dark mode built-in.
cursor = ' variable ' # Ved has three variants: Variable, block, and beam. You are probably used to "variable" or "beam".
text_size = 18 # ┌───────────────────────────────────────────────────┐
line_height = 20 # │ These *can* be edited, but you probably shouldn't │
char_width = 8 # └───────────────────────────────────────────────────┘
tab_size = 4 # Ved uses tab characters (t). This settings changes how many spaces a tab should be displayed as
backspace_go_up = true # If set to true, hitting the backspace doesn't do anything when you reach the beginning of the line
# If you do not like ved's default colorscheme, or you just want
# something new, edit the "colors" table. Ved uses a form of base16
# to control syntax and editor highlighting. Please note that due
# to ved's very minimal highlighting, base16 themes copied off of
# the internet are not going to look like very much like their
# screenshots.
[ colors ]
base00 = " efecf4 "
base01 = " e2dfe7 "
base02 = " 8b8792 "
base03 = " 7e7887 "
base04 = " 655f6d "
base05 = " 585260 "
base06 = " 26232a "
base07 = " 19171c "
base08 = " be4678 "
base09 = " aa573c "
base0A = " a06e3b "
base0B = " 2a9292 "
base0C = " 398bc6 "
base0D = " 576ddb "
base0E = " 955ae7 "
base0F = " bf40bf "
Ved 最適合工作區(有程式碼的目錄)。您可以擁有多個工作區,並使用C [
和C ]
在它們之間快速切換。
若要開啟多個工作區,請執行
ved path/to/project1 path/to/project2
按鍵綁定:
C
在 macOS 上為⌘
,在所有其他系統上為Ctrl
。
C q q exit the editor
C o open a file
C s save
C r reload current file
C p open ctrlp (fuzzy search)
/ search in current file
C g copy current file's path to clipboard
t go to the previous file
gd go to definition
C c git commit -am
C - git diff
? git grep (search across all files in current workspace)
C u build current project (build instructions must be located in "build")
C y alternative build of the current project (build instructions must be located in "build2")
C 1 switch to Ved from any other application (only on macOS for now)
C d go to the previous split
C e go to the next split
C [ go to the previous workspace
C ] go to the next workspace
C a start a new task
C t show the Timer/Pomodoro window
支援的 vim 綁定:
j k h l down, up, left, right (moves cursor)
C-F C-B page down, page up
L H go to top/bottom of the page
w b next/previous word
dw de cw ce delete word
di ci smart delete
A I go to start/end of line, insert mode
o O new line below/above, insert mode
v selection mode
zz center current line
y d p J yank, delete, paste, join lines
. repeat last action
< > indent right/left
/ * n search, search for word under cursor, next occurence
gg G go to the beginning/end of the file
x r delete/replace character under cursor
C-n autocomplete
+y yank and copy to system clipboard