Compare commits

...

19 Commits

Author SHA1 Message Date
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
hollorol
63a93518f2 Merge remote-tracking branch 'refs/remotes/origin/master' 2024-10-20 09:48:38 +02:00
hollorol
ecc9cdec30 add smarter context mini.ai 2024-10-20 09:48:19 +02:00
Roland Hollós
c4848b75e7 no visible iron last send 2024-10-13 14:34:54 +02:00
hollorol
c9e713d162 better jumpkey and copilot bindings 2024-10-13 10:47:22 +02:00
hollorol
43147c78c4 add copilot functionality 2024-10-12 19:10:12 +02:00
hollorol
1cc3527bb4 change nvimr to ironrepl because its more stable. 2024-08-14 11:32:02 +02:00
hollorol
e5970bbea4 Fix conflicting binding 2024-08-14 10:45:40 +02:00
hollorol
8f2963124c Better telescope bindings 2024-08-14 10:38:51 +02:00
hollorol
dec46f1e13 Add more R functionalities 2024-08-12 20:56:36 +02:00
hollorol
3d6a296e8c adding vimwiki 2024-08-12 13:43:42 +02:00
0881f56e45 Merge pull request 'Remove some autocompletion which messed up with my R plugin' (#1) from debug into master
Reviewed-on: https://git.rolandhollos.xyz/hollorol/neoconfig/pulls/1
2024-07-31 23:05:05 +02:00
hollorol
ae3ef247c0 spellcheck default false 2024-07-31 15:13:36 +02:00
13 changed files with 371 additions and 21 deletions

View File

@ -18,3 +18,8 @@ snippet it "item"
\item $0 \item $0
endsnippet endsnippet
snippet listing "Listing"
\begin{lstlisting}
$0
\end{lstlisting}
endsnippet

View File

@ -2,4 +2,48 @@ require("config.options")
require("config.keymaps") require("config.keymaps")
require("config.lazy") require("config.lazy")
require("custom.functions") 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" })

View File

@ -6,8 +6,8 @@ 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.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>ff', '<cmd>Telescope find_files<cr>', {noremap = true, silent = true})
vim.api.nvim_set_keymap('n', '<leader>fg', '<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>fb', '<cmd>Telescope buffers<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}) vim.api.nvim_set_keymap('n', '<leader>fh', '<cmd>Telescope help_tags<cr>', {noremap = true, silent = true})
vim.keymap.set('n', '-', '/', { noremap = true, silent = true }) vim.keymap.set('n', '-', '/', { 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', '<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', '<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.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 }
)

View File

@ -1,3 +1,4 @@
vim.opt.termguicolors = true -- True color support
vim.opt.hlsearch = false -- Disable highlighting search matches vim.opt.hlsearch = false -- Disable highlighting search matches
vim.opt.hidden = true -- Allow background buffers vim.opt.hidden = true -- Allow background buffers
vim.opt.cindent = true vim.opt.cindent = true
@ -9,5 +10,5 @@ vim.opt.mouse="a"
vim.opt.clipboard="unnamedplus" vim.opt.clipboard="unnamedplus"
vim.g.mapleader = " " vim.g.mapleader = " "
vim.g.maplocalleader = "," vim.g.maplocalleader = ","
vim.opt.spell = true -- vim.opt.spell = true
vim.opt.ignorecase = true vim.opt.ignorecase = true

View File

@ -6,6 +6,8 @@ return {
vim.api.nvim_set_keymap('n', '<M-s>', '<Plug>(easymotion-s2)', {}) vim.api.nvim_set_keymap('n', '<M-s>', '<Plug>(easymotion-s2)', {})
vim.api.nvim_set_keymap('n', '<M-l>', '<Plug>(easymotion-lineanywhere)', {}) vim.api.nvim_set_keymap('n', '<M-l>', '<Plug>(easymotion-lineanywhere)', {})
vim.api.nvim_set_keymap('n', '<M-j>', '<Plug>(easymotion-jumptoanywhere)', {}) vim.api.nvim_set_keymap('n', '<M-j>', '<Plug>(easymotion-jumptoanywhere)', {})
vim.g.EasyMotion_keys = 'asdghklqwertzuiopzxcvbnmfjé'
end end
}, },
} }

View File

@ -1,8 +1,24 @@
return { return {
{'vimwiki/vimwiki'},
{'tpope/vim-fugitive'}, {'tpope/vim-fugitive'},
{'gorkunov/smartpairs.vim'}, {'gorkunov/smartpairs.vim'},
{'tpope/vim-surround'}, {'tpope/vim-surround'},
{'echasnovski/mini.ai',
config = function()
require('mini.ai').setup()
end},
{'jiangmiao/auto-pairs'}, {'jiangmiao/auto-pairs'},
{'github/copilot.vim',
config = function()
vim.keymap.set('i', '<C-J>', 'copilot#Accept("\\<CR>")', { expr = true, replace_keycodes = false })
vim.keymap.set('i', '<C-L>', '<Plug>(copilot-accept-word)')
vim.keymap.set('i', '<PageDown>', '<Plug>(copilot-previous)')
vim.keymap.set('i', '<PageUp>', '<Plug>(copilot-next)')
vim.keymap.set('i', '<Home>', '<Plug>(copilot-suggest)')
vim.keymap.set('i', '<M-Left>', '<esc>dawi<Right>')
vim.g.copilot_no_tab_map=true
end
},
{'mattn/emmet-vim', {'mattn/emmet-vim',
ft = { 'html', 'css', 'javascript', 'typescript', 'vue' }, ft = { 'html', 'css', 'javascript', 'typescript', 'vue' },
} }

View File

@ -7,6 +7,7 @@ return {
iron.setup { iron.setup {
config = { config = {
-- Whether a repl should be discarded or not -- Whether a repl should be discarded or not
highlight_last = false,
scratch_repl = false, scratch_repl = false,
-- Your repl definitions come here -- Your repl definitions come here
repl_definition = { repl_definition = {
@ -22,7 +23,7 @@ return {
}, },
-- How the repl window will be displayed -- How the repl window will be displayed
-- See below for more information -- See below for more information
repl_open_cmd = require('iron.view').split.below(80), repl_open_cmd = 'belowright 20split' --require('iron.view').split.below(80),
}, },
-- Iron doesn't set keymaps by default anymore. -- Iron doesn't set keymaps by default anymore.
-- You can set them here or manually add keymaps to the functions in iron.core -- You can set them here or manually add keymaps to the functions in iron.core

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
}

View File

@ -2,6 +2,7 @@ return {
-- Mason for managing external tools (LSP servers, linters, etc.) -- Mason for managing external tools (LSP servers, linters, etc.)
{ {
"williamboman/mason.nvim", "williamboman/mason.nvim",
version = "=1.0.1",
config = function() config = function()
require("mason").setup() require("mason").setup()
end end
@ -9,9 +10,11 @@ return {
-- Mason LSP config to bridge Mason and nvim-lspconfig -- Mason LSP config to bridge Mason and nvim-lspconfig
{ {
"williamboman/mason-lspconfig.nvim", "williamboman/mason-lspconfig.nvim",
version = "=1.0.1",
config = function() config = function()
require("mason-lspconfig").setup { require("mason-lspconfig").setup {
ensure_installed = {"pyright"} ensure_installed = {"pyright"},
automatic_installation = false, -- Set to true to automatically install servers
} }
end end
}, },

View File

@ -1,19 +1,33 @@
return { return {
'nvim-telescope/telescope.nvim', tag = '0.1.8', {
-- or , branch = '0.1.x', -- Main Telescope plugin
dependencies = { 'nvim-lua/plenary.nvim' }, "nvim-telescope/telescope.nvim",
version = "0.1.8", -- or branch = '0.1.x'
config = function() dependencies = {
require('telescope').setup{ "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({
defaults = { defaults = {
mappings = { mappings = {
i = { 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, end,
cmd = 'Telescope' },
}
}

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 }

View File

@ -1,9 +1,67 @@
-- Alternatively, using a Lua function
local function lines_with_preview() local function lines_with_preview()
local current_file = vim.fn.fnameescape(vim.fn.expand('%')) local current_file = vim.fn.fnameescape(vim.fn.expand('%'))
local rg_command = string.format("rg --with-filename --column --line-number --no-heading --color=always --smart-case . %s", current_file) local rg_command = string.format("rg --with-filename --column --line-number --no-heading --color=always --smart-case . %s", current_file)
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) 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) vim.cmd(fzf_command)
end end
function DevtoolsPath()
local devPath = vim.fn.trim(vim.fn.system('ls ' .. vim.fn.expand("%:p:h") .. ' | grep DESCRIPTION'))
if devPath == "" then
devPath = vim.fn.trim(vim.fn.system('realpath ' .. vim.fn.expand("%:p:h") .. '/../'))
return devPath
else
devPath = vim.fn.expand('%:p:h')
return devPath
end
end
vim.api.nvim_create_user_command('LinesWithPreview', lines_with_preview, {}) vim.api.nvim_create_user_command('LinesWithPreview', lines_with_preview, {})
vim.api.nvim_create_autocmd({"BufNewFile", "BufRead"}, {
pattern = "DESCRIPTION",
command = "set filetype=r"
})
local function IronQuiteSend(opts)
-- Get the current filetype to send to the appropriate REPL
local ft = vim.bo.filetype
-- Concatenate all arguments passed to the command
local command = table.concat(opts.fargs, " ")
-- Send the command to the REPL
require('iron.core').send(ft, command)
end
-- Create the primary command in Neovim
vim.api.nvim_create_user_command('IronQuiteSend', IronQuiteSend, {
nargs = '+', -- Allows for multiple arguments
})
-- Map <C-c>wd to send devtools::document command in R
vim.api.nvim_create_autocmd("FileType", {
pattern = "r",
callback = function()
vim.api.nvim_set_keymap('n', '<C-c>wd', ':IronQuiteSend devtools::document("' .. DevtoolsPath() .. '")<CR>', { noremap = true, silent = true })
end
})
-- Map <C-c>wi to send devtools::install command in R
vim.api.nvim_create_autocmd("FileType", {
pattern = "r",
callback = function()
vim.api.nvim_set_keymap('n', '<C-c>wi', ':IronQuiteSend devtools::install("' .. DevtoolsPath() .. '", upgrade = "never")<CR>', { noremap = true, silent = true })
end
})
vim.api.nvim_create_autocmd("FileType", {
pattern = "r",
callback = function()
vim.api.nvim_set_keymap('n', '<C-c>i', ':IronQuiteSend install.packages("")<Left><Left>', { noremap = true, silent = true })
end
})

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 }