Terminal Environment

Neovim

https://github.com/jdhao/nvim-config/blob/main/docs/README.md

Install

curl -LO https://github.com/neovim/neovim/releases/latest/download/nvim-linux64.tar.gz
sudo rm -rf /opt/nvim
sudo tar -C /opt -xzf nvim-linux64.tar.gz

Add this to the shell config (~/.bashrc~/. zshrc, …):

export PATH="$PATH:/opt/nvim-linux64/bin"

Set up

Clone .config/nvim from this repository.

Have to install some tools

sudo apt install ripgrep
sudo apt install xclip

Transparency

change the terminal to transparent one

right click on terminal and select “preferences”

check the “use transparent backround” in the color tab

change the colorcheme.lua

return {
	"folke/tokyonight.nvim",
	priority = 1000,
	config = function()
		local transparent = true -- set to true if you would like to enable transparency
		local bg = "#011628"
		local bg_dark = "#011423"
		local bg_highlight = "#143652"
		local bg_search = "#0A64AC"
		local bg_visual = "#275378"
		local fg = "#CBE0F0"
		local fg_dark = "#B4D0E9"
		local fg_gutter = "#627E97"
		local border = "#547998"
		-- Function to apply the colorscheme with the current transparency setting
		local function apply_colorscheme()
			require("tokyonight").setup({
				style = "night",
				transparent = transparent,
				styles = {
					sidebars = transparent and "transparent" or "black",
					floats = transparent and "transparent" or "black",
				},
				on_colors = function(colors)
					colors.bg = bg
					colors.bg_dark = transparent and colors.none or bg_dark
					colors.bg_float = transparent and colors.none or bg_dark
					colors.bg_highlight = bg_highlight
					colors.bg_popup = bg_dark
					colors.bg_search = bg_search
					colors.bg_sidebar = transparent and colors.none or bg_dark
					colors.bg_statusline = transparent and colors.none or bg_dark
					colors.bg_visual = bg_visual
					colors.border = border
					colors.fg = fg
					colors.fg_dark = fg_dark
					colors.fg_float = fg
					colors.fg_gutter = fg_gutter
					colors.fg_sidebar = fg_dark
				end,
			})
			vim.cmd("colorscheme tokyonight")
		end
		-- Apply the colorscheme initially
		apply_colorscheme()
		-- Function to toggle transparency and reapply the colorscheme
		_G.toggle_transparency = function()
			transparent = not transparent
			apply_colorscheme()
		end
		-- Set up a keymap to toggle transparency
		vim.api.nvim_set_keymap(
			"n",
			"<leader><leader>",
			":lua toggle_transparency()<CR>",
			{ noremap = true, silent = true }
		)
	end,
}

Trouble Shooting

Mason Installation Error

If it shows the following error when opening nvim

[mason-lspconfig.nvim] failed to install pyright. Installation logs are available in :Mason and :MasonLog

This may be caused by npm being unavilable

Try this command

sudo apt update
sudo apt install nodejs npm

Debugger

create debugging.lua

return {
	"mfussenegger/nvim-dap",
	dependencies = {
		"rcarriga/nvim-dap-ui",
		"nvim-neotest/nvim-nio",
		"mfussenegger/nvim-dap-python",
		"jay-babu/mason-nvim-dap.nvim",
	},
	config = function()
		local dap = require("dap")
		local dapui = require("dapui")
		dap.adapters = {
			codelldb = {
				type = "server",
				port = "${port}",
				executable = {
					-- Masonはここにデバッガを入れてくれる
					command = vim.fn.stdpath("data") .. "/mason/packages/codelldb/extension/adapter/codelldb",
					-- ポートを自動的に割り振ってくれる
					args = { "--port", "${port}" },
				},
			},
		}
		-- ここにファイルタイプ別の設定
		dap.configurations = {
			cpp = {
				-- 複数指定することもできる
				-- 複数あるとデバッグ開始時にどの設定使うか聞かれる
				{
					-- なくてもいい。複数の設定があるとき、それらを識別するための名前
					name = "Launch file",
					-- dap.adapters にあるデバッガから、どれを使うか
					type = "codelldb",
					-- デバッガ起動する
					request = "launch",
					-- コンパイル時に -g オプションをつけてビルドした実行ファイルを指定する
					-- こんな感じでinputで指定できるようにしておく
					program = function()
						return vim.fn.input("Path to executable: ", vim.fn.getcwd() .. "/a.out", "file")
					end,
					-- よく分からないけど、nvim-dapのWikiに書いてあったので
					cwd = "${workspaceFolder}",
					-- trueだとバイナリのデバッグになっちゃう(なんで?)
					stopOnEntry = false,
				},
			},
		}
		require("dap-python").setup("python")
		dapui.setup()
		dap.listeners.before.attach.dapui_config = function()
			dapui.open()
		end
		dap.listeners.before.launch.dapui_config = function()
			dapui.open()
		end
		dap.listeners.before.event_terminated.dapui_config = function()
			dapui.close()
		end
		dap.listeners.before.event_exited.dapui_config = function()
			dapui.close()
		end
		vim.keymap.set("n", "<Leader>dt", dap.toggle_breakpoint, { desc = "Toggle breakpoint" })
		vim.keymap.set("n", "<Leader>dc", dap.continue, { desc = "Resuming execution" })
		vim.keymap.set("n", "<Leader>do", dap.step_over, { desc = "Step over the code" })
		vim.keymap.set("n", "<Leader>di", dap.step_into, { desc = "Step into the code" })
		vim.keymap.set("n", "<Leader>dq", dap.terminate, { desc = "Terminate debug session" })
	end,
}

Terminal

Oh my zsh

install zsh to the terminal

sudo apt update
sudo apt install zsh

install oh my zsh

sh -c "$(wget https://raw.github.com/ohmyzsh/ohmyzsh/master/tools/install.sh -O -)"

Add path to ~/.zshrc

export PATH=$HOME/bin:$HOME/.local/bin:/usr/local/bin:$PATH
export PATH="$PATH:/opt/nvim-linux64/bin"

Powerlevel10k

Install font from here

Right click on terminal and select “preference”. Then change the font on terminal to the font you just downloaded.

Install powerlevel10k

git clone --depth=1 https://github.com/romkatv/powerlevel10k.git ${ZSH_CUSTOM:-$HOME/.oh-my-zsh/custom}/themes/powerlevel10k

And Set ZSH_THEME="powerlevel10k/powerlevel10k" in ~/.zshrc

Then,

source ~/.zshrc

The configuration terminal would pop up


Comments

コメントを残す

メールアドレスが公開されることはありません。 が付いている欄は必須項目です