Skip to content

Commit

Permalink
feat(nvim): vue support
Browse files Browse the repository at this point in the history
  • Loading branch information
tmm committed May 9, 2024
1 parent 6a0e91d commit c0a6941
Show file tree
Hide file tree
Showing 9 changed files with 52 additions and 28 deletions.
16 changes: 8 additions & 8 deletions .config/nix/files/fish/functions/change_appearance.fish
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ function change_appearance --argument appearance_setting
end

# change neovim
for addr in (ls $(echo $TMPDIR)nvim.$(echo $USER)/*/nvim.*.0)
switch $appearance
case dark
nvim --server $addr --remote-send ':set background=dark<CR>'
case light
nvim --server $addr --remote-send ':set background=light<CR>'
end
end
# for addr in (ls $(echo $TMPDIR)nvim.$(echo $USER)/*/nvim.*.0)
# switch $appearance
# case dark
# nvim --server $addr --remote-send ':set background=dark<CR>'
# case light
# nvim --server $addr --remote-send ':set background=light<CR>'
# end
# end

# change and reload ghostty appearance
# https://github.com/mitchellh/ghostty/issues/601
Expand Down
2 changes: 1 addition & 1 deletion .config/nix/modules/colors.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
dark = {
background = "#1D1D1B";
background = "#1A1A19";
foreground = "#ffffff";
cursor = "#F76EC9";

Expand Down
2 changes: 2 additions & 0 deletions .config/nix/modules/darwin.nix
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@
"1password"
"1password-cli"
"betterdisplay"
"brave-browser"
"cleanshot"
"contexts"
"daisydisk"
"dropbox"
"postico"
"firefox"
"flux"
"google-chrome"
Expand Down
1 change: 1 addition & 0 deletions .config/nix/modules/ghostty.nix
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ in
macos-non-native-fullscreen = true
macos-option-as-alt = left
mouse-hide-while-typing = true
macos-titlebar-tabs = true
unfocused-split-opacity = 1
window-padding-x = 0
window-padding-y = 0
Expand Down
2 changes: 2 additions & 0 deletions .config/nix/modules/home-manager.nix
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{ pkgs, ... }: {
home.packages = with pkgs; [
amber
asciinema
babelfish
bat
cachix
Expand All @@ -11,6 +12,7 @@
erlang
eza
fd
flyctl
fnm
fzf
gh
Expand Down
4 changes: 2 additions & 2 deletions .config/nix/modules/shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
hide = "defaults write com.apple.finder AppleShowAllFiles -bool false && killall Finder";
show = "defaults write com.apple.finder AppleShowAllFiles -bool true && killall Finder";

nconf = "nvim ~/.config/nix/flake.nix";
vconf = "nvim ~/.config/nvim/init.lua";
nconf = "pushd . && cd ~ && nvim ~/.config/nix/flake.nix";
vconf = "pushd . && cd ~ && nvim ~/.config/nvim/init.lua";
drs = "darwin-rebuild switch --flake ~/.config/nix/";

hidedesktop = "defaults write com.apple.finder CreateDesktop -bool false && killall Finder";
Expand Down
2 changes: 1 addition & 1 deletion .config/nvim/TODO.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# TODO

neotree current file bg color
indent text object
nix
noice popupmenu background

Expand Down
50 changes: 34 additions & 16 deletions .config/nvim/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1037,11 +1037,19 @@ require("lazy").setup({
"lua_ls",
"rnix",
"tsserver",
"volar",
},
automatic_installation = true,
})

local vue_typescript_plugin = mr.get_package("vue-language-server"):get_install_path()

This comment has been minimized.

Copy link
@tmm
.. "/node_modules/@vue/language-server"
.. "/node_modules/@vue/typescript-plugin"

local servers = {
biome = {
settings = {},
},
elixirls = {
settings = {
-- https://github.com/elixir-lsp/elixir-ls#elixirls-configuration-settings
Expand Down Expand Up @@ -1079,9 +1087,6 @@ require("lazy").setup({
rnix = {
settings = {},
},
biome = {
settings = {},
},
rust_analyzer = {
settings = {
["rust-analyzer"] = {
Expand All @@ -1100,6 +1105,25 @@ require("lazy").setup({
},
},
tsserver = {
filetypes = {
"javascript",
"javascriptreact",
"javascript.jsx",
"typescript",
"typescriptreact",
"typescript.tsx",
"vue",
},
init_options = {
plugins = {
-- Use typescript language server along with vue typescript plugin
{
name = "@vue/typescript-plugin",
location = vue_typescript_plugin,
languages = { "javascript", "typescript", "vue" },
},
},
},
settings = {
typescript = {
inlayHints = {
Expand All @@ -1114,6 +1138,7 @@ require("lazy").setup({
},
},
},
volar = {},
}

local signs = icons.diagnostics
Expand Down Expand Up @@ -1154,9 +1179,10 @@ require("lazy").setup({
debounce = 150,
save_after_format = false,
sources = {
nls.builtins.diagnostics.fish,
nls.builtins.formatting.biome,
nls.builtins.formatting.stylua,
nls.builtins.formatting.fish_indent,
nls.builtins.formatting.stylua,
},
on_attach = on_attach,
})
Expand All @@ -1176,12 +1202,8 @@ require("lazy").setup({
},
},
opts = {
autopairs = {
enable = true,
},
autotag = {
enable = true,
},
autopairs = { enable = true },
autotag = { enable = true },
ensure_installed = {
"bash",
"c",
Expand All @@ -1208,12 +1230,8 @@ require("lazy").setup({
"vimdoc",
"vue",
},
highlight = {
enable = true,
},
indent = {
enable = false,
},
highlight = { enable = true },
indent = { enable = false },
},
config = function(_, opts)
require("nvim-treesitter.configs").setup(opts)
Expand Down
1 change: 1 addition & 0 deletions .config/nvim/lazy-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
"nvim-cmp": { "branch": "main", "commit": "538e37ba87284942c1d76ed38dd497e54e65b891" },
"nvim-lastplace": { "branch": "main", "commit": "0bb6103c506315044872e0f84b1f736c4172bb20" },
"nvim-treesitter": { "branch": "master", "commit": "4a4dbe1cb1da34d87fc42a40aaf8e218af4cfe0f" },
"nvim-treesitter-textobjects": { "branch": "master", "commit": "19a91a38b02c1c28c14e0ba468d20ae1423c39b2" },
"nvim-ts-autotag": { "branch": "main", "commit": "8515e48a277a2f4947d91004d9aa92c29fdc5e18" },
"nvim-ts-context-commentstring": { "branch": "main", "commit": "1277b4a1f451b0f18c0790e1a7f12e1e5fdebfee" },
"nvim-ufo": { "branch": "main", "commit": "b0741a647efd98d9abb6cb653e056d24a07e4581" },
Expand Down

0 comments on commit c0a6941

Please sign in to comment.