diff --git a/init.lua b/init.lua index dcb21d8..3fa4211 100644 --- a/init.lua +++ b/init.lua @@ -24,4 +24,5 @@ require("plugins") require("options") require("bindings") +require("themes.gruvbox") diff --git a/lua/config/colorizer.lua b/lua/config/colorizer.lua new file mode 100644 index 0000000..444a0a4 --- /dev/null +++ b/lua/config/colorizer.lua @@ -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' + } +) + diff --git a/lua/config/quickscope.lua b/lua/config/quickscope.lua new file mode 100644 index 0000000..0390c0b --- /dev/null +++ b/lua/config/quickscope.lua @@ -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 + diff --git a/lua/config/sneak.lua b/lua/config/sneak.lua new file mode 100644 index 0000000..314f8aa --- /dev/null +++ b/lua/config/sneak.lua @@ -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', 'Sneak_;') +map({'n', 'v'}, 'gs', 'Sneak_;') +-- map gS Sneak_, +-- map gs 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'] = '🔎' + diff --git a/lua/plugins.lua b/lua/plugins.lua index 5b130f3..52c1dd9 100644 --- a/lua/plugins.lua +++ b/lua/plugins.lua @@ -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 | PackerCompile - augroup end + augroup packer_user_config + autocmd! + autocmd BufWritePost plugins.lua source | 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 diff --git a/lua/sneak.lua b/lua/sneak.lua new file mode 100644 index 0000000..476d1d7 --- /dev/null +++ b/lua/sneak.lua @@ -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 Sneak_, +map gs 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 = '🔎' diff --git a/lua/themes/gruvbox.lua b/lua/themes/gruvbox.lua new file mode 100644 index 0000000..e62e903 --- /dev/null +++ b/lua/themes/gruvbox.lua @@ -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]] +