Lots of changes!
This commit is contained in:
parent
fa147e9042
commit
4165025e14
3
init.lua
3
init.lua
|
@ -22,11 +22,14 @@ require 'opt.options'
|
|||
|
||||
-- Configuration of plugins
|
||||
require 'plugin.telescope'
|
||||
require 'plugin.yanky'
|
||||
require 'plugin.fzf_lsp'
|
||||
require 'plugin.autoclose'
|
||||
require 'plugin.lsp_config'
|
||||
require 'plugin.treesitter'
|
||||
require 'plugin.dracula'
|
||||
require 'plugin.cmp'
|
||||
require 'plugin.auto_session'
|
||||
require 'plugin.gitsigns'
|
||||
|
||||
vim.cmd('colorscheme dracula-soft')
|
||||
|
|
|
@ -2,22 +2,21 @@
|
|||
"Comment.nvim": { "branch": "master", "commit": "0236521ea582747b58869cb72f70ccfa967d2e89" },
|
||||
"LuaSnip": { "branch": "master", "commit": "a7a4b4682c4b3e2ba82b82a4e6e5f5a0e79dec32" },
|
||||
"LuaSnip-snippets.nvim": { "branch": "main", "commit": "d7e40e4cce622eab2316607dbcd8d6039bcb9fe0" },
|
||||
"autoclose.nvim": { "branch": "main", "commit": "dc42806540dcf448ecb2bad6b67204410cfbe629" },
|
||||
"base16-nvim": { "branch": "master", "commit": "b3e9ec6a82c05b562cd71f40fe8964438a9ba64a" },
|
||||
"auto-session": { "branch": "main", "commit": "af2219b9fa99c1d7ac409bd9eac094c459d3f52d" },
|
||||
"cmp-nvim-lsp": { "branch": "main", "commit": "5af77f54de1b16c34b23cba810150689a3a90312" },
|
||||
"cmp_luasnip": { "branch": "master", "commit": "05a9ab28b53f71d1aece421ef32fee2cb857a843" },
|
||||
"dracula.nvim": { "branch": "main", "commit": "8d8bddb8814c3e7e62d80dda65a9876f97eb699c" },
|
||||
"friendly-snippets": { "branch": "main", "commit": "ea068f1becd91bcd4591fceb6420d4335e2e14d3" },
|
||||
"fzf": { "branch": "master", "commit": "c30e486b648c1540a660802a5015aeca208274fa" },
|
||||
"fzf-lsp.nvim": { "branch": "main", "commit": "16905056051759b15a388709a3fa65ff098eb243" },
|
||||
"haskell-tools.nvim": { "branch": "master", "commit": "217cb7958ebbebf360f7c43efd5129e66d748042" },
|
||||
"gitsigns.nvim": { "branch": "main", "commit": "75dc649106827183547d3bedd4602442340d2f7f" },
|
||||
"indent-blankline.nvim": { "branch": "master", "commit": "3d08501caef2329aba5121b753e903904088f7e6" },
|
||||
"lazy.nvim": { "branch": "main", "commit": "af6afefbb46ab29a8a1db69536b04290a9403876" },
|
||||
"lazygit.nvim": { "branch": "main", "commit": "0ada6c6e7e138df92f5009b6952f4ac41248305a" },
|
||||
"leap.nvim": { "branch": "main", "commit": "25753d8a16b69fbbce5d392702c21dbc79d86bd1" },
|
||||
"lsp-zero.nvim": { "branch": "v3.x", "commit": "2b5e9a39b3bf60bfb0cc7c35d5f2e879d4cd72ea" },
|
||||
"neoconf.nvim": { "branch": "main", "commit": "9a419c4fa772c4c61839a8f7fdd8e863679a8c94" },
|
||||
"neodev.nvim": { "branch": "main", "commit": "6a533ed9d3435dcaa456380d833ea04da37ea2ed" },
|
||||
"nvim-autopairs": { "branch": "master", "commit": "c15de7e7981f1111642e7e53799e1211d4606cb9" },
|
||||
"nvim-cmp": { "branch": "main", "commit": "97dc716fc914c46577a4f254035ebef1aa72558a" },
|
||||
"nvim-dap": { "branch": "master", "commit": "c1695e500c7d552a0a19953a9aefcc89178fb1af" },
|
||||
"nvim-lspconfig": { "branch": "master", "commit": "6e5c78ebc9936ca74add66bda22c566f951b6ee5" },
|
||||
|
@ -25,9 +24,10 @@
|
|||
"plenary.nvim": { "branch": "master", "commit": "f7adfc4b3f4f91aab6caebf42b3682945fbc35be" },
|
||||
"ripgrep": { "branch": "master", "commit": "3ad0e83471588d8802d5747d0cc9accec76f7ccf" },
|
||||
"rnvimr": { "branch": "main", "commit": "3c41af742a61caf74a9f83fb82b9ed03ef13b880" },
|
||||
"sniprun": { "branch": "master", "commit": "97daa506e2faa3939e0491642103635f9d22cd04" },
|
||||
"snap": { "branch": "main", "commit": "c0bcae835facb945c25073d233c15dbfeb7adc5e" },
|
||||
"substitute.nvim": { "branch": "main", "commit": "17ffaeb5a1dc2dbef39cf0865d8a4b6000836714" },
|
||||
"telescope-fzf-native.nvim": { "branch": "main", "commit": "9ef21b2e6bb6ebeaf349a0781745549bbb870d27" },
|
||||
"telescope.nvim": { "branch": "master", "commit": "6312868392331c9c0f22725041f1ec2bef57c751" },
|
||||
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" }
|
||||
"which-key.nvim": { "branch": "main", "commit": "4433e5ec9a507e5097571ed55c02ea9658fb268a" },
|
||||
"yanky.nvim": { "branch": "main", "commit": "79338563e85a868e59cda02c51b54d90a5514a12" }
|
||||
}
|
|
@ -1,3 +1,7 @@
|
|||
-- Yanky
|
||||
|
||||
|
||||
-- Leap
|
||||
vim.keymap.set('n', 'z', '<Plug>(leap)')
|
||||
vim.keymap.set('n', 'Z', '<Plug>(leap-from-window)')
|
||||
vim.keymap.set({ 'x', 'o' }, 'z', '<Plug>(leap-forward)')
|
||||
|
@ -42,15 +46,26 @@ vim.api.nvim_create_autocmd('TextYankPost', {
|
|||
desc = 'Hightlight selection on yank',
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
vim.highlight.on_yank { higroup = 'IncSearch', timeout = 200 }
|
||||
vim.highlight.on_yank { higroup = 'IncSearch', timeout = 50 }
|
||||
end,
|
||||
})
|
||||
|
||||
-- Telescope bindings
|
||||
local builtin = require('telescope.builtin')
|
||||
vim.keymap.set('n', '<Space>f', builtin.find_files, {})
|
||||
vim.keymap.set('n', '<Space>o', builtin.live_grep, {})
|
||||
vim.keymap.set('n', '<Space>b', builtin.buffers, {})
|
||||
vim.keymap.set('n', '<Space>p', builtin.commands, {})
|
||||
vim.keymap.set('n', '<Space>y', ':Telescope yank_history<CR>', {})
|
||||
vim.keymap.set('n', '<Space>gc', builtin.git_commits, {})
|
||||
vim.keymap.set('n', '<Space>gs', builtin.git_status, {})
|
||||
vim.keymap.set('n', '<Space>gf', builtin.git_files, {})
|
||||
vim.keymap.set('n', '<Space>7', builtin.current_buffer_fuzzy_find, {})
|
||||
|
||||
|
||||
-- Bindings for save and quit
|
||||
vim.api.nvim_set_keymap('n', '<Space>w', ':w<CR>', { noremap = true, silent = true })
|
||||
vim.api.nvim_set_keymap('n', '<Space>q', ':q<CR>', {})
|
||||
|
||||
|
||||
|
||||
-- Bindings for save and quit
|
||||
|
|
4
lua/plugin/auto_session.lua
Normal file
4
lua/plugin/auto_session.lua
Normal file
|
@ -0,0 +1,4 @@
|
|||
require("auto-session").setup {
|
||||
log_level = "error",
|
||||
auto_session_suppress_dirs = { "~/", "~/Projects", "~/Downloads", "/"},
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
require("autoclose").setup({
|
||||
keys = {
|
||||
["$"] = { escape = true, close = true, pair = "$$", disabled_filetypes = { "haskell", "bash", "php" } },
|
||||
["'"] = { escape = true, close = true, pair = "''", disabled_filetypes = { "markdown" } },
|
||||
["`"] = { escape = true, close = true, pair = "``", disabled_filetypes = { "markdown" } },
|
||||
},
|
||||
})
|
|
@ -32,3 +32,10 @@ cmp.setup({
|
|||
end,
|
||||
},
|
||||
})
|
||||
|
||||
-- If you want insert `(` after select function or method item
|
||||
local cmp_autopairs = require('nvim-autopairs.completion.cmp')
|
||||
cmp.event:on(
|
||||
'confirm_done',
|
||||
cmp_autopairs.on_confirm_done()
|
||||
)
|
||||
|
|
45
lua/plugin/gitsigns.lua
Normal file
45
lua/plugin/gitsigns.lua
Normal file
|
@ -0,0 +1,45 @@
|
|||
require('gitsigns').setup{
|
||||
on_attach = function(bufnr)
|
||||
local gitsigns = require('gitsigns')
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal({']c', bang = true})
|
||||
else
|
||||
gitsigns.nav_hunk('next')
|
||||
end
|
||||
end)
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal({'[c', bang = true})
|
||||
else
|
||||
gitsigns.nav_hunk('prev')
|
||||
end
|
||||
end)
|
||||
|
||||
-- Actions
|
||||
map('n', '<Space>hs', gitsigns.stage_hunk)
|
||||
map('n', '<Space>hr', gitsigns.reset_hunk)
|
||||
map('v', '<Space>hs', function() gitsigns.stage_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
|
||||
map('v', '<Space>hr', function() gitsigns.reset_hunk {vim.fn.line('.'), vim.fn.line('v')} end)
|
||||
map('n', '<Space>hS', gitsigns.stage_buffer)
|
||||
map('n', '<Space>hu', gitsigns.undo_stage_hunk)
|
||||
map('n', '<Space>hR', gitsigns.reset_buffer)
|
||||
map('n', '<Space>hp', gitsigns.preview_hunk)
|
||||
map('n', '<Space>hb', function() gitsigns.blame_line{full=true} end)
|
||||
map('n', '<Space>tb', gitsigns.toggle_current_line_blame)
|
||||
map('n', '<Space>hd', gitsigns.diffthis)
|
||||
map('n', '<Space>hD', function() gitsigns.diffthis('~') end)
|
||||
map('n', '<Space>td', gitsigns.toggle_deleted)
|
||||
|
||||
map({'o', 'x'}, 'ih', ':<C-U>Gitsigns select_hunk<CR>')
|
||||
end
|
||||
}
|
7
lua/plugin/snap.lua
Normal file
7
lua/plugin/snap.lua
Normal file
|
@ -0,0 +1,7 @@
|
|||
local snap = require'snap'
|
||||
snap.maps {
|
||||
{"<Space>f", snap.config.file {producer = "ripgrep.file"}},
|
||||
{"<Leader>b", snap.config.file {producer = "vim.buffer"}},
|
||||
-- {"<Leader>fo", snap.config.file {producer = "vim.oldfile"}},
|
||||
{"<Leader>g", snap.config.vimgrep {}},
|
||||
}
|
|
@ -1,4 +1,5 @@
|
|||
local telescope = require('telescope')
|
||||
telescope.load_extension("yank_history")
|
||||
|
||||
|
||||
telescope.setup {
|
||||
|
@ -13,7 +14,8 @@ telescope.setup {
|
|||
},
|
||||
pickers = {
|
||||
find_files = {
|
||||
hidden = true
|
||||
hidden = true,
|
||||
theme = "dropdown"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
13
lua/plugin/yanky.lua
Normal file
13
lua/plugin/yanky.lua
Normal file
|
@ -0,0 +1,13 @@
|
|||
require("yanky").setup({
|
||||
ring = {
|
||||
history_length = 100,
|
||||
storage = "shada",
|
||||
sync_with_numbered_registers = true,
|
||||
cancel_event = "update",
|
||||
ignore_registers = { "_" },
|
||||
update_register_on_cycle = false,
|
||||
},
|
||||
system_clipboard = {
|
||||
sync_with_ring = true,
|
||||
},
|
||||
})
|
|
@ -1,6 +1,22 @@
|
|||
return {
|
||||
{
|
||||
'm4xshen/autoclose.nvim',
|
||||
"gbprod/yanky.nvim",
|
||||
},
|
||||
{
|
||||
'lewis6991/gitsigns.nvim'
|
||||
},
|
||||
{
|
||||
'windwp/nvim-autopairs',
|
||||
event = "InsertEnter",
|
||||
config = true
|
||||
-- use opts = {} for passing setup options
|
||||
-- this is equalent to setup({}) function
|
||||
},
|
||||
{
|
||||
'rmagatti/auto-session',
|
||||
},
|
||||
{
|
||||
"camspiers/snap",
|
||||
},
|
||||
{
|
||||
"Mofiqul/dracula.nvim"
|
||||
|
@ -35,10 +51,6 @@ return {
|
|||
{
|
||||
'hrsh7th/nvim-cmp'
|
||||
},
|
||||
{
|
||||
"folke/neoconf.nvim",
|
||||
cmd = "Neoconf"
|
||||
},
|
||||
{
|
||||
"lukas-reineke/indent-blankline.nvim",
|
||||
main = "ibl",
|
||||
|
@ -52,7 +64,9 @@ return {
|
|||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
build = 'cmake -S. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build --config Release && cmake --install build --prefix build'
|
||||
},
|
||||
{ "junegunn/fzf" },
|
||||
{
|
||||
"junegunn/fzf"
|
||||
},
|
||||
{
|
||||
"L3MON4D3/LuaSnip",
|
||||
version = "v2.*",
|
||||
|
@ -91,7 +105,7 @@ return {
|
|||
"nvim-lua/plenary.nvim",
|
||||
},
|
||||
keys = {
|
||||
{ "<leader>gg", "<cmd>LazyGit<cr>", desc = "LazyGit" }
|
||||
{ "<Space>gg", "<cmd>LazyGit<cr>", desc = "LazyGit" }
|
||||
}
|
||||
},
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue