add hop.nvim plugin
This commit is contained in:
parent
464cb897d7
commit
415f88a10d
19
init.lua
19
init.lua
@ -1,4 +1,4 @@
|
|||||||
vim.opt.runtimepath:append(',~/.config/nvim/lua')
|
-- vim.opt.runtimepath:append(',~/.config/nvim/lua')
|
||||||
require "plugin"
|
require "plugin"
|
||||||
|
|
||||||
-- Automatically source and re-compile packer whenever you save this init.lua
|
-- Automatically source and re-compile packer whenever you save this init.lua
|
||||||
@ -260,10 +260,23 @@ require('fidget').setup()
|
|||||||
--
|
--
|
||||||
-- vim.cmd([[COQnow -s]])
|
-- vim.cmd([[COQnow -s]])
|
||||||
|
|
||||||
|
local hop = require('hop')
|
||||||
|
local directions = require('hop.hint').HintDirection
|
||||||
|
vim.keymap.set('n', '<leader>f', function()
|
||||||
|
hop.hint_words({ direction = directions.AFTER_CURSOR, current_line_only = false })
|
||||||
|
end, {remap=true})
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<leader>F', function()
|
||||||
|
hop.hint_words({ direction = directions.BEFORE_CURSOR, current_line_only = false })
|
||||||
|
end, {remap=true})
|
||||||
|
|
||||||
-- nvim-cmp setup
|
-- nvim-cmp setup
|
||||||
local cmp = require 'cmp'
|
local cmp = require 'cmp'
|
||||||
local luasnip = require 'luasnip'
|
local luasnip = require 'luasnip'
|
||||||
|
|
||||||
|
-- load luasnip snippets
|
||||||
|
-- require("luasnip.loaders.from_lua").load({paths = "~/.config/nvim/luasnip/"})
|
||||||
|
|
||||||
cmp.setup {
|
cmp.setup {
|
||||||
snippet = {
|
snippet = {
|
||||||
expand = function(args)
|
expand = function(args)
|
||||||
@ -290,8 +303,8 @@ cmp.setup {
|
|||||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||||
if cmp.visible() then
|
if cmp.visible() then
|
||||||
cmp.select_prev_item()
|
cmp.select_prev_item()
|
||||||
-- elseif luasnip.jumpable(-1) then
|
elseif luasnip.expand_or_jumpable() then
|
||||||
-- luasnip.jump(-1)
|
luasnip.expand_or_jump()
|
||||||
else
|
else
|
||||||
fallback()
|
fallback()
|
||||||
end
|
end
|
||||||
|
@ -20,6 +20,15 @@ vim.keymap.set('n', '<C-j>', '<C-w>j', {desc = 'window navigation', silent = tru
|
|||||||
vim.keymap.set('n', '<C-k>', '<C-w>k', {desc = 'window navigation', silent = true})
|
vim.keymap.set('n', '<C-k>', '<C-w>k', {desc = 'window navigation', silent = true})
|
||||||
vim.keymap.set('n', '<C-l>', '<C-w>l', {desc = 'window navigation', silent = true})
|
vim.keymap.set('n', '<C-l>', '<C-w>l', {desc = 'window navigation', silent = true})
|
||||||
|
|
||||||
|
-- toggleterm
|
||||||
|
-- todo: maybe can use these kybindings simultaneously with hidden attribute
|
||||||
|
-- https://github.com/akinsho/toggleterm.nvim/issues/322
|
||||||
|
vim.keymap.set('n', '<C-x>', '<cmd>ToggleTerm direction=float<cr>', {desc = 'floating terminal'})
|
||||||
|
vim.keymap.set('t', '<C-x>', 'exit<CR>', {desc = 'floating terminal'})
|
||||||
|
|
||||||
|
vim.keymap.set('n', '<C-\\>', '<cmd>ToggleTerm direction=horizontal<cr>', {desc = 'horizontal terminal'})
|
||||||
|
vim.keymap.set('t', '<C-\\>', '<Cmd>ToggleTerm<CR>', {desc = 'horizontal terminal'})
|
||||||
|
|
||||||
-- vsplit
|
-- vsplit
|
||||||
vim.keymap.set('n', '<|>', ':vsplit<CR>', {desc = 'Vertical split', remap = true})
|
vim.keymap.set('n', '<|>', ':vsplit<CR>', {desc = 'Vertical split', remap = true})
|
||||||
|
|
||||||
|
@ -3,13 +3,14 @@
|
|||||||
|
|
||||||
-- tabs
|
-- tabs
|
||||||
vim.o.tabstop = 4
|
vim.o.tabstop = 4
|
||||||
|
vim.o.expandtab = true
|
||||||
vim.o.shiftwidth = 4
|
vim.o.shiftwidth = 4
|
||||||
|
|
||||||
-- Set highlight on search
|
-- Set highlight on search
|
||||||
vim.o.hlsearch = false
|
vim.o.hlsearch = false
|
||||||
|
|
||||||
-- Make line numbers default
|
-- Make line numbers default
|
||||||
-- vim.wo.number = true
|
vim.wo.number = true
|
||||||
vim.wo.relativenumber = true
|
vim.wo.relativenumber = true
|
||||||
|
|
||||||
-- Enable mouse mode
|
-- Enable mouse mode
|
||||||
|
@ -11,6 +11,12 @@ require('packer').startup({function(use)
|
|||||||
-- Package manager
|
-- Package manager
|
||||||
use 'wbthomason/packer.nvim'
|
use 'wbthomason/packer.nvim'
|
||||||
|
|
||||||
|
use {
|
||||||
|
-- Useful status updates for LSP
|
||||||
|
'j-hui/fidget.nvim',
|
||||||
|
branch = 'legacy',
|
||||||
|
}
|
||||||
|
|
||||||
use { -- LSP Configuration & Plugins
|
use { -- LSP Configuration & Plugins
|
||||||
'neovim/nvim-lspconfig',
|
'neovim/nvim-lspconfig',
|
||||||
requires = {
|
requires = {
|
||||||
@ -18,8 +24,6 @@ require('packer').startup({function(use)
|
|||||||
'williamboman/mason.nvim',
|
'williamboman/mason.nvim',
|
||||||
'williamboman/mason-lspconfig.nvim',
|
'williamboman/mason-lspconfig.nvim',
|
||||||
|
|
||||||
-- Useful status updates for LSP
|
|
||||||
'j-hui/fidget.nvim',
|
|
||||||
|
|
||||||
-- Additional lua configuration, makes nvim stuff amazing
|
-- Additional lua configuration, makes nvim stuff amazing
|
||||||
'folke/neodev.nvim',
|
'folke/neodev.nvim',
|
||||||
@ -38,6 +42,15 @@ require('packer').startup({function(use)
|
|||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
|
use {
|
||||||
|
'phaazon/hop.nvim',
|
||||||
|
branch = 'v2', -- optional but strongly recommended
|
||||||
|
config = function()
|
||||||
|
-- you can configure Hop the way you like here; see :h hop-config
|
||||||
|
require'hop'.setup { keys = 'etovxqpdgfblzhckisuran' }
|
||||||
|
end
|
||||||
|
}
|
||||||
|
|
||||||
use { -- Autocompletion
|
use { -- Autocompletion
|
||||||
'hrsh7th/nvim-cmp',
|
'hrsh7th/nvim-cmp',
|
||||||
requires = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' },
|
requires = { 'hrsh7th/cmp-nvim-lsp', 'L3MON4D3/LuaSnip', 'saadparwaiz1/cmp_luasnip' },
|
||||||
@ -61,6 +74,9 @@ require('packer').startup({function(use)
|
|||||||
pcall(require('nvim-treesitter.install').update { with_sync = true })
|
pcall(require('nvim-treesitter.install').update { with_sync = true })
|
||||||
end,
|
end,
|
||||||
}
|
}
|
||||||
|
use {
|
||||||
|
'nvim-treesitter/playground',
|
||||||
|
}
|
||||||
|
|
||||||
use { -- Additional text objects via treesitter
|
use { -- Additional text objects via treesitter
|
||||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||||
@ -77,9 +93,28 @@ require('packer').startup({function(use)
|
|||||||
-- your configuration comes here
|
-- your configuration comes here
|
||||||
-- or leave it empty to use the default settings
|
-- or leave it empty to use the default settings
|
||||||
-- refer to the configuration section below
|
-- refer to the configuration section below
|
||||||
|
-- plugins = {
|
||||||
|
-- marks = true, -- shows a list of your marks on ' and `
|
||||||
|
-- registers = false, -- shows your registers on " in NORMAL or <C-r> in INSERT mode
|
||||||
|
-- -- the presets plugin, adds help for a bunch of default keybindings in Neovim
|
||||||
|
-- -- No actual key bindings are created
|
||||||
|
-- spelling = {
|
||||||
|
-- enabled = true, -- enabling this will show WhichKey when pressing z= to select spelling suggestions
|
||||||
|
-- suggestions = 20, -- how many suggestions should be shown in the list?
|
||||||
|
-- },
|
||||||
|
-- presets = {
|
||||||
|
-- operators = true, -- adds help for operators like d, y, ...
|
||||||
|
-- motions = true, -- adds help for motions
|
||||||
|
-- text_objects = true, -- help for text objects triggered after entering an operator
|
||||||
|
-- windows = true, -- default bindings on <c-w>
|
||||||
|
-- nav = true, -- misc bindings to work with windows
|
||||||
|
-- z = true, -- bindings for folds, spelling and others prefixed with z
|
||||||
|
-- g = true, -- bindings for prefixed with g
|
||||||
|
-- },
|
||||||
|
-- },
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
||||||
-- file explorer
|
-- file explorer
|
||||||
use {
|
use {
|
||||||
@ -99,8 +134,7 @@ require('packer').startup({function(use)
|
|||||||
-- toggleterm
|
-- toggleterm
|
||||||
use {"akinsho/toggleterm.nvim", tag = '*', config = function()
|
use {"akinsho/toggleterm.nvim", tag = '*', config = function()
|
||||||
require("toggleterm").setup{
|
require("toggleterm").setup{
|
||||||
open_mapping = [[<c-\>]],
|
open_mapping = [[<c-_>]],
|
||||||
|
|
||||||
}
|
}
|
||||||
end}
|
end}
|
||||||
|
|
||||||
@ -121,6 +155,8 @@ require('packer').startup({function(use)
|
|||||||
use 'tpope/vim-rhubarb'
|
use 'tpope/vim-rhubarb'
|
||||||
use 'lewis6991/gitsigns.nvim'
|
use 'lewis6991/gitsigns.nvim'
|
||||||
|
|
||||||
|
use 'lervag/vimtex'
|
||||||
|
|
||||||
use 'sainnhe/sonokai'
|
use 'sainnhe/sonokai'
|
||||||
use 'navarasu/onedark.nvim' -- Theme inspired by Atom
|
use 'navarasu/onedark.nvim' -- Theme inspired by Atom
|
||||||
use 'nvim-lualine/lualine.nvim' -- Fancier statusline
|
use 'nvim-lualine/lualine.nvim' -- Fancier statusline
|
||||||
|
Loading…
x
Reference in New Issue
Block a user