Initial neovim config -- the end of vimscript for me :)
This commit is contained in:
commit
030c0482c8
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
|||||||
|
lazy-lock.json
|
||||||
4
init.lua
Normal file
4
init.lua
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
require("config.options")
|
||||||
|
require("config.keymaps")
|
||||||
|
require("config.lazy")
|
||||||
|
require("custom.functions")
|
||||||
20
lua/config/keymaps.lua
Normal file
20
lua/config/keymaps.lua
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
-- Insert mode bindings
|
||||||
|
vim.keymap.set('i','jk','<Esc>', {noremap=true, silent=true})
|
||||||
|
vim.keymap.set('i','÷','()<Esc>i', {noremap=true, silent=true})
|
||||||
|
|
||||||
|
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>ff', ':Files<CR>', { noremap = true, silent = true })
|
||||||
|
vim.keymap.set('n', '<leader>fg', ':GFiles<CR>', { noremap = true, silent = true })
|
||||||
|
vim.keymap.set('n', '<leader>bb', ':Buffers<CR>', { noremap = true, silent = true })
|
||||||
|
vim.keymap.set('n', '<leader>fh', ':Helptags<CR>', { noremap = true, silent = true })
|
||||||
|
vim.keymap.set('n', '-', '/', { noremap = true, silent = true })
|
||||||
|
vim.keymap.set('n', '<F1>', function() vim.cmd('e ~/.config/nvim/init.vim') end, { noremap = true, silent = true })
|
||||||
|
vim.keymap.set('n','<F4>',':set hlsearch!<CR>',{ noremap = true, silent = true })
|
||||||
|
vim.keymap.set('n','<F12>',':set number!<CR>',{ noremap = true, silent = true })
|
||||||
|
vim.keymap.set('n','<leader>ss', function() vim.cmd('LinesWithPreview') end,{ noremap = true, silent = true })
|
||||||
|
vim.keymap.set('n', 'á', '`', { noremap = true, silent = true })
|
||||||
|
vim.keymap.set('n', 'z7', 'z=', { 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', '<F7>',':set spell! spelllang=en<CR>', { noremap = true, silent = true })
|
||||||
24
lua/config/lazy.lua
Normal file
24
lua/config/lazy.lua
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
-- Bootstrap lazy.nvim
|
||||||
|
local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim"
|
||||||
|
if not (vim.uv or vim.loop).fs_stat(lazypath) then
|
||||||
|
local lazyrepo = "https://github.com/folke/lazy.nvim.git"
|
||||||
|
local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath })
|
||||||
|
if vim.v.shell_error ~= 0 then
|
||||||
|
vim.api.nvim_echo({
|
||||||
|
{ "Failed to clone lazy.nvim:\n", "ErrorMsg" },
|
||||||
|
{ out, "WarningMsg" },
|
||||||
|
{ "\nPress any key to exit..." },
|
||||||
|
}, true, {})
|
||||||
|
vim.fn.getchar()
|
||||||
|
os.exit(1)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
vim.opt.rtp:prepend(lazypath)
|
||||||
|
|
||||||
|
-- Make sure to setup `mapleader` and `maplocalleader` before
|
||||||
|
-- loading lazy.nvim so that mappings are correct.
|
||||||
|
-- This is also a good place to setup other settings (vim.opt)
|
||||||
|
|
||||||
|
-- Setup lazy.nvim
|
||||||
|
require("lazy").setup("config.plugins")
|
||||||
|
|
||||||
11
lua/config/options.lua
Normal file
11
lua/config/options.lua
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
vim.opt.hlsearch = false -- Disable highlighting search matches
|
||||||
|
vim.opt.hidden = true -- Allow background buffers
|
||||||
|
vim.opt.cindent = true
|
||||||
|
vim.opt.tabstop = 4
|
||||||
|
vim.opt.shiftwidth = 4
|
||||||
|
vim.opt.expandtab = true
|
||||||
|
vim.opt.hidden = true
|
||||||
|
vim.opt.mouse="a"
|
||||||
|
vim.opt.clipboard="unnamedplus"
|
||||||
|
vim.g.mapleader = " "
|
||||||
|
vim.g.maplocalleader = ","
|
||||||
9
lua/config/plugins/angr.lua
Normal file
9
lua/config/plugins/angr.lua
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
return {
|
||||||
|
"hollorol/angr.vim",
|
||||||
|
lazy = false,
|
||||||
|
priority = 1000,
|
||||||
|
config = function()
|
||||||
|
-- load the colorscheme here
|
||||||
|
vim.cmd([[colorscheme angr]])
|
||||||
|
end,
|
||||||
|
}
|
||||||
10
lua/config/plugins/easymotion.lua
Normal file
10
lua/config/plugins/easymotion.lua
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
'easymotion/vim-easymotion',
|
||||||
|
config = function()
|
||||||
|
-- EasyMotion configuration
|
||||||
|
vim.api.nvim_set_keymap('n', '<M-s>', '<Plug>(easymotion-s2)', {})
|
||||||
|
vim.api.nvim_set_keymap('n', '<M-l>', '<Plug>(easymotion-lineforward)', {})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
}
|
||||||
10
lua/config/plugins/fzf.lua
Normal file
10
lua/config/plugins/fzf.lua
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
'junegunn/fzf',
|
||||||
|
run = function() vim.fn['fzf#install']() end
|
||||||
|
},
|
||||||
|
{
|
||||||
|
'junegunn/fzf.vim',
|
||||||
|
cmd = { 'Files','GFiles','Buffers','Helptags', 'Ag', 'Rg' }, -- Load when invoking FZF commands
|
||||||
|
}
|
||||||
|
}
|
||||||
9
lua/config/plugins/init.lua
Normal file
9
lua/config/plugins/init.lua
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
return {
|
||||||
|
{'tpope/vim-fugitive'},
|
||||||
|
{'gorkunov/smartpairs.vim'},
|
||||||
|
{'SirVer/ultisnips'},
|
||||||
|
{'tpope/vim-surround'},
|
||||||
|
{'mattn/emmet-vim',
|
||||||
|
ft = { 'html', 'css', 'javascript', 'typescript', 'vue' },
|
||||||
|
}
|
||||||
|
}
|
||||||
23
lua/config/plugins/nvimr.lua
Normal file
23
lua/config/plugins/nvimr.lua
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
return {
|
||||||
|
{
|
||||||
|
"R-nvim/R.nvim",
|
||||||
|
lazy = false
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"nvim-treesitter/nvim-treesitter",
|
||||||
|
run = ":TSUpdate",
|
||||||
|
config = function ()
|
||||||
|
require("nvim-treesitter.configs").setup({
|
||||||
|
ensure_installed = { "markdown", "markdown_inline", "r", "rnoweb", "yaml" },
|
||||||
|
})
|
||||||
|
end
|
||||||
|
},
|
||||||
|
"R-nvim/cmp-r",
|
||||||
|
{
|
||||||
|
"hrsh7th/nvim-cmp",
|
||||||
|
config = function()
|
||||||
|
require("cmp").setup({ sources = {{ name = "cmp_r" }}})
|
||||||
|
require("cmp_r").setup({ })
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
}
|
||||||
3
lua/config/plugins/tcomment_vim.lua
Normal file
3
lua/config/plugins/tcomment_vim.lua
Normal file
@ -0,0 +1,3 @@
|
|||||||
|
return{
|
||||||
|
'tomtom/tcomment_vim',
|
||||||
|
}
|
||||||
18
lua/config/plugins/whichkey.lua
Normal file
18
lua/config/plugins/whichkey.lua
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
return {
|
||||||
|
"folke/which-key.nvim",
|
||||||
|
event = "VeryLazy",
|
||||||
|
opts = {
|
||||||
|
-- your configuration comes here
|
||||||
|
-- or leave it empty to use the default settings
|
||||||
|
-- refer to the configuration section below
|
||||||
|
},
|
||||||
|
keys = {
|
||||||
|
{
|
||||||
|
"<leader>?",
|
||||||
|
function()
|
||||||
|
require("which-key").show({ global = false })
|
||||||
|
end,
|
||||||
|
desc = "Buffer Local Keymaps (which-key)",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}
|
||||||
9
lua/custom/functions.lua
Normal file
9
lua/custom/functions.lua
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
-- Alternatively, using a Lua function
|
||||||
|
local function lines_with_preview()
|
||||||
|
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 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
|
||||||
|
|
||||||
|
vim.api.nvim_create_user_command('LinesWithPreview', lines_with_preview, {})
|
||||||
Loading…
Reference in New Issue
Block a user