From d342a06fbe2164c0610ffcf4ab4ae2ea8c2e4e00 Mon Sep 17 00:00:00 2001 From: Yusaku Mandai Date: Thu, 26 Dec 2024 13:51:29 +0900 Subject: [PATCH 1/2] nvim: fix/add some plugins * adds im-select * adds telescope-tabs * fixes tsserver lsp settings * fixes copilot chat barnch and adds a key bind --- nvim/init.lua | 2 ++ nvim/lua/plugins.lua | 36 ++++++++++++++++++++++++++++++++++-- 2 files changed, 36 insertions(+), 2 deletions(-) diff --git a/nvim/init.lua b/nvim/init.lua index 14ee989..42bb389 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -224,6 +224,8 @@ vim.keymap.set("n", "vs", function() return ":vsplit " .. vim.fn.expand("%:p:h") .. "/" end, { expr = true }) +-- Enable editorconfig +vim.g.editorconfig = true -- Disable python2 support. vim.g.loaded_python_provider = 0 diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index 5665316..e511a7c 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -9,6 +9,15 @@ return { end, }, + { + "keaising/im-select.nvim", + config = function() + require("im_select").setup({ + default_im_select = "com.apple.keylayout.ABC", + }) + end, + }, + -- Lua library for nvim. { "nvim-lua/plenary.nvim" }, @@ -89,7 +98,7 @@ return { if vim.fn.executable("tsserver") ~= 0 then print("LspSetup: setting up for tsserver") - lspconfig.tsserver.setup(opts) + lspconfig.ts_ls.setup(opts) end if vim.fn.executable("lua-language-server") ~= 0 then @@ -169,14 +178,21 @@ return { -- Copilot chat. { "CopilotC-Nvim/CopilotChat.nvim", - branch = "canary", + branch = "main", dependencies = { { "github/copilot.vim" }, -- or github/copilot.vim { "nvim-lua/plenary.nvim" }, -- for curl, log wrapper }, + build = "make tiktoken", opts = { debug = true, + window = { + layout = "float", + }, }, + init = function() + vim.keymap.set("n", "cc", ":CopilotChatToggle", { silent = true }) + end, }, -- A fuzzy finder. @@ -218,6 +234,22 @@ return { end, }, + { + "LukasPietzschmann/telescope-tabs", + config = function() + require("telescope").load_extension("telescope-tabs") + require("telescope-tabs").setup({ + vim.api.nvim_set_keymap( + "n", + "ft", + ":Telescope telescope-tabs list_tabs", + { noremap = true, silent = true } + ), + }) + end, + dependencies = { "nvim-telescope/telescope.nvim" }, + }, + -- Handles extra whitespaces. { "ntpeters/vim-better-whitespace", From ba3b3b06a6c5b3790e55d07c65821e0b3b73174b Mon Sep 17 00:00:00 2001 From: Yusaku Mandai Date: Thu, 26 Dec 2024 14:09:58 +0900 Subject: [PATCH 2/2] misc: settings for WezTerm * make neovim window transparent * tmux settings --- README.md | 12 ++++++------ nvim/init.lua | 18 +++++++++++++++--- nvim/lua/plugins.lua | 9 +++++++++ tmux/tmux.conf | 2 ++ 4 files changed, 32 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ea66e1b..b713528 100644 --- a/README.md +++ b/README.md @@ -15,6 +15,7 @@ | neovim | | | ripgrep | | | tmux | | +| [macOS Input Source Manager][macism] | | ``` @@ -57,11 +58,10 @@ Then reload ``.tmux.conf`` (``bind + shift + I`` in tmux) and the plugins specif [brew]:https://brew.sh/index [fisher]:https://github.com/jorgebucaran/fisher +[macism]:https://github.com/laishulu/macism -## Environment variables +### Environment Variables -This repository assumes that the following environment variables are set. - -| Environemnt variable | Note | -|----------------------|------| -| MANDAIY_ORG_NOTE_DIR | Directory where org-note repository resides | +| Variable | Description | +|----------|-------------| +| `NVIM_PYTHON_PATH` | Path to Python interpreter to be used in neovim | diff --git a/nvim/init.lua b/nvim/init.lua index 42bb389..b758a83 100644 --- a/nvim/init.lua +++ b/nvim/init.lua @@ -130,6 +130,10 @@ vim.opt.wildmode = "list:full" -- Command completion vim.opt.wrap = false vim.opt.writebackup = false +vim.opt.termguicolors = true +vim.opt.winblend = 0 +vim.opt.pumblend = 0 + -- %<: truncation position -- %n: buffer number, %m: modified? -- %r: RO?, %h: help buffer? @@ -226,14 +230,22 @@ end, { expr = true }) -- Enable editorconfig vim.g.editorconfig = true + -- Disable python2 support. vim.g.loaded_python_provider = 0 -if vim.fn.isdirectory(vim.env.XDG_CONFIG_HOME .. "/nvim/venv/") then - vim.g.python3_host_prog = vim.env.XDG_CONFIG_HOME .. "/nvim/venv/bin/python" - vim.g.black_virtualenv = vim.env.XDG_CONFIG_HOME .. "/nvim/venv" +local nvim_python_path = vim.loop.os_getenv("NVIM_PYTHON_PATH") +local XDG_CONFIG_HOME = vim.loop.os_getenv("XDG_CONFIG_HOME") or "" +if nvim_python_path ~= nil then + vim.g.python3_host_prog = nvim_python_path +elseif vim.fn.isdirectory(XDG_CONFIG_HOME .. "/nvim/venv/") then + vim.g.python3_host_prog = XDG_CONFIG_HOME .. "/nvim/venv/bin/python" end +-- Example for configuring Neovim to load user-installed installed Lua rocks: +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;" + -- lazy bootstrap local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" if not vim.loop.fs_stat(lazypath) then diff --git a/nvim/lua/plugins.lua b/nvim/lua/plugins.lua index e511a7c..400956b 100644 --- a/nvim/lua/plugins.lua +++ b/nvim/lua/plugins.lua @@ -4,6 +4,15 @@ return { lazy = false, -- make sure we load this during startup if it is your main colorscheme priority = 1000, -- make sure to load this before all the other start plugins config = function() + require("tokyonight").setup({ + style = "storm", + transparent = true, + styles = { + sidebars = "transparent", + floats = "transparent", + }, + }) + -- load the colorscheme here vim.cmd([[colorscheme tokyonight]]) end, diff --git a/tmux/tmux.conf b/tmux/tmux.conf index fbe4549..2074e0a 100644 --- a/tmux/tmux.conf +++ b/tmux/tmux.conf @@ -56,4 +56,6 @@ set -g @plugin 'seebi/tmux-colors-solarized' set -g @yank_action 'copy-pipe' +set -gq allow-passthrough on + run '$XDG_CONFIG_HOME/tmux/plugins/tpm/tpm'