diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index 2b9eda8..9d5204f 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -9,10 +9,11 @@ require('plugins') -- -- Misc: -- [x] map A-S to toggle spell check (see logic from hlsearch section in init.vim) +-- [ ] remove luasnip -- -- Plugins to Configure --- [ ] toggleterm --- [ ] neoscroll +-- [x] toggleterm +-- [x] neoscroll -- [x] cmp -- [x] lspkind -- [x] lspsignature diff --git a/.config/nvim/lua/other.lua b/.config/nvim/lua/other.lua index 34e7939..0a9e5a0 100644 --- a/.config/nvim/lua/other.lua +++ b/.config/nvim/lua/other.lua @@ -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 = [[]], - toggleterm_terminal_mapping = '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 = {'', '', '', '', + '', '', 'zt', 'zz', 'zb',}, + hide_cursor = true, -- Hide cursor while scrolling + stop_eof = true, -- Stop at 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 = { diff --git a/.config/nvim/lua/plugins.lua b/.config/nvim/lua/plugins.lua index 9222899..a9f4d84 100644 --- a/.config/nvim/lua/plugins.lua +++ b/.config/nvim/lua/plugins.lua @@ -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', diff --git a/.config/nvim/lua/settings.lua b/.config/nvim/lua/settings.lua index ae9c57f..e787f58 100644 --- a/.config/nvim/lua/settings.lua +++ b/.config/nvim/lua/settings.lua @@ -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 diff --git a/.local/bin/dotfiles-init.sh b/.local/bin/dotfiles-init.sh new file mode 100755 index 0000000..a9dddcd --- /dev/null +++ b/.local/bin/dotfiles-init.sh @@ -0,0 +1,40 @@ +#!/bin/sh +# this will setup a bare git repo for managing dotfiles. You should only run this script once per set of dotfiles. +# credit for this idea and basic script outline goes to: https://www.atlassian.com/git/tutorials/dotfiles + +set -e + +# name the path to the dotfiles repo +DOTFILES_REPO_DIR="$HOME/git/dotfiles" + +# Some colors to spice things up + Cyan="$( tput setaf 6 )" +Green="$( tput setaf 2 )" + NC="$( tput sgr0 )" # No Color + +# check for the git command and exit if it doesn't exist +if ! command -v git > /dev/null;then + echo 'git is not installed or could not be found in $PATH, please install git to proceed' + exit 1 +fi + +# an "alias" for the git command for use by the script +dot() { + git --git-dir="$DOTFILES_REPO_DIR" --work-tree="$HOME" "$@" +} + + +mkdir -p "$DOTFILES_REPO_DIR" +if git init --bare "$DOTFILES_REPO_DIR" > /dev/null 2>&1; then + echo "A bare git repository has been initialized at $DOTFILES_REPO_DIR" + echo +else + echo 'git repository initialization failed' + exit +fi +dot config --local status.showUntrackedFiles no +echo "Please add this alias to your shell's init script:" +# looks like this: alias dot="git --git-dir="/path/to/repo" --work-tree=\"$HOME\"" +echo " ${Cyan}alias dot=${Green}\"git --git-dir=\"$DOTFILES_REPO_DIR\" --work-tree=\\\"\$HOME\\\"\"${NC}" +echo "Then, you can use the command '${Cyan}dot ${Green}add ${NC}' to add a given file to the repo" + diff --git a/.zshrc b/.zshrc index 1e34757..c05f77c 100644 --- a/.zshrc +++ b/.zshrc @@ -159,12 +159,16 @@ done } - # an improved way to manage the todo list + # a simple way to manage your todo list # Usage: - # todo -- edit ~/todo - # todo auto -- commit ~/todo and push with message 'todo' - # todo [git command string] -- manage todo for easy syncing, assuming ~/todo is + # todo -- edit ~/todo + # todo auto -- commit and push ~/todo with message 'todo' + # todo [any git command] -- manage todo for easy syncing, assuming ~/todo is # a symlink that points to a file in a git repo + # + # Suggested use: make a git repo for holding your todo list, then make + # a symlink called 'todo' that points to your todo list in your home directory + # todo() { ( # subshell to protect against directory changes todo_dir="$(dirname "$(realpath ~/todo)")" @@ -173,7 +177,8 @@ $EDITOR ~/todo elif [ "$@" = 'auto' ];then cd "$todo_dir" - git commit "$(realpath ~/todo)" -m 'todo' && todo push + git commit "$(realpath ~/todo)" -m 'todo' + git push else cd "$todo_dir" git $@ @@ -631,5 +636,6 @@ add-zsh-hook preexec mzc_termsupport_preexec # Optionally source the user's customized .zshrc [ -f "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshrc.local" ] && source "${XDG_CONFIG_HOME:-$HOME/.config}/shell/zshrc.local" || return 0 -# vim:fdm=marker:fmr=>>>,<<<:et:ft=zsh:sw=3 +# filetype is sh for language server +# vim:fdm=marker:fmr=>>>,<<<:et:ft=sh:sw=3