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"
|
||||
|
||||
-- Automatically source and re-compile packer whenever you save this init.lua
|
||||
@ -260,10 +260,23 @@ require('fidget').setup()
|
||||
--
|
||||
-- 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
|
||||
local cmp = require 'cmp'
|
||||
local luasnip = require 'luasnip'
|
||||
|
||||
-- load luasnip snippets
|
||||
-- require("luasnip.loaders.from_lua").load({paths = "~/.config/nvim/luasnip/"})
|
||||
|
||||
cmp.setup {
|
||||
snippet = {
|
||||
expand = function(args)
|
||||
@ -290,8 +303,8 @@ cmp.setup {
|
||||
['<S-Tab>'] = cmp.mapping(function(fallback)
|
||||
if cmp.visible() then
|
||||
cmp.select_prev_item()
|
||||
-- elseif luasnip.jumpable(-1) then
|
||||
-- luasnip.jump(-1)
|
||||
elseif luasnip.expand_or_jumpable() then
|
||||
luasnip.expand_or_jump()
|
||||
else
|
||||
fallback()
|
||||
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-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
|
||||
vim.keymap.set('n', '<|>', ':vsplit<CR>', {desc = 'Vertical split', remap = true})
|
||||
|
||||
|
@ -3,13 +3,14 @@
|
||||
|
||||
-- tabs
|
||||
vim.o.tabstop = 4
|
||||
vim.o.expandtab = true
|
||||
vim.o.shiftwidth = 4
|
||||
|
||||
-- Set highlight on search
|
||||
vim.o.hlsearch = false
|
||||
|
||||
-- Make line numbers default
|
||||
-- vim.wo.number = true
|
||||
vim.wo.number = true
|
||||
vim.wo.relativenumber = true
|
||||
|
||||
-- Enable mouse mode
|
||||
|
@ -11,6 +11,12 @@ require('packer').startup({function(use)
|
||||
-- Package manager
|
||||
use 'wbthomason/packer.nvim'
|
||||
|
||||
use {
|
||||
-- Useful status updates for LSP
|
||||
'j-hui/fidget.nvim',
|
||||
branch = 'legacy',
|
||||
}
|
||||
|
||||
use { -- LSP Configuration & Plugins
|
||||
'neovim/nvim-lspconfig',
|
||||
requires = {
|
||||
@ -18,8 +24,6 @@ require('packer').startup({function(use)
|
||||
'williamboman/mason.nvim',
|
||||
'williamboman/mason-lspconfig.nvim',
|
||||
|
||||
-- Useful status updates for LSP
|
||||
'j-hui/fidget.nvim',
|
||||
|
||||
-- Additional lua configuration, makes nvim stuff amazing
|
||||
'folke/neodev.nvim',
|
||||
@ -38,6 +42,15 @@ require('packer').startup({function(use)
|
||||
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
|
||||
'hrsh7th/nvim-cmp',
|
||||
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 })
|
||||
end,
|
||||
}
|
||||
use {
|
||||
'nvim-treesitter/playground',
|
||||
}
|
||||
|
||||
use { -- Additional text objects via treesitter
|
||||
'nvim-treesitter/nvim-treesitter-textobjects',
|
||||
@ -77,9 +93,28 @@ require('packer').startup({function(use)
|
||||
-- your configuration comes here
|
||||
-- or leave it empty to use the default settings
|
||||
-- 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
|
||||
}
|
||||
}
|
||||
|
||||
-- file explorer
|
||||
use {
|
||||
@ -99,8 +134,7 @@ require('packer').startup({function(use)
|
||||
-- toggleterm
|
||||
use {"akinsho/toggleterm.nvim", tag = '*', config = function()
|
||||
require("toggleterm").setup{
|
||||
open_mapping = [[<c-\>]],
|
||||
|
||||
open_mapping = [[<c-_>]],
|
||||
}
|
||||
end}
|
||||
|
||||
@ -121,6 +155,8 @@ require('packer').startup({function(use)
|
||||
use 'tpope/vim-rhubarb'
|
||||
use 'lewis6991/gitsigns.nvim'
|
||||
|
||||
use 'lervag/vimtex'
|
||||
|
||||
use 'sainnhe/sonokai'
|
||||
use 'navarasu/onedark.nvim' -- Theme inspired by Atom
|
||||
use 'nvim-lualine/lualine.nvim' -- Fancier statusline
|
||||
|
Loading…
x
Reference in New Issue
Block a user