Compare commits

..
8 Commits
Author SHA1 Message Date
hollorol d1cbed06ee luamason_current_status 2025-12-25 19:45:33 +01:00
hollorol 2baed3ea25 fix update issue 2025-05-24 18:26:31 +02:00
hollorol afbbe29751 latex support 2025-05-17 12:20:01 +02:00
hollorol defc8e2ecd latex support 2025-05-17 12:19:44 +02:00
Roland Hollós 2e52bc9839 transparent neovim - better for my terminal 2025-03-27 18:24:23 +01:00
hollorol 342733a426 add files to the exception for remember marks 2025-03-19 20:32:02 +01:00
hollorol 818850fd22 new telescope functionality and using fzf 2025-03-09 21:11:25 +01:00
hollorol d503e3e346 better_fold 2025-03-09 20:27:36 +01:00
10 changed files with 290 additions and 40 deletions
+5
View File
@@ -18,3 +18,8 @@ snippet it "item"
\item $0
endsnippet
snippet listing "Listing"
\begin{lstlisting}
$0
\end{lstlisting}
endsnippet
+45 -1
View File
@@ -2,4 +2,48 @@ require("config.options")
require("config.keymaps")
require("config.lazy")
require("custom.functions")
-- require("custom.chatgpt")
local viewgroup = vim.api.nvim_create_augroup("RememberFolds", { clear = true })
local allowed_rem_filetypes = {
lua = true,
python = true,
r = true,
bash = true,
c = true,
sql = true,
["c++"] = true, -- in case filetype is "c++"
cpp = true, -- sometimes C++ is "cpp"
java = true,
rust = true,
go = true,
wiki = true,
vimwiki = true,
}
vim.api.nvim_create_autocmd("BufWinLeave", {
group = viewgroup,
pattern = "*",
callback = function()
-- Exclude terminal and Telescope buffers from mkview
local ft = vim.bo.filetype:lower()
if not allowed_rem_filetypes[ft] then
return
end
vim.cmd("mkview")
end,
})
vim.api.nvim_create_autocmd("BufWinEnter", {
group = viewgroup,
pattern = "*",
callback = function()
-- Exclude terminal and Telescope buffers from loadview
local ft = vim.bo.filetype:lower()
if not allowed_rem_filetypes[ft] then
return
end
vim.cmd("silent! loadview")
end,
})
vim.api.nvim_set_hl(0, "Normal", { bg = "none" })
+14 -1
View File
@@ -6,7 +6,7 @@ vim.keymap.set('n','<space><tab>',':b#<CR>', {noremap=true, silent=true})
vim.keymap.set('n', '<leader>cd', ':cd %:p:h<CR>', {noremap=true, silent=true})
vim.api.nvim_set_keymap('n', '<leader>ff', '<cmd>Telescope find_files<cr>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>rg', '<cmd>Telescope live_grep<cr>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>rg', '<cmd>Telescope grep_string search="" only_sort_text=true<cr>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>bb', '<cmd>Telescope buffers<cr>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>fh', '<cmd>Telescope help_tags<cr>', {noremap = true, silent = true})
@@ -20,3 +20,16 @@ vim.keymap.set('n', 'z7', '<cmd>Telescope spell_suggest<cr>', { noremap = true,
vim.keymap.set('n', '<F5>', ':set ignorecase!<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<F6>',':set spell! spelllang=hu<CR>', { noremap = true, silent = true })
vim.keymap.set('n', '<F7>',':set spell! spelllang=en<CR>', { noremap = true, silent = true })
vim.api.nvim_set_keymap(
"n",
"<space>lf",
"<cmd>lua require('custom.fold_telescope').jump_to_fold_starts()<CR>",
{ noremap = true, silent = true }
)
vim.api.nvim_set_keymap(
"n",
"<space>ll",
"<cmd>lua require('custom.line_telescope').jump_to_line()<CR>",
{ noremap = true, silent = true }
)
+1
View File
@@ -1,3 +1,4 @@
vim.opt.termguicolors = true -- True color support
vim.opt.hlsearch = false -- Disable highlighting search matches
vim.opt.hidden = true -- Allow background buffers
vim.opt.cindent = true
+19
View File
@@ -0,0 +1,19 @@
return {
"lervag/vimtex",
lazy = false, -- we don't want to lazy load VimTeX
-- tag = "v2.15", -- uncomment to pin to a specific release
init = function()
vim.g.vimtex_view_method = "zathura"
vim.g.vimtex_compiler_latexmk = {
options = {
"-pdf",
"-shell-escape",
"-verbose",
"-file-line-error",
"-synctex=1",
"-interaction=nonstopmode",
},
}
end
}
+4 -23
View File
@@ -2,6 +2,7 @@ return {
-- Mason for managing external tools (LSP servers, linters, etc.)
{
"williamboman/mason.nvim",
version = "=1.0.1",
config = function()
require("mason").setup()
end
@@ -9,9 +10,11 @@ return {
-- Mason LSP config to bridge Mason and nvim-lspconfig
{
"williamboman/mason-lspconfig.nvim",
version = "=1.0.1",
config = function()
require("mason-lspconfig").setup {
ensure_installed = {"pyright"}
ensure_installed = {"pyright"},
automatic_installation = false, -- Set to true to automatically install servers
}
end
},
@@ -122,28 +125,6 @@ return {
format = lspkind.cmp_format({ with_text = true, maxwidth = 50 })
}
})
--
-- -- Use buffer source for `/` and `?` (if you enabled `native_menu`, this won't work anymore).
-- cmp.setup.cmdline('/', {
-- sources = {
-- { name = 'buffer' }
-- }
-- })
--
-- cmp.setup.cmdline('?', {
-- sources = {
-- { name = 'buffer' }
-- }
-- })
--
-- -- Use cmdline & path source for ':' (if you enabled `native_menu`, this won't work anymore).
-- cmp.setup.cmdline(':', {
-- sources = cmp.config.sources({
-- { name = 'path' }
-- }, {
-- { name = 'cmdline' }
-- })
-- })
require("cmp_r").setup({ })
end
}
+26 -12
View File
@@ -1,19 +1,33 @@
return {
'nvim-telescope/telescope.nvim', tag = '0.1.8',
-- or , branch = '0.1.x',
dependencies = { 'nvim-lua/plenary.nvim' },
{
-- Main Telescope plugin
"nvim-telescope/telescope.nvim",
version = "0.1.8", -- or branch = '0.1.x'
dependencies = {
"nvim-lua/plenary.nvim",
{
-- FZF native plugin for better fuzzy matching
"nvim-telescope/telescope-fzf-native.nvim",
build = "make", -- Lazy will run `make` when installing/updating
-- If you want to ensure 'make' is available, you can do:
-- cond = function()
-- return vim.fn.executable("make") == 1
-- end,
},
},
cmd = "Telescope", -- load only when calling Telescope
config = function()
require('telescope').setup{
require("telescope").setup({
defaults = {
mappings = {
i = {
["<esc>"] = require('telescope.actions').close
}
}
}
}
["<esc>"] = require("telescope.actions").close,
},
},
},
})
-- After setup, load the FZF extension (it must be built successfully first)
require("telescope").load_extension("fzf")
end,
cmd = 'Telescope'
},
}
+69
View File
@@ -0,0 +1,69 @@
local pickers = require("telescope.pickers")
local finders = require("telescope.finders")
local conf = require("telescope.config").values
local actions = require("telescope.actions")
local action_state = require("telescope.actions.state")
-- Utility: Given a line number, returns the fold's starting line.
local function get_fold_start(l)
local closed = vim.fn.foldclosed(l)
if closed ~= -1 then
return closed
else
local level = vim.fn.foldlevel(l)
if level == 0 then
return l
end
local start = l
while start > 1 and vim.fn.foldlevel(start - 1) >= level do
start = start - 1
end
return start
end
end
local function jump_to_fold_starts()
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
local entries = {}
local prev_level = 0
-- Detect fold-start lines by checking if foldlevel increases.
for i, line in ipairs(lines) do
local current_level = vim.fn.foldlevel(i)
if current_level > prev_level then
table.insert(entries, {
value = line,
display = string.format("%d: %s", i, line),
ordinal = line,
file_line = i, -- Save the actual file line number.
})
end
prev_level = current_level
end
pickers.new({}, {
prompt_title = "Fold Starts",
finder = finders.new_table {
results = entries,
entry_maker = function(entry)
return entry -- Already in the expected shape.
end,
},
sorter = conf.generic_sorter({}),
attach_mappings = function(prompt_bufnr, _)
actions.select_default:replace(function()
actions.close(prompt_bufnr)
local selection = action_state.get_selected_entry()
if selection then
local target_line = get_fold_start(selection.file_line)
vim.cmd(string.format("normal! %dG", target_line))
vim.cmd("normal! zv")
end
end)
return true
end,
}):find()
end
-- Expose the function so you can require it.
return { jump_to_fold_starts = jump_to_fold_starts }
-1
View File
@@ -4,7 +4,6 @@ local function lines_with_preview()
local fzf_command = string.format("call fzf#vim#grep('%s', 1, fzf#vim#with_preview({'options': '--delimiter : --nth 4.. --no-sort'}, 'up:50%%', '?'), 1)", rg_command)
vim.cmd(fzf_command)
end
function DevtoolsPath()
local devPath = vim.fn.trim(vim.fn.system('ls ' .. vim.fn.expand("%:p:h") .. ' | grep DESCRIPTION'))
+105
View File
@@ -0,0 +1,105 @@
local pickers = require("telescope.pickers")
local finders = require("telescope.finders")
local conf = require("telescope.config").values
local actions = require("telescope.actions")
local action_state = require("telescope.actions.state")
local previewers = require("telescope.previewers")
-- Custom previewer that dynamically calculates how many lines
-- can fit in the preview window, then shows a centered slice.
local dynamic_previewer = previewers.new_buffer_previewer({
define_preview = function(self, entry, status)
-- 'entry.lnum' is the *actual file line number*.
local filepath = entry.path
local target = entry.lnum or 1
-- Get the preview buffer & window
local pbufnr = self.state.bufnr
local pwinid = status.preview_win
if not pbufnr or not vim.api.nvim_buf_is_valid(pbufnr) then
return
end
if not pwinid or not vim.api.nvim_win_is_valid(pwinid) then
return
end
-- How many lines can we show in the preview window?
-- Subtract a bit (e.g., 1 or 2) if you use borders or want extra margin.
local lines_in_window = vim.api.nvim_win_get_height(pwinid) - 1
if lines_in_window < 1 then
lines_in_window = 1
end
-- Read the entire file, figure out the slice to show
local all_lines = vim.fn.readfile(filepath)
local total = #all_lines
-- We'll center on the target line, if possible
local half_context = math.floor(lines_in_window / 2)
local start_line = math.max(target - half_context, 1)
local end_line = math.min(start_line + lines_in_window - 1, total)
-- Collect that slice of lines
local preview_lines = {}
for i = start_line, end_line do
table.insert(preview_lines, all_lines[i])
end
-- Write the slice to the preview buffer
vim.api.nvim_buf_set_lines(pbufnr, 0, -1, false, preview_lines)
vim.api.nvim_buf_clear_namespace(pbufnr, -1, 0, -1)
-- Highlight the target line within the slice
local relative_line = target - start_line + 1
if relative_line >= 1 and relative_line <= #preview_lines then
vim.api.nvim_buf_add_highlight(
pbufnr, -1, "Search", relative_line - 1, 0, -1
)
end
end,
})
local function jump_to_line()
local lines = vim.api.nvim_buf_get_lines(0, 0, -1, false)
local current_file = vim.api.nvim_buf_get_name(0)
local entries = {}
for i, text in ipairs(lines) do
table.insert(entries, {
value = text,
display = string.format("%d: %s", i, text),
ordinal = text,
path = current_file, -- needed by the previewer
lnum = i, -- actual file line number
})
end
pickers.new({}, {
prompt_title = "Jump to Line",
finder = finders.new_table({
results = entries,
entry_maker = function(e) return e end,
}),
sorter = conf.generic_sorter({}),
previewer = dynamic_previewer,
attach_mappings = function(prompt_bufnr, _)
actions.select_default:replace(function()
actions.close(prompt_bufnr)
local selection = action_state.get_selected_entry()
if selection then
local target_line = selection.lnum
local closed_line = vim.fn.foldclosed(target_line)
if closed_line ~= -1 then
target_line = closed_line
end
-- Jump and open the fold
vim.cmd(string.format("normal! %dG", target_line))
vim.cmd("normal! zv")
end
end)
return true
end,
}):find()
end
return { jump_to_line = jump_to_line }