nvim: replace lightspeed with leap

This commit is contained in:
He4eT 2023-01-31 17:26:29 +03:00
commit 9e02875ce7

View file

@ -1,4 +1,5 @@
-- Install packer -- Install packer
local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim' local install_path = vim.fn.stdpath 'data' .. '/site/pack/packer/start/packer.nvim'
local is_bootstrap = false local is_bootstrap = false
if vim.fn.empty(vim.fn.glob(install_path)) > 0 then if vim.fn.empty(vim.fn.glob(install_path)) > 0 then
@ -10,22 +11,27 @@ end
-- stylua: ignore start -- stylua: ignore start
require('packer').startup(function(use) require('packer').startup(function(use)
use 'wbthomason/packer.nvim' -- Package manager use 'wbthomason/packer.nvim' -- Package manager
use { 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } } -- Add git related info in the signs columns and popups
use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically
use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines use 'numToStr/Comment.nvim' -- "gc" to comment visual regions/lines
use { 'lewis6991/gitsigns.nvim', requires = { 'nvim-lua/plenary.nvim' } } -- Add git related info in the signs columns and popups
use { 'L3MON4D3/LuaSnip', requires = { 'saadparwaiz1/cmp_luasnip' } } -- Snippet Engine and Snippet Expansion
use 'nvim-treesitter/nvim-treesitter' -- Highlight, edit, and navigate code use 'nvim-treesitter/nvim-treesitter' -- Highlight, edit, and navigate code
use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client use 'neovim/nvim-lspconfig' -- Collection of configurations for built-in LSP client
use 'williamboman/nvim-lsp-installer' -- Automatically install language servers to stdpath use 'williamboman/nvim-lsp-installer' -- Automatically install language servers to stdpath
use { 'hrsh7th/nvim-cmp', requires = { 'hrsh7th/cmp-nvim-lsp' } } -- Autocompletion use { 'hrsh7th/nvim-cmp', requires = { 'hrsh7th/cmp-nvim-lsp' } } -- Autocompletion
use { 'L3MON4D3/LuaSnip', requires = { 'saadparwaiz1/cmp_luasnip' } } -- Snippet Engine and Snippet Expansion
use 'mjlbach/onedark.nvim' -- Theme inspired by Atom use 'ggandor/leap.nvim' -- Motion plugin
use 'nvim-lualine/lualine.nvim' -- Fancier statusline use 'tpope/vim-repeat' -- Fixup dot-repeat
use 'tpope/vim-sleuth' -- Detect tabstop and shiftwidth automatically
use 'ggandor/lightspeed.nvim'
use 'tpope/vim-repeat' --fixup dot-repeat for lightspeed
use 'ibhagwan/fzf-lua' -- Performant and lightweight fzf client use 'ibhagwan/fzf-lua' -- Performant and lightweight fzf client
use { 'junegunn/fzf', use { 'junegunn/fzf', run = "./install --bin" }
run = "./install --bin"
} use 'nvim-lualine/lualine.nvim' -- Fancier statusline
use 'mjlbach/onedark.nvim' -- Theme inspired by Atom
use 'rktjmp/lush.nvim' use 'rktjmp/lush.nvim'
use 'He4eT/desolate.nvim' use 'He4eT/desolate.nvim'
@ -127,7 +133,6 @@ vim.api.nvim_create_autocmd('TextYankPost', {
require('lualine').setup { require('lualine').setup {
options = { options = {
icons_enabled = false, icons_enabled = false,
-- theme = 'onedark',
component_separators = '|', component_separators = '|',
section_separators = '', section_separators = '',
globalstatus = true, globalstatus = true,
@ -162,9 +167,6 @@ require('nvim-treesitter.configs').setup {
keymaps = { keymaps = {
init_selection = '<c-space>', init_selection = '<c-space>',
node_incremental = '<c-space>', node_incremental = '<c-space>',
-- TODO: I'm not sure for this one.
scope_incremental = '<c-s>',
node_decremental = '<c-backspace>',
}, },
}, },
rainbow = { rainbow = {
@ -174,9 +176,13 @@ require('nvim-treesitter.configs').setup {
} }
} }
-- Window managment
vim.keymap.set('n', '<leader>w', '<C-w>', { remap = true }) vim.keymap.set('n', '<leader>w', '<C-w>', { remap = true })
vim.keymap.set('n', '<leader>q', ':bd<CR>') vim.keymap.set('n', '<leader>q', ':bd<CR>')
-- Diagnostic keymaps -- Diagnostic keymaps
vim.keymap.set('n', '[d', vim.diagnostic.goto_prev) vim.keymap.set('n', '[d', vim.diagnostic.goto_prev)
vim.keymap.set('n', ']d', vim.diagnostic.goto_next) vim.keymap.set('n', ']d', vim.diagnostic.goto_next)
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float) vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float)
@ -201,12 +207,7 @@ local on_attach = function(_, bufnr)
nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame') nmap('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]tion') nmap('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]tion')
nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition') nmap('gd', vim.lsp.buf.definition, '[G]oto [D]efinition')
-- nmap('gi', vim.lsp.buf.implementation, '[G]oto [I]mplementation')
-- nmap('gr', require('telescope.builtin').lsp_references)
-- nmap('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
-- nmap('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
-- See `:help K` for why this keymap -- See `:help K` for why this keymap
nmap('K', vim.lsp.buf.hover, 'Hover Documentation') nmap('K', vim.lsp.buf.hover, 'Hover Documentation')
@ -244,6 +245,10 @@ for _, lsp in ipairs(servers) do
} }
end end
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "solid",
})
-- Example custom configuration for lua -- Example custom configuration for lua
-- --
-- Make runtime files discoverable to the server -- Make runtime files discoverable to the server
@ -270,11 +275,8 @@ require('lspconfig').sumneko_lua.setup {
}, },
} }
vim.lsp.handlers["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, {
border = "solid",
})
-- nvim-cmp setup -- nvim-cmp setup
local cmp = require 'cmp' local cmp = require 'cmp'
local luasnip = require 'luasnip' local luasnip = require 'luasnip'
@ -319,7 +321,8 @@ if cmp ~= nil then
} }
end end
-- fzf {{{ -- FZF
local fzf = require('fzf-lua') local fzf = require('fzf-lua')
fzf.setup({ fzf.setup({
@ -367,8 +370,6 @@ vim.keymap.set({ 'n' }, '<leader>fg', fzf.live_grep)
vim.keymap.set({ 'n' }, '<leader>fd', fzf.git_status) vim.keymap.set({ 'n' }, '<leader>fd', fzf.git_status)
vim.keymap.set({ 'n' }, '<leader>fp', fzf.builtin) vim.keymap.set({ 'n' }, '<leader>fp', fzf.builtin)
-- vim.keymap.set({ 'n' }, '<leader>fh', fzf.help_tags)
-- vim.keymap.set({ 'n' }, '<leader>fc', fzf.commands)
vim.keymap.set({ 'n' }, '<leader>f:', fzf.command_history) vim.keymap.set({ 'n' }, '<leader>f:', fzf.command_history)
vim.keymap.set({ 'n' }, '<leader>f/', fzf.search_history) vim.keymap.set({ 'n' }, '<leader>f/', fzf.search_history)
vim.keymap.set({ 'n' }, "<leader>f'", fzf.registers) vim.keymap.set({ 'n' }, "<leader>f'", fzf.registers)
@ -380,22 +381,15 @@ vim.keymap.set({ 'n' }, '<leader>fW', fzf.grep_cWORD)
vim.keymap.set({ 'n' }, '<leader>/', fzf.blines) vim.keymap.set({ 'n' }, '<leader>/', fzf.blines)
vim.keymap.set({ 'n' }, '<leader>b', fzf.buffers) vim.keymap.set({ 'n' }, '<leader>b', fzf.buffers)
-- }}} fzf -- Leap Motion
require('lightspeed').setup { require('leap').add_default_mappings()
ignore_case = true, require('leap').opts.highlight_unlabeled_phase_one_targets = true
jump_to_unique_chars = false, require('leap').opts.safe_labels = {}
safe_labels = {},
labels = nil, vim.api.nvim_set_hl(0, 'LeapBackdrop', { link = 'Comment' })
repeat_ft_with_target_char = false, vim.api.nvim_set_hl(0, 'LeapLabelPrimary', { link = 'Cursor' })
} vim.api.nvim_set_hl(0, 'LeapMatch', { link = 'Identifier' })
-- silent! unmap f
-- vim.api.nvim_set_keymap('n', 'f', 'f', { noremap = true})
-- vim.api.nvim_set_keymap('n', 'F', 'F', { noremap = true})
-- vim.api.nvim_set_keymap('n', 't', 't', { noremap = true})
-- vim.api.nvim_set_keymap('n', 'T', 'T', { noremap = true})
-- vim.api.nvim_set_keymap('n', ';', ';', { noremap = true})
-- vim.api.nvim_set_keymap('n', ',', ',', { noremap = true})
-- The line beneath this is called `modeline`. See `:help modeline` -- The line beneath this is called `modeline`. See `:help modeline`
-- vim: ts=2 sts=2 sw=2 et -- vim: ts=2 sts=2 sw=2 et