irongit

A readme explaining how to make neovim work fast

telescope now focuses on the same level as neotree

huncholanehuncholaneauthored
parent 7005b1fcommit b7739035caced22da2a81637a19a175bad13ea2bBrowse files

3 files changed, +37 -17

+16-16lua/config/autocmds/init.lua
@@ -97,7 +97,23 @@ end, { desc = "Set tab width for current buffer.", nargs = 1 })
9797 -- use comments for fold expression
9898 _G.CommentFoldExpr = function()
9999 local line = vim.fn.getline(vim.v.lnum)
100+ local ft = vim.bo.filetype
100101 local cs = vim.bo.commentstring:gsub("%%s", ""):gsub(" ", ""):gsub("([^%w])", "%%%1")
102+ -- fold python docstrings
103+ if ft == "python" then
104+ if line:match('""".*"""') then
105+ return "="
106+ elseif line:match('"""') then
107+ if _G.in_docstring then
108+ _G.in_docstring = false
109+ return "s1" -- end fold
110+ else
111+ _G.in_docstring = true
112+ return "a1" -- begin fold
113+ end
114+ end
115+ end
116+ -- dynamically fold comments
101117 if line:match("^%s*" .. cs) then
102118 return 1
103119 else
@@ -120,19 +136,3 @@ vim.api.nvim_create_autocmd({ "BufReadPost", "FileType" }, {
120136 vim.opt_local.foldexpr = foldexpr
121137 end,
122138 })
123-
124--- wezterm config target from ~/.bashrc
125-local WEZTERM_CONFIG_TARGET = os.getenv("WEZTERM_CONFIG_TARGET") or vim.fn.expand("~/.wezterm.lua")
126-
127--- update wezterm config wheneverver a file ending in .wezterm.lua
128--- is saved. This uses WEZTERM_TARGET_CONFIG from environment variables
129-vim.api.nvim_create_autocmd("BufWritePost", {
130- group = general,
131- desc = "Copies wezterm.lua to the target on save",
132- pattern = "*wezterm.lua",
133- callback = function()
134- vim.notify("Saved wezterm.lua, copying to " .. WEZTERM_CONFIG_TARGET)
135- local src = vim.fn.expand("%:p")
136- vim.system({ "cp", src, WEZTERM_CONFIG_TARGET })
137- end,
138-})
+15-0lua/config/keymaps/init.lua
@@ -56,3 +56,18 @@ vim.keymap.set("n", "zk", function()
5656 vim.cmd("normal zx")
5757 vim.cmd("normal zM")
5858 end, { desc = "Forcefully fold comments" })
59+
60+-- leader space to neovim directory
61+vim.keymap.set("n", "<leader><Space>", function()
62+ local neotree = require("neo-tree.sources.manager").get_state("filesystem")
63+ local root = neotree.path or vim.fn.getcwd() -- fallback if somehow nil
64+ require("telescope.builtin").find_files({ cwd = root })
65+end, { desc = "Find files from Neo-tree root" })
66+
67+-- live grep for neovim directory instead of
68+-- the entire project
69+vim.keymap.set("n", "<leader>/", function()
70+ local neotree = require("neo-tree.sources.manager").get_state("filesystem")
71+ local root = neotree and neotree.path or vim.fn.getcwd()
72+ require("telescope.builtin").live_grep({ cwd = root })
73+end, { desc = "Live grep Neo-tree root" })
+6-1wezterm.lua
@@ -32,6 +32,9 @@ config.keys = {
3232 -- debug
3333 { key = "d", mods = "CTRL|SHIFT", action = act.ShowDebugOverlay },
3434
35+ -- quit all
36+ { key = "q", mods = "CTRL|SHIFT", action = act.QuitApplication },
37+
3538 -- Show the launcher in fuzzy selection mode and have it list all workspaces
3639 -- and allow activating one.
3740 {
@@ -73,7 +76,7 @@ config.keys = {
7376 {
7477 key = "g",
7578 mods = "CTRL|SHIFT",
76- action = act.SpawnCommandInNewTab({ args = { "lazygit" } }),
79+ action = act.SpawnCommandInNewWindow({ args = { "lazygit" } }),
7780 },
7881 }
7982
@@ -87,4 +90,6 @@ wezterm.on("window-config-reloaded", function(_, _)
8790 wezterm.log_info("Successfully loaded config")
8891 end)
8992
93+require("workspaces")
94+
9095 return config