nvim: added smooth scrolling and fixed toggleterm

This commit is contained in:
PowerUser64 2021-09-20 02:48:09 -07:00
parent 2dcac10784
commit c1b71e559f
4 changed files with 37 additions and 26 deletions

View file

@ -11,8 +11,8 @@ require('plugins')
-- [x] map A-S to toggle spell check (see logic from hlsearch section in init.vim)
--
-- Plugins to Configure
-- [ ] toggleterm
-- [ ] neoscroll
-- [x] toggleterm
-- [x] neoscroll
-- [x] cmp
-- [x] lspkind
-- [x] lspsignature

View file

@ -44,15 +44,14 @@ end -- <<<
M.toggleterm = function()
require("toggleterm").setup{
-- size can be a number or function which is passed the current terminal
-- size = 20 | function(term)
-- if term.direction == "horizontal" then
-- return 15
-- elseif term.direction == "vertical" then
-- return vim.o.columns * 0.4
-- end
-- end,
size = function(term)
if term.direction == "horizontal" then
return 15
elseif term.direction == "vertical" then
return vim.o.columns * 0.4
end
end,
open_mapping = [[<c-\>]],
toggleterm_terminal_mapping = '<Leader>t',
hide_numbers = true, -- hide the number column in toggleterm buffers
shade_filetypes = {},
shade_terminals = true,
@ -60,7 +59,7 @@ M.toggleterm = function()
start_in_insert = true,
insert_mappings = true, -- whether or not the open mapping applies in insert mode
persist_size = true,
direction = 'vertical', -- | 'horizontal' | 'window' | 'float',
direction = 'float', -- vertical, horizontal, window, or float
close_on_exit = true, -- close the terminal window when the process exits
-- shell = vim.o.shell, -- change the default shell
-- This field is only relevant if direction is set to 'float'
@ -69,10 +68,10 @@ M.toggleterm = function()
-- see :h nvim_open_win for details on borders however
-- the 'curved' border is a custom border type
-- not natively supported but implemented in this plugin.
border = 'single',
border = 'curved', -- single, double, shadow, or curved
width = 120,
height = 32,
winblend = 3,
winblend = 10, -- transparancy
highlights = {
border = "Normal",
background = "Normal",
@ -152,6 +151,24 @@ M.gitsigns = function()
}
end -- <<<
-- neoscroll for smooth scrolling >>>
M.neoscroll = function()
require('neoscroll').setup({
-- All these keys will be mapped to their corresponding default scrolling animation
mappings = {'<C-u>', '<C-d>', '<C-b>', '<C-f>',
'<C-y>', '<C-e>', 'zt', 'zz', 'zb',},
hide_cursor = true, -- Hide cursor while scrolling
stop_eof = true, -- Stop at <EOF> when scrolling downwards
use_local_scrolloff = false, -- Use the local scope of scrolloff instead of the global scope
respect_scrolloff = false, -- Stop scrolling when the cursor reaches the scrolloff margin of the file
cursor_scrolls_alone = true, -- The cursor will keep on scrolling even if the window cannot scroll further
easing_function = 'sine', -- use sine easing function
pre_hook = nil, -- Function to run before the scrolling animation starts
post_hook = nil, -- Function to run after the scrolling animation ends
})
end
-- <<<
-- Autosession >>>
M.autosession = function()
local opts = {

View file

@ -73,10 +73,7 @@ return require('packer').startup(function()
require('lsp').cmp()
end,
requires = { -- nvim-cmp sources
-- snippet integration
-- "hrsh7th/cmp-vsnip",
"saadparwaiz1/cmp_luasnip",
"saadparwaiz1/cmp_luasnip", --luasnip integration
"hrsh7th/cmp-path",
"hrsh7th/cmp-nvim-lsp",
"hrsh7th/cmp-buffer",
@ -138,14 +135,9 @@ return require('packer').startup(function()
}
use { -- Smooth Scrolling
"karb94/neoscroll.nvim",
-- disable = not plugin_status.neoscroll,
-- opt = true,
-- config = function()
-- require("plugins.configs.others").neoscroll()
-- end,
-- setup = function()
-- require("core.utils").packer_lazy_load "neoscroll.nvim"
-- end,
config = function()
require('other').neoscroll()
end,
}
use { -- automatic session management
'rmagatti/auto-session',
@ -153,7 +145,7 @@ return require('packer').startup(function()
require('other').autosession()
end
}
use {
use { -- markdown preview
'ellisonleao/glow.nvim',
ft = { 'md', 'markdown', }
}

View file

@ -23,6 +23,8 @@ vim.cmd [[
syntax on
set redrawtime=1000 " max syntax highlight time
set number relativenumber
autocmd InsertEnter * :set norelativenumber " Automatically toggle line numbers
autocmd InsertLeave * :set relativenumber
set noerrorbells
set encoding=UTF-8
set cursorline