1
0

feat: add sneak, quickscope, colorizer, gruvbox, commenter, smoothie

This commit is contained in:
Rokas Puzonas 2021-10-30 02:37:07 +03:00
parent 95660c65af
commit 394c2db554
7 changed files with 137 additions and 42 deletions

View File

@ -24,4 +24,5 @@ require("plugins")
require("options")
require("bindings")
require("themes.gruvbox")

15
lua/config/colorizer.lua Normal file
View File

@ -0,0 +1,15 @@
require('colorizer').setup(
nil,
{
RGB = true,
RRGGBB = true,
names = false,
RRGGBBAA = true,
rgb_fn = true,
hsl_fn = true,
css = false,
css_fn = false,
mode = 'background'
}
)

View File

@ -0,0 +1,8 @@
local g = vim.g
local cmd = vim.cmd
-- Trigger a highlight in the appropriate direction when pressing these keys:
g['qs_highlight_on_keys'] = {'f', 'F', 't', 'T'}
g['qs_max_chars'] = 150

23
lua/config/sneak.lua Normal file
View File

@ -0,0 +1,23 @@
local map = require 'utils.map'
local g = vim.g
g['sneak#label'] = 1
-- case insensitive sneak
g['sneak#use_ic_scs'] = 1
-- immediately move to the next instance of search, if you move the cursor sneak is back to default behavior
g['sneak#s_next'] = 1
-- remap so I can use , and ; with f and t
map({'n', 'v'}, 'gS', '<plug>Sneak_;')
map({'n', 'v'}, 'gs', '<plug>Sneak_;')
-- map gS <Plug>Sneak_,
-- map gs <Plug>Sneak_;
-- highlight Sneak guifg=black guibg=#00C7DF ctermfg=black ctermbg=cyan
-- highlight SneakScope guifg=red guibg=yellow ctermfg=red ctermbg=yellow
-- Emoji prompt
g['sneak#prompt'] = '🔎'

View File

@ -1,16 +1,35 @@
local function usePlugins(use)
-- Packer can manage itself
use 'wbthomason/packer.nvim'
-- Packer can manage itself
use 'wbthomason/packer.nvim'
-- Improve startup time when loading lua files.
-- Temporary solution before PR gets merges. https://github.com/neovim/neovim/pull/15436
use 'lewis6991/impatient.nvim'
-- Improve startup time when loading lua files.
-- Temporary solution before PR gets merges. https://github.com/neovim/neovim/pull/15436
use 'lewis6991/impatient.nvim'
-- Git integration
use { 'tpope/vim-fugitive', config = [[require 'config.fugitive']] }
-- Various lua utilities
use 'nvim-lua/plenary.nvim'
-- Smooth smooth scrolling
use 'psliwka/vim-smoothie'
-- Toggle comments
use 'tpope/vim-commentary'
-- Color code colorizer
use { 'norcalli/nvim-colorizer.lua', config = [[require 'config.colorizer']] }
-- Quick movement
use { 'justinmk/vim-sneak', config = [[require 'config.sneak']] }
use { 'unblevable/quick-scope', config = [[require 'config.quickscope']] }
use 'michaeljsmith/vim-indent-object'
-- Color themes
use { 'morhetz/gruvbox', module = 'themes.gruvbox' }
-- Git integration
use { 'tpope/vim-fugitive', config = [[require 'config.fugitive']] }
end
-- Register custom commands for plugin manager
vim.cmd [[command! PackerInstall packadd packer.nvim | lua require('plugins').install()]]
vim.cmd [[command! PackerUpdate packadd packer.nvim | lua require('plugins').update()]]
@ -20,55 +39,55 @@ vim.cmd [[command! PackerCompile packadd packer.nvim | lua require('plugins').co
-- Run "PackerCompile" whenever this file is updated
vim.cmd [[
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerCompile
augroup end
augroup packer_user_config
autocmd!
autocmd BufWritePost plugins.lua source <afile> | PackerCompile
augroup end
]]
-- Bootstrap packer.nvim. If packer.nvim is not installed, install it.
local function bootstrap()
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
local packer_bootstrap
if fn.empty(fn.glob(install_path)) > 0 then
return fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
end
local fn = vim.fn
local install_path = fn.stdpath('data')..'/site/pack/packer/start/packer.nvim'
local packer_bootstrap
if fn.empty(fn.glob(install_path)) > 0 then
return fn.system({'git', 'clone', '--depth', '1', 'https://github.com/wbthomason/packer.nvim', install_path})
end
end
local packer = nil
local function init()
-- Perform bootstrap
local packer_bootstrap = bootstrap()
-- Perform bootstrap
local packer_bootstrap = bootstrap()
-- Initialize packer
if packer == nil then
packer = require 'packer'
local util = require 'packer.util'
packer.init {
compile_path = util.join_paths(vim.fn.stdpath('config'), 'plugin', 'packer-compiled.lua'),
disable_commands = true
}
end
-- Initialize packer
if packer == nil then
packer = require 'packer'
local util = require 'packer.util'
packer.init {
compile_path = util.join_paths(vim.fn.stdpath('config'), 'plugin', 'packer-compiled.lua'),
disable_commands = true
}
end
-- Reset plugins if already loaded
packer.reset()
-- Reset plugins if already loaded
packer.reset()
-- Use plugins
usePlugins(packer.use, packer.use_rocks)
-- Use plugins
usePlugins(packer.use, packer.use_rocks)
-- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins
if packer_bootstrap then
require('packer').sync()
end
-- Automatically set up your configuration after cloning packer.nvim
-- Put this at the end after all plugins
if packer_bootstrap then
require('packer').sync()
end
end
local plugins = setmetatable({}, {
__index = function(_, key)
init()
return packer[key]
end,
__index = function(_, key)
init()
return packer[key]
end,
})
return plugins

19
lua/sneak.lua Normal file
View File

@ -0,0 +1,19 @@
let g:sneak#label = 1
" case insensitive sneak
let g:sneak#use_ic_scs = 1
" immediately move to the next instance of search, if you move the cursor sneak is back to default behavior
let g:sneak#s_next = 1
" remap so I can use , and ; with f and t
map gS <Plug>Sneak_,
map gs <Plug>Sneak_;
" Change the colors
" highlight Sneak guifg=black guibg=#00C7DF ctermfg=black ctermbg=cyan
" highlight SneakScope guifg=red guibg=yellow ctermfg=red ctermbg=yellow
" Cool prompts
" let g:sneak#prompt = '🕵'
let g:sneak#prompt = '🔎'

10
lua/themes/gruvbox.lua Normal file
View File

@ -0,0 +1,10 @@
local opt = require 'utils.opt'
local cmd = vim.cmd
opt('background', 'dark')
cmd [[colorscheme gruvbox]]
-- Background transparency
cmd [[highlight Normal guibg=NONE ctermbg=NONE]]
cmd [[highlight Folded guibg=NONE ctermbg=NONE]]