Various changes to neovim, awesome
- Better handling of new terminals - Miscellaneous neovim tweaks
This commit is contained in:
parent
9b360075c9
commit
1f3249a316
4 changed files with 97 additions and 72 deletions
|
@ -7,10 +7,8 @@ run() {
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
# Currently not working
|
/usr/sbin/alacritty --socket "$XDG_RUNTIME_DIR/alacritty-main.sock" --title awesome-startup &
|
||||||
# run "(pgrep alacritty && alacritty msg create-window --title bottom -e btm --battery || alacritty --title bottom -e btm --battery)"
|
/usr/sbin/alacritty --title bottom --option font.size=6.5 --command btm --battery &
|
||||||
/usr/sbin/alacritty --title bottom --command btm --battery &
|
|
||||||
/usr/sbin/alacritty --title awesome-startup &
|
|
||||||
|
|
||||||
run "cbatticon"
|
run "cbatticon"
|
||||||
run "blueman-applet"
|
run "blueman-applet"
|
||||||
|
|
|
@ -54,9 +54,9 @@ beautiful.init(gears.filesystem.get_configuration_dir() .. "mytheme.lua")
|
||||||
terminal = function()
|
terminal = function()
|
||||||
local is_running = os.execute("pgrep alacritty")
|
local is_running = os.execute("pgrep alacritty")
|
||||||
if is_running == nil then
|
if is_running == nil then
|
||||||
return "/usr/sbin/alacritty"
|
return "/usr/sbin/alacritty --socket /run/user/1000/alacritty-main.sock"
|
||||||
else
|
else
|
||||||
return "/usr/sbin/alacritty msg create-window"
|
return "/usr/sbin/alacritty msg --socket /run/user/1000/alacritty-main.sock create-window"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
editor = os.getenv("EDITOR") or "nano"
|
editor = os.getenv("EDITOR") or "nano"
|
||||||
|
|
|
@ -1,7 +1,8 @@
|
||||||
-- Minimal init.lua to test out nvim-dap (for Node.js, really NestJS)
|
local js_based_languages = { "javascript", "typescript" }
|
||||||
|
|
||||||
-- lazy.nvim
|
-- lazy.nvim
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
vim.fn.system({
|
vim.fn.system({
|
||||||
"git",
|
"git",
|
||||||
|
@ -14,12 +15,15 @@ if not vim.loop.fs_stat(lazypath) then
|
||||||
end
|
end
|
||||||
vim.opt.rtp:prepend(lazypath)
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
local js_based_languages = { "javascript", "typescript" }
|
|
||||||
|
|
||||||
require("lazy").setup({
|
require("lazy").setup({
|
||||||
{ "rcarriga/nvim-dap-ui", requires = "mfussenegger/nvim-dap" },
|
{
|
||||||
|
"rcarriga/nvim-dap-ui",
|
||||||
|
event = "VeryLazy",
|
||||||
|
requires = "mfussenegger/nvim-dap"
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"mfussenegger/nvim-dap",
|
"mfussenegger/nvim-dap",
|
||||||
|
event = "VeryLazy",
|
||||||
config = function()
|
config = function()
|
||||||
local dap = require("dap")
|
local dap = require("dap")
|
||||||
|
|
||||||
|
@ -91,20 +95,6 @@ require("lazy").setup({
|
||||||
end
|
end
|
||||||
end,
|
end,
|
||||||
keys = {
|
keys = {
|
||||||
{
|
|
||||||
"<leader>dO",
|
|
||||||
function()
|
|
||||||
require("dap").step_out()
|
|
||||||
end,
|
|
||||||
desc = "Step Out",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"<leader>do",
|
|
||||||
function()
|
|
||||||
require("dap").step_over()
|
|
||||||
end,
|
|
||||||
desc = "Step Over",
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
"<leader>da",
|
"<leader>da",
|
||||||
function()
|
function()
|
||||||
|
@ -118,7 +108,7 @@ require("lazy").setup({
|
||||||
end
|
end
|
||||||
require("dap").continue()
|
require("dap").continue()
|
||||||
end,
|
end,
|
||||||
desc = "Run with Args",
|
desc = "DAP: Run with Args",
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
dependencies = {
|
dependencies = {
|
||||||
|
@ -170,9 +160,9 @@ require("lazy").setup({
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
"leoluz/nvim-dap-go",
|
{ "leoluz/nvim-dap-go", event = "VeryLazy" },
|
||||||
"williamboman/mason.nvim",
|
{ "williamboman/mason.nvim", event = "VeryLazy" },
|
||||||
"williamboman/mason-lspconfig.nvim",
|
{ "williamboman/mason-lspconfig.nvim", event = "VeryLazy" },
|
||||||
})
|
})
|
||||||
|
|
||||||
--[[ mason
|
--[[ mason
|
||||||
|
@ -183,43 +173,21 @@ integration.
|
||||||
require('mason').setup()
|
require('mason').setup()
|
||||||
require('mason-lspconfig').setup()
|
require('mason-lspconfig').setup()
|
||||||
|
|
||||||
-- setup adapters
|
|
||||||
--[[
|
|
||||||
require('dap-vscode-js').setup({
|
|
||||||
node_path = 'node',
|
|
||||||
debugger_path = vim.fn.stdpath('data') .. '/mason/packages/js-debug-adapter',
|
|
||||||
debugger_cmd = { 'js-debug-adapter' },
|
|
||||||
adapters = { 'pwa-node', 'pwa-chrome', 'pwa-msedge', 'node-terminal', 'pwa-extensionHost' },
|
|
||||||
log_file_path = vim.fn.stdpath('cache') .. '/dap_vscode_js.log',
|
|
||||||
log_file_level = 1,
|
|
||||||
log_console_level = vim.log.levels.TRACE,
|
|
||||||
})
|
|
||||||
|
|
||||||
|
|
||||||
local dap = require('dap')
|
|
||||||
for _, language in ipairs({ "typescript", "javascript" }) do
|
|
||||||
dap.configurations[language] = {
|
|
||||||
{
|
|
||||||
type = "pwa-node",
|
|
||||||
request = "launch",
|
|
||||||
name = "Launch file",
|
|
||||||
program = "${file}",
|
|
||||||
cwd = "${workspaceFolder}",
|
|
||||||
},
|
|
||||||
{
|
|
||||||
type = "pwa-node",
|
|
||||||
request = "launch",
|
|
||||||
name = "Debug Nest Framework",
|
|
||||||
args = { "${workspaceFolder}/src/main.ts" },
|
|
||||||
runtimeArgs = { "--nolazy", "-r", "ts-node/register" },
|
|
||||||
sourceMaps = true,
|
|
||||||
cwd = "${workspaceRoot}",
|
|
||||||
protocol = "inspector",
|
|
||||||
}
|
|
||||||
}
|
|
||||||
end
|
|
||||||
--]]
|
|
||||||
|
|
||||||
require('dap-go').setup()
|
require('dap-go').setup()
|
||||||
|
|
||||||
require('dapui').setup()
|
local dap, dapui = require("dap"), require("dapui")
|
||||||
|
dapui.setup()
|
||||||
|
|
||||||
|
dap.listeners.after.event_initialized["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
|
||||||
|
|
||||||
|
-- Switch syntax highlighting on
|
||||||
|
vim.cmd("syntax enable")
|
||||||
|
|
|
@ -48,6 +48,7 @@ vim.keymap.set("n", "<c-j>", "<c-w>j", { noremap = true, desc = 'Go to window be
|
||||||
vim.keymap.set("n", "<c-k>", "<c-w>k", { noremap = true, desc = 'Go to window above' })
|
vim.keymap.set("n", "<c-k>", "<c-w>k", { noremap = true, desc = 'Go to window above' })
|
||||||
vim.keymap.set("n", "<c-h>", "<c-w>h", { noremap = true, desc = 'Go to window to the left' })
|
vim.keymap.set("n", "<c-h>", "<c-w>h", { noremap = true, desc = 'Go to window to the left' })
|
||||||
-- N.B. This conflicts with the NetRW directory refresh command. Use the alternative `:e .`.
|
-- N.B. This conflicts with the NetRW directory refresh command. Use the alternative `:e .`.
|
||||||
|
-- TODO: This seems not to work for netrw.
|
||||||
vim.keymap.set("n", "<c-l>", "<c-w>l", { noremap = true, desc = 'Go to window to the right' })
|
vim.keymap.set("n", "<c-l>", "<c-w>l", { noremap = true, desc = 'Go to window to the right' })
|
||||||
|
|
||||||
vim.keymap.set("t", "<c-j>", "<c-\\><c-n><c-w>j", { noremap = true, desc = 'Go to window below' })
|
vim.keymap.set("t", "<c-j>", "<c-\\><c-n><c-w>j", { noremap = true, desc = 'Go to window below' })
|
||||||
|
@ -67,6 +68,16 @@ vim.keymap.set(
|
||||||
{ desc = "Revert window layout" }
|
{ desc = "Revert window layout" }
|
||||||
)
|
)
|
||||||
|
|
||||||
|
local terminalgroup = vim.api.nvim_create_augroup("TerminalGroup", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd(
|
||||||
|
{"TermOpen", "TermEnter"},
|
||||||
|
{
|
||||||
|
group = terminalgroup,
|
||||||
|
pattern = "*",
|
||||||
|
command = "set nonumber"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
-- lazy.nvim
|
-- lazy.nvim
|
||||||
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
if not vim.loop.fs_stat(lazypath) then
|
if not vim.loop.fs_stat(lazypath) then
|
||||||
|
@ -128,10 +139,10 @@ require("lazy").setup({
|
||||||
opts = {},
|
opts = {},
|
||||||
config = function(_, opts) require'lsp_signature'.setup(opts) end
|
config = function(_, opts) require'lsp_signature'.setup(opts) end
|
||||||
},
|
},
|
||||||
|
{ "folke/neodev.nvim", opts = {} },
|
||||||
{
|
{
|
||||||
"rcarriga/nvim-dap-ui",
|
"rcarriga/nvim-dap-ui",
|
||||||
event = "VeryLazy",
|
dependencies = { "mfussenegger/nvim-dap", "nvim-neotest/nvim-nio" },
|
||||||
requires = "mfussenegger/nvim-dap"
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"mfussenegger/nvim-dap",
|
"mfussenegger/nvim-dap",
|
||||||
|
@ -484,6 +495,14 @@ lspconfig.rust_analyzer.setup {
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
-- Enable (broadcasting) snippet capability for completion
|
||||||
|
local capabilities_html = vim.lsp.protocol.make_client_capabilities()
|
||||||
|
capabilities_html.textDocument.completion.completionItem.snippetSupport = true
|
||||||
|
|
||||||
|
require'lspconfig'.html.setup {
|
||||||
|
capabilities = capabilities_html,
|
||||||
|
}
|
||||||
|
|
||||||
-- Global mappings : Diagnostics
|
-- Global mappings : Diagnostics
|
||||||
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
-- See `:help vim.diagnostic.*` for documentation on any of the below functions
|
||||||
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, { desc = 'Diagnostic: open float' })
|
vim.keymap.set('n', '<space>e', vim.diagnostic.open_float, { desc = 'Diagnostic: open float' })
|
||||||
|
@ -668,6 +687,46 @@ dap.listeners.before.event_exited["dapui_config"] = function()
|
||||||
dapui.close()
|
dapui.close()
|
||||||
end
|
end
|
||||||
|
|
||||||
|
-- Handlebars: One way to get syntax highlighting in Handlebars files
|
||||||
|
--[[
|
||||||
|
local syntax_highlighting_tweaks = vim.api.nvim_create_augroup("SyntaxHighlightingTweaks", { clear = true })
|
||||||
|
vim.api.nvim_create_autocmd(
|
||||||
|
{ "BufRead", "BufNewFile" },
|
||||||
|
{
|
||||||
|
group = syntax_highlighting_tweaks,
|
||||||
|
pattern = "*.hbs",
|
||||||
|
command = "set filetype=html"
|
||||||
|
}
|
||||||
|
)
|
||||||
|
--]]
|
||||||
|
|
||||||
|
-- Treesitter
|
||||||
|
require('nvim-treesitter.configs').setup({
|
||||||
|
modules = {},
|
||||||
|
highlight = {
|
||||||
|
enable = true,
|
||||||
|
loaded = true,
|
||||||
|
module_path = "nvim-treesitter.highlight",
|
||||||
|
additional_vim_regex_highlighting = true,
|
||||||
|
},
|
||||||
|
indent = {
|
||||||
|
enable = true,
|
||||||
|
module_path = "nvim-treesitter.indent",
|
||||||
|
},
|
||||||
|
ensure_installed = { "bash", "comment", "html", "javascript", "json", "lua", "typescript", "yaml" },
|
||||||
|
sync_install = false,
|
||||||
|
auto_install = false,
|
||||||
|
ignore_install = {},
|
||||||
|
})
|
||||||
|
|
||||||
|
vim.treesitter.language.register("html", "handlebars")
|
||||||
|
|
||||||
|
-- Neodev
|
||||||
|
require("neodev").setup({
|
||||||
|
library = { plugins = { "nvim-dap-ui" }, types = true },
|
||||||
|
...
|
||||||
|
})
|
||||||
|
|
||||||
-- Tweak GitSigns blame color
|
-- Tweak GitSigns blame color
|
||||||
-- This differentiates the cursorline from the git blame text
|
-- This differentiates the cursorline from the git blame text
|
||||||
vim.cmd("highlight GitSignsCurrentLineBlame gui=bold guifg=#339944")
|
vim.cmd("highlight GitSignsCurrentLineBlame gui=bold guifg=#339944")
|
||||||
|
|
Loading…
Reference in a new issue