Skip to content

Commit

Permalink
📝 Update configure.md
Browse files Browse the repository at this point in the history
  • Loading branch information
Freed-Wu committed Dec 27, 2023
1 parent 1a250e0 commit 644d76b
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 3 deletions.
2 changes: 1 addition & 1 deletion addon-info.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "translate-shell",
"description": "Translate text by google, bing, youdaozhiyun, haici, stardict, openai, large language model of local machine, etc at same time from CLI, GUI (GNU/Linux, Android, macOS and Windows), REPL, python, shell and vim.",
"version": "0.0.48",
"version": "0.0.49",
"author": "Wu Zhenyu <wuzhenyu@ustc.edu>",
"repository": {
"type": "git",
Expand Down
60 changes: 59 additions & 1 deletion docs/resources/configure.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,19 @@
# Configure for Language Servers

- For windows, change `~/.config` to `~/AppData/Local`
- For macOS, change `~/.config` to `~/Library`

## (Neo)[Vim](https://www.vim.org)

For vim:

- Change `~/.config/nvim` to `~/.vim`
- Change `init.vim` to `vimrc`

### [coc.nvim](https://github.com/neoclide/coc.nvim)

`~/.config/nvim/coc-settings.json`:

```json
{
"languageserver": {
Expand All @@ -22,6 +32,8 @@

### [vim-lsp](https://github.com/prabirshrestha/vim-lsp)

`~/.config/nvim/init.vim`:

```vim
if executable('trans')
augroup lsp
Expand All @@ -37,6 +49,8 @@ endif

## [Neovim](https://neovim.io)

`~/.config/nvim/init.lua`:

```lua
vim.api.nvim_create_autocmd({ "BufEnter" }, {
pattern = { "*.txt" },
Expand All @@ -51,16 +65,45 @@ vim.api.nvim_create_autocmd({ "BufEnter" }, {

## [Emacs](https://www.gnu.org/software/emacs)

```elisp
`~/.emacs.d/init.el`:

```lisp
(make-lsp-client :new-connection
(lsp-stdio-connection
`(,(executable-find "trans" "--lsp")))
:activation-fn (lsp-activate-on "*.txt")
:server-id "translate")))
```

## [Helix](https://helix-editor.com/)

`~/.config/helix/languages.toml`:

```toml
[[language]]
name = "text"
language-servers = [ "translate-shell",]

[language_server.translate-shell]
command = "trans --lsp"
```

## [KaKoune](https://kakoune.org/)

### [kak-lsp](https://github.com/kak-lsp/kak-lsp)

`~/.config/kak-lsp/kak-lsp.toml`:

```toml
[language_server.translate-shell]
filetypes = [ "text",]
command = "trans --lsp"
```

## [Sublime](https://www.sublimetext.com)

`~/.config/sublime-text-3/Packages/Preferences.sublime-settings`:

```json
{
"clients": {
Expand All @@ -75,3 +118,18 @@ vim.api.nvim_create_autocmd({ "BufEnter" }, {
}
}
```

## [Visual Studio Code](https://code.visualstudio.com/)

[An official support of generic LSP client is pending](https://github.com/microsoft/vscode/issues/137885).

### [vscode-glspc](https://gitlab.com/ruilvo/vscode-glspc)

`~/.config/Code/User/settings.json`:

```json
{
"glspc.serverPath": "trans --lsp",
"glspc.languageId": "translate"
}
```
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "translate-shell",
"version": "0.0.48",
"version": "0.0.49",
"description": "Translate text by google, bing, youdaozhiyun, haici, stardict, openai, large language model of local machine, etc at same time from CLI, GUI (GNU/Linux, Android, macOS and Windows), REPL, python, shell and vim.",
"author": "Wu Zhenyu <wuzhenyu@ustc.edu>",
"license": "GPLv3",
Expand Down

0 comments on commit 644d76b

Please sign in to comment.