Skip to content

Abstract-IDE/abstract-autocmds

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 

Repository files navigation

Useful autocmds for Neovim.

Installation and Uses.

using lazy.nvim

All commands are disabled by default.

{
	"Abstract-IDE/abstract-autocmds",
	lazy = false,
	config = function()
		require("abstract-autocmds").setup({
			auto_resize_splited_window = true,
			remove_whitespace_on_save = true,
			no_autocomment_newline = true,
			clear_last_used_search = true,
			open_file_last_position = true,
			highlight_on_yank = {
				enable = true,
				opts = {
					timeout = 150,
				},
			},
			give_border = {
				enable = true,
				opts = {
					pattern = { "null-ls-info", "lspinfo" },
				},
			},
			smart_dd = true,
			visually_codeblock_shift = true,
			move_selected_upndown = true,
			go_back_normal_in_terminal = true,
			ctrl_backspace_delete = {
				enable = true,
				opts = {
					insert_mode = true,
					cmd_mode = false,
				},
			},
			smart_visual_paste = true,
			dont_suspend_with_cz = true,
			smart_save_in_insert_mode = true,
			scroll_from_center = true,
			search_within_visual = true,
		})
	end,
}

Available autocmds

Automatically resizes split windows in tabs to maintain equal sizes when the Vim window is resized.

auto_resize_splited_window = true

Removes trailing whitespace from each line when saving a buffer

remove_whitespace_on_save = true

Prevents Neovim from automatically adding comments to new lines when entering a buffer or changing its file type.

no_autocomment_newline = true

Clears the last used search pattern when entering a buffer window

clear_last_used_search = true

Jumps to the last cursor position when reopening a file

open_file_last_position = true

Highlights text when yanked in Neovim, using the specified timeout and applying the highlighting to the "Search" highlight group.

highlight_on_yank = {
    enable = true,
    opts = {
        timeout = 150,
    },
}

Enables border decoration for specific patterns

give_border = {
    enable = true,
    opts = {
        pattern = { "null-ls-info", "lspinfo" },
    },
}

smart deletion functionality for the "dd" command. If the current line is empty, it deletes the line without affecting the yank register. Otherwise, it behaves like the standard "dd" command.

smart_dd = true

Facilitates the movement of code blocks by allowing users to enter visual mode (v), select several lines of code, and then press ">" or "<" several times to shift the selected block of code.

visually_codeblock_shift = true

Enables moving the selected line(s) up or down in visual mode. Pressing "J" moves the selected lines down, while "K" moves them up.

move_selected_upndown = true

Provides a way to return to normal mode within Neovim's terminal, ensuring compatibility with plugins like floaterm. It maps the Escape key in terminal mode to the key sequence <c->, which switches back to normal mode.

go_back_normal_in_terminal = true

Enables deleting a word backward in insert or/and command mode using Ctrl+Backspace.

ctrl_backspace_delete = {
	enable = true,
	opts = {
		insert_mode = true,
		cmd_mode = false,
	},
},

Paste in visual mode without overwriting the yank register DEFAULT BEHAVIPR: in visual mode ('x'), pressing 'p' replaces the selected text with the content of the default register, effectively pasting the last deleted or yanked text.

smart_visual_paste = true

Prevents Neovim from suspending with Ctrl+Z when entering a buffer, ensuring that it doesn't suspend the terminal.

dont_suspend_with_cz = true

Enables saving the buffer when it has been modified, triggered by pressing Ctrl+S in insert mode or normal mode.

smart_save_in_insert_mode = true

Enhances scrolling behavior in normal mode, allowing scrolling up/down from the center of the screen.

scroll_from_center = true

Releases

No releases published

Packages

No packages published

Languages