Skip to content

Commit

Permalink
feat: update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
TwIStOy committed Mar 9, 2024
1 parent 4332aa4 commit c271b54
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 51 deletions.
131 changes: 113 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,127 @@

![](https://raw.githubusercontent.com/TwIStOy/dotvim/master/screenshots/start_page.png)

## Prerequisites
# ✨Features

- [Nerd Fonts](https://www.nerdfonts.com/font-downloads)
- [Neovim 0.9+ (nightly is better)](https://github.com/neovim/neovim)
- Terminal with true color and graphic protocol support, recommand [Kitty](https://sw.kovidgoyal.net/kitty/binary/)
- [node.js](https://nodejs.org/en)
- `luarocks` and [lgi](https://github.com/lgi-devs/lgi)
- (Optional) [rime_ls](https://github.com/wlh320/rime-ls): [RIME](https://github.com/rime) as [LSP](https://microsoft.github.io/language-server-protocol/specifications/specification-current)
- Optional Requirements:
- [ripgrep](https://github.com/BurntSushi/ripgrep)
- [fd](https://github.com/sharkdp/fd)
- [delta](https://github.com/dandavison/delta)
- [bat](https://github.com/sharkdp/bat)
- Blazing fast startup time with [lazy.nvim](https://github.com/folke/lazy.nvim)
- Language Server Protocol with [nvim-lspconfig](https://github.com/neovim/nvim-lspconfig)
- Resolving plugins installed by [nix](https://github.com/NixOS/nixpkgs)
- Resolving lsp servers and formatters from [nix](https://github.com/NixOS/nixpkgs) or [mason.nvim](https://github.com/williamboman/mason.nvim)
- Autocompletion with [nvim-cmp](https://github.com/hrsh7th/nvim-cmp)
- Formatting with [conform.nvim](https://github.com/stevearc/conform.nvim)
- Treesitter related snippets with [LuaSnip](https://github.com/L3MON4D3/LuaSnip) and [luasnip-snipepts](https://github.com/TwIStOy/luasnip-snippets)
- Fuzzy find with [telescope.nvim](https://github.com/nvim-telescope/telescope.nvim) and [fzf-lua](https://github.com/ibhagwan/fzf-lua)

## Features
> [!CAUTION]
> **Please use my configuration with care and understand what will happen before using it. If you are looking for a more general configuration, see [dora.nvim](https://github.com/TwIStOy/dora.nvim)**
- Lsp hover using Kitty's image protocol ![](https://raw.githubusercontent.com/TwIStOy/dotvim/master/screenshots/floating-hover.png)
# ⚡️Requirements

## Installation
1. [Neovim 0.9+ (nightly is better)](https://github.com/neovim/neovim)
1. Nerd Fonts
- Any nerd font to show glyph correctly.
- Or using font fallback([kitty](https://sw.kovidgoyal.net/kitty/conf/#opt-kitty.symbol_map), [wezterm](https://wezfurlong.org/wezterm/config/lua/wezterm/font_with_fallback.html)) if terminal supports that.
1. Node
- Needed by [copilot.lua](https://github.com/zbirenbaum/copilot.lua)
1. Terminal with true color and graphic protocol support, recommand [Kitty](https://sw.kovidgoyal.net/kitty/binary/)
1. (Optional) [rime_ls](https://github.com/wlh320/rime-ls): [RIME](https://github.com/rime) as [LSP](https://microsoft.github.io/language-server-protocol/specifications/specification-current)
1. Optional Requirements
- [ripgrep](https://github.com/BurntSushi/ripgrep)
- [fd](https://github.com/sharkdp/fd)
- [delta](https://github.com/dandavison/delta)
- [bat](https://github.com/sharkdp/bat)


# 📦Installation

## Non-nix

```
$ ln -s /path/to/dotvim ~/.dotvim
$ mkdir -p ~/.config/nvim
$ cp ~/.dotvim/init.lua ~/.config/nvim/init.lua
$ cd ~/.dotvim/ && npm install && npm build
```

- Update `vim.g.python3_host_prog = '/usr/local/bin/python3'` in `~/.config/nvim/init.lua` to the result of `which python3`.
- Update `vim.g.rime_ls_cmd` to where you installed [rime_ls](https://github.com/wlh320/rime-ls).
## Nix

```nix
{
config,
lib,
pkgs,
pkgs-unstable,
nur-hawtian,
...
}: let
user-dotpath = "${config.home.homeDirectory}/.dotvim";
plugins = {
inherit (nur-hawtian.packages.${pkgs.system}.vimPlugins) gh-actions-nvim;
inherit (pkgs-unstable.vimPlugins) telescope-fzf-native-nvim;
inherit (pkgs-unstable.vimPlugins) markdown-preview-nvim;
};
bins = with pkgs-unstable; {
inherit fzf stylua lua-language-server statix;
clangd = llvmPackages_17.clang-unwrapped;
clang-format = llvmPackages_17.clang-unwrapped;
inherit (python312Packages) black;
inherit (pkgs) rust-analyzer rustfmt;
};
nixAwareNvimConfig = pkgs.stdenv.mkDerivation {
name = "nix-aware-nvim-config";
buildInputs =
(lib.mapAttrsToList (_: pkg: pkg) plugins)
++ (lib.mapAttrsToList (_: pkg: pkg) bins);
phases = ["installPhase"];
nixAwareNvimConfigJson =
pkgs.writeText
"nixAwareNvimConfig.json"
(builtins.toJSON {
pkgs = plugins;
bin = lib.mapAttrs (name: pkg: "${pkg}/bin/${name}") bins;
try_nix_only = true;
});
installPhase = ''
mkdir -p $out
cp $nixAwareNvimConfigJson $out/nix-aware.json
'';
};
init-dora = ''
vim.loader.enable()
local dotpath = "${user-dotpath}"
vim.opt.rtp:prepend(dotpath)
require("dotvim").setup()
'';
in {
home.packages = with pkgs; [
python3.pkgs.pynvim
nodePackages.neovim
tree-sitter
nixAwareNvimConfig
];
programs.neovim = {
enable = true;
package = pkgs.neovim-nightly;
plugins = builtins.attrValues plugins;
};
xdg.configFile = {
"nvim/init.lua" = {
text = init-dora;
force = true;
};
"nvim/nix-aware.json" = {
source = "${nixAwareNvimConfig}/nix-aware.json";
force = true;
};
};
}
```
37 changes: 4 additions & 33 deletions init.lua
Original file line number Diff line number Diff line change
@@ -1,33 +1,4 @@
vim.api.nvim_command([[set runtimepath+=$HOME/.dotvim]])

-- Update this
vim.g.python3_host_prog = "/usr/bin/python3"

-- Update this
vim.g.compiled_llvm_clang_directory = "/home/hawtian/project/llvm/build"

-- Update this
vim.g.lua_language_server_cmd = {
"/home/hawtian/project/lua-language-server/bin/lua-language-server",
"-E",
"/home/hawtian/project/lua-language-server/bin/main.lua",
}

-- Add luarocks path
package.path = package.path
.. ";"
.. vim.fn.expand("$HOME")
.. "/.luarocks/share/lua/5.1/?/init.lua;"
package.path = package.path
.. ";"
.. vim.fn.expand("$HOME")
.. "/.luarocks/share/lua/5.1/?.lua;"
package.cpath = package.cpath
.. ";"
.. vim.fn.expand("$HOME")
.. "/.luarocks/lib/lua/5.1/?.so;"

-- Update this
vim.g.rime_ls_cmd = { "/home/hawtian/project/rime-ls/target/release/rime_ls" }

require("ht.init")
vim.loader.enable()
local dotpath = "/Users/hawtian/.dotvim"
vim.opt.rtp:prepend(dotpath)
require("dotvim").setup()

0 comments on commit c271b54

Please sign in to comment.