Skip to content

Commit

Permalink
chore: moooooore cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
folke committed May 29, 2024
1 parent 917ae98 commit 3c1f90b
Show file tree
Hide file tree
Showing 11 changed files with 64 additions and 375 deletions.
38 changes: 5 additions & 33 deletions nvim/lua/config/autocmds.lua
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
-- show cursor line only in active window
vim.api.nvim_create_autocmd({ "InsertLeave", "WinEnter" }, {
callback = function()
local ok, cl = pcall(vim.api.nvim_win_get_var, 0, "auto-cursorline")
if ok and cl then
if vim.w.auto_cursorline then
vim.wo.cursorline = true
vim.api.nvim_win_del_var(0, "auto-cursorline")
vim.w.auto_cursorline = nil
end
end,
})
vim.api.nvim_create_autocmd({ "InsertEnter", "WinLeave" }, {
callback = function()
local cl = vim.wo.cursorline
if cl then
vim.api.nvim_win_set_var(0, "auto-cursorline", cl)
if vim.wo.cursorline then
vim.w.auto_cursorline = true
vim.wo.cursorline = false
end
end,
})

-- create directories when needed, when saving a file
-- backups
vim.api.nvim_create_autocmd("BufWritePre", {
group = vim.api.nvim_create_augroup("better_backup", { clear = true }),
callback = function(event)
Expand All @@ -33,31 +31,5 @@ vim.filetype.add({
extension = {
overlay = "dts",
keymap = "dts",
-- conf = "dosini",
},
})

vim.api.nvim_create_autocmd("FileType", {
callback = function()
local commentstrings = {
dts = "// %s",
}
local ft = vim.bo.filetype
if commentstrings[ft] then
vim.bo.commentstring = commentstrings[ft]
end
end,
})

-- Work-around for https://github.com/mutagen-io/mutagen/issues/163
vim.api.nvim_create_autocmd("BufWritePost", {
callback = function()
local file = vim.api.nvim_buf_get_name(0)
if file:find("pyscript") then
file = file:gsub(".*nodes/ha/", "")
vim.defer_fn(function()
vim.fn.system(("ssh root@10.0.0.4 touch /config/%s"):format(file))
end, 2000)
end
end,
})
36 changes: 1 addition & 35 deletions nvim/lua/config/keymaps.lua
Original file line number Diff line number Diff line change
@@ -1,41 +1,7 @@
local util = require("util")

util.cowboy()

local nav = {
h = "Left",
j = "Down",
k = "Up",
l = "Right",
}

local function navigate(dir)
return function()
local win = vim.api.nvim_get_current_win()
vim.cmd.wincmd(dir)
local pane = vim.env.WEZTERM_PANE
if vim.system and pane and win == vim.api.nvim_get_current_win() then
local pane_dir = nav[dir]
vim.system({ "wezterm", "cli", "activate-pane-direction", pane_dir }, { text = true }, function(p)
if p.code ~= 0 then
vim.notify(
"Failed to move to pane " .. pane_dir .. "\n" .. p.stderr,
vim.log.levels.ERROR,
{ title = "Wezterm" }
)
end
end)
end
end
end

util.set_user_var("IS_NVIM", true)

-- Move to window using the movement keys
for key, dir in pairs(nav) do
vim.keymap.set("n", "<" .. dir .. ">", navigate(key))
vim.keymap.set("n", "<C-" .. key .. ">", navigate(key))
end
util.wezterm()

-- change word with <c-c>
vim.keymap.set("n", "<C-c>", "<cmd>normal! ciw<cr>a")
12 changes: 5 additions & 7 deletions nvim/lua/config/options.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
vim.g.mapleader = " "

if vim.fn.has("nvim-0.8") == 1 then
vim.opt.backup = true
vim.opt.cmdheight = 0
vim.opt.backupdir = vim.fn.stdpath("state") .. "/backup"
end
vim.opt.backup = true
vim.opt.cmdheight = 0
vim.opt.backupdir = vim.fn.stdpath("state") .. "/backup"
vim.opt.mousescroll = "ver:2,hor:6"

if vim.g.neovide then
vim.o.guifont = "Fira Code,Symbols Nerd Font Mono:h34"
vim.g.neovide_scale_factor = 0.3
end

vim.opt.mousescroll = "ver:2,hor:6"

-- vim.g.node_host_prog = "/Users/folke/.pnpm-global/5/node_modules/neovim/bin/cli.js"
vim.g.loaded_python3_provider = 0
vim.g.loaded_perl_provider = 0
Expand All @@ -30,6 +27,7 @@ end

vim.g.lazyvim_python_lsp = "basedpyright"
vim.g.lazyvim_python_ruff = "ruff"

if vim.fn.has("win32") == 1 then
LazyVim.terminal.setup("pwsh")
end
16 changes: 16 additions & 0 deletions nvim/lua/plugins/coding.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
return {
{
"folke/ts-comments.nvim",
opts = {
langs = {
dts = "// %s",
},
},
},
{
"zbirenbaum/copilot.lua",
opts = {
Expand All @@ -17,4 +25,12 @@ return {
},
opts = { use_default_keymaps = false, max_join_length = 150 },
},
{ "nvim-neotest/neotest-plenary" },
{ "marilari88/neotest-vitest" },
{
"nvim-neotest/neotest",
opts = { adapters = { ["neotest-plenary"] = {
min_init = "./tests/init.lua",
}, "neotest-vitest" } },
},
}
13 changes: 0 additions & 13 deletions nvim/lua/plugins/lsp.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,6 @@ return {
},
---@type lspconfig.options
servers = {
ansiblels = {},
bashls = {},
clangd = {},
-- denols = {},
cssls = {},
dockerls = {},
-- ruff_lsp = {},
tailwindcss = {
root_dir = function(...)
return require("lspconfig.util").root_pattern(".git")(...)
end,
},
html = {},
lua_ls = {
single_file_support = true,
settings = {
Expand Down
10 changes: 0 additions & 10 deletions nvim/lua/plugins/test.lua

This file was deleted.

83 changes: 0 additions & 83 deletions nvim/lua/util/dashboard/config.lua

This file was deleted.

Loading

0 comments on commit 3c1f90b

Please sign in to comment.