map c-w -> s && scroll to scroll+zz

This commit is contained in:
José Iêdo 2023-08-26 12:09:32 -03:00
parent 1a971cbdcf
commit b365948225

232
init.lua
View File

@ -1,49 +1,6 @@
--[[
=====================================================================
==================== READ THIS BEFORE CONTINUING ====================
=====================================================================
Kickstart.nvim is *not* a distribution.
Kickstart.nvim is a template for your own configuration.
The goal is that you can read every line of code, top-to-bottom, understand
what your configuration is doing, and modify it to suit your needs.
Once you've done that, you should start exploring, configuring and tinkering to
explore Neovim!
If you don't know anything about Lua, I recommend taking some time to read through
a guide. One possible example:
- https://learnxinyminutes.com/docs/lua/
And then you can explore or search through `:help lua-guide`
- https://neovim.io/doc/user/lua-guide.html
Kickstart Guide:
I have left several `:help X` comments throughout the init.lua
You should run that command and read that help section for more information.
In addition, I have some `NOTE:` items throughout the file.
These are for you, the reader to help understand what is happening. Feel free to delete
them once you know what you're doing, but they should serve as a guide for when you
are first encountering a few different constructs in your nvim config.
I hope you enjoy your Neovim journey,
- TJ
P.S. You can delete this when you're done too. It's your config now :)
--]]
-- Set <space> as the leader key
-- See `:help mapleader`
-- NOTE: Must happen before plugins are required (otherwise wrong leader will be used)
vim.g.mapleader = ' ' vim.g.mapleader = ' '
vim.g.maplocalleader = ' ' vim.g.maplocalleader = ' '
-- Install package manager
-- https://github.com/folke/lazy.nvim -- https://github.com/folke/lazy.nvim
-- `:help lazy.nvim.txt` for more info -- `:help lazy.nvim.txt` for more info
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim' local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
@ -143,122 +100,125 @@ require('lazy').setup({
{ {
-- Set lualine as statusline -- Set lualine as statusline
'nvim-lualine/lualine.nvim', 'nvim-lualine/lualine.nvim',
-- See `:help lualine.txt` -- See `:help lualine.txt`
opts = { opts = {
options = { options = {
icons_enabled = false, icons_enabled = false,
theme = 'onedark', theme = 'onedark',
component_separators = '|', component_separators = '|',
section_separators = '', section_separators = '',
},
}, },
}, },
},
{ {
-- Add indentation guides even on blank lines -- Add indentation guides even on blank lines
'lukas-reineke/indent-blankline.nvim', 'lukas-reineke/indent-blankline.nvim',
-- Enable `lukas-reineke/indent-blankline.nvim` -- Enable `lukas-reineke/indent-blankline.nvim`
-- See `:help indent_blankline.txt` -- See `:help indent_blankline.txt`
opts = { opts = {
char = '', char = '',
show_trailing_blankline_indent = false, show_trailing_blankline_indent = false,
},
},
-- "gc" to comment visual regions/lines
{ 'numToStr/Comment.nvim', opts = {} },
-- Fuzzy Finder (files, lsp, etc)
{
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system
-- requirements installed.
{
'nvim-telescope/telescope-fzf-native.nvim',
-- NOTE: If you are having trouble with this installation,
-- refer to the README for telescope-fzf-native for more instructions.
build = 'make',
cond = function()
return vim.fn.executable 'make' == 1
end,
}, },
}, },
},
{ -- "gc" to comment visual regions/lines
-- Highlight, edit, and navigate code { 'numToStr/Comment.nvim', opts = {} },
'nvim-treesitter/nvim-treesitter',
dependencies = { -- Fuzzy Finder (files, lsp, etc)
'nvim-treesitter/nvim-treesitter-textobjects', {
'nvim-telescope/telescope.nvim',
branch = '0.1.x',
dependencies = {
'nvim-lua/plenary.nvim',
-- Fuzzy Finder Algorithm which requires local dependencies to be built.
-- Only load if `make` is available. Make sure you have the system
-- requirements installed.
{
'nvim-telescope/telescope-fzf-native.nvim',
-- NOTE: If you are having trouble with this installation,
-- refer to the README for telescope-fzf-native for more instructions.
build = 'make',
cond = function()
return vim.fn.executable 'make' == 1
end,
},
},
}, },
build = ':TSUpdate',
},
-- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart {
-- These are some example plugins that I've included in the kickstart repository. -- Highlight, edit, and navigate code
-- Uncomment any of the lines below to enable them. 'nvim-treesitter/nvim-treesitter',
-- require 'kickstart.plugins.autoformat', dependencies = {
-- require 'kickstart.plugins.debug', 'nvim-treesitter/nvim-treesitter-textobjects',
},
build = ':TSUpdate',
},
-- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua` -- NOTE: Next Step on Your Neovim Journey: Add/Configure additional "plugins" for kickstart
-- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping -- These are some example plugins that I've included in the kickstart repository.
-- up-to-date with whatever is in the kickstart repo. -- Uncomment any of the lines below to enable them.
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going. -- require 'kickstart.plugins.autoformat',
-- -- require 'kickstart.plugins.debug',
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
-- { import = 'custom.plugins' },
}, {})
-- [[ Setting options ]] -- NOTE: The import below can automatically add your own plugins, configuration, etc from `lua/custom/plugins/*.lua`
-- See `:help vim.o` -- You can use this folder to prevent any conflicts with this init.lua if you're interested in keeping
-- NOTE: You can change these options as you wish! -- up-to-date with whatever is in the kickstart repo.
-- Uncomment the following line and add your plugins to `lua/custom/plugins/*.lua` to get going.
--
-- For additional information see: https://github.com/folke/lazy.nvim#-structuring-your-plugins
-- { import = 'custom.plugins' },
}, {})
-- Set highlight on search -- [[ Setting options ]]
vim.o.hlsearch = false -- See `:help vim.o`
-- NOTE: You can change these options as you wish!
-- Make line numbers default -- Set highlight on search
vim.wo.number = true vim.o.hlsearch = false
-- Enable mouse mode -- Make line numbers default
vim.o.mouse = 'a' vim.wo.number = true
-- Sync clipboard between OS and Neovim. -- Enable mouse mode
-- Remove this option if you want your OS clipboard to remain independent. vim.o.mouse = 'a'
-- See `:help 'clipboard'`
vim.o.clipboard = 'unnamedplus'
-- Enable break indent -- Sync clipboard between OS and Neovim.
vim.o.breakindent = true -- Remove this option if you want your OS clipboard to remain independent.
-- See `:help 'clipboard'`
vim.o.clipboard = 'unnamedplus'
-- Save undo history -- Enable break indent
vim.o.undofile = true vim.o.breakindent = true
-- Case-insensitive searching UNLESS \C or capital in search -- Save undo history
vim.o.ignorecase = true vim.o.undofile = true
vim.o.smartcase = true
-- Keep signcolumn on by default -- Case-insensitive searching UNLESS \C or capital in search
vim.wo.signcolumn = 'yes' vim.o.ignorecase = true
vim.o.smartcase = true
-- Decrease update time -- Keep signcolumn on by default
vim.o.updatetime = 250 vim.wo.signcolumn = 'yes'
vim.o.timeoutlen = 300
-- Set completeopt to have a better completion experience -- Decrease update time
vim.o.completeopt = 'menuone,noselect' vim.o.updatetime = 250
vim.o.timeoutlen = 300
-- NOTE: You should make sure your terminal supports this -- Set completeopt to have a better completion experience
vim.o.termguicolors = true vim.o.completeopt = 'menuone,noselect'
-- [[ Basic Keymaps ]] -- NOTE: You should make sure your terminal supports this
vim.o.termguicolors = true
-- Keymaps for better default experience -- [[ Basic Keymaps ]]
-- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true }) -- Keymaps for better default experience
-- See `:help vim.keymap.set()`
vim.keymap.set({ 'n', 'v' }, '<Space>', '<Nop>', { silent = true })
vim.keymap.set({ 'n', 'v' }, '<C-d>','<C-d>zz')
vim.keymap.set({ 'n', 'v' }, '<C-u>','<C-u>zz')
vim.keymap.set({ 'n', 'v' }, 's', '<C-w>')
-- Remap for dealing with word wrap -- Remap for dealing with word wrap
vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true }) vim.keymap.set('n', 'k', "v:count == 0 ? 'gk' : 'k'", { expr = true, silent = true })