commit ed7d4f13941091b81ce5086f56aeb8172565d641 Author: Abu Abacus Date: Sat Jan 3 17:46:42 2026 +0100 Initial check in diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..a2c480f --- /dev/null +++ b/.gitignore @@ -0,0 +1,4 @@ +*~ +/plugin +/doc/neovim/.obsidian + diff --git a/doc/neovim/0 - Prerequisities.md b/doc/neovim/0 - Prerequisities.md new file mode 100644 index 0000000..32ba9b9 --- /dev/null +++ b/doc/neovim/0 - Prerequisities.md @@ -0,0 +1,9 @@ + +| Environment variable | Path | +| :- | :- | +|XDG_CONFIG_HOME| z:\\home\\.config| +|XDG_DATA_HOME|z:\\home\\.data| + +### Folder structure + +~/.config/nvim diff --git a/doc/neovim/1 - Basic install.md b/doc/neovim/1 - Basic install.md new file mode 100644 index 0000000..e69de29 diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..27b40dd --- /dev/null +++ b/init.lua @@ -0,0 +1,5 @@ + + +require( "roka.core.options") +require( "roka.core.keymaps") +require( "roka.core.plugins") diff --git a/lua/roka/core/keymaps.lua b/lua/roka/core/keymaps.lua new file mode 100644 index 0000000..7c4d5a3 --- /dev/null +++ b/lua/roka/core/keymaps.lua @@ -0,0 +1,103 @@ +vim.g.mapleader = " " + +local keymap = vim.keymap + +-- Modes +-- +-- "n" = normal mode +-- "i" = insert mode +-- "v" = visual mode +-- "x" = visual block mode +-- "t" = term mode +-- "c" = command mode +-- + +-- ---------------------------------------------------------------------------- +-- Normal +-- ---------------------------------------------------------------------------- +-- Window splitting +keymap.set( "n", "sv", "v" ) -- split widow vertically +keymap.set( "n", "sh", "s" ) -- split widow horizontaly +keymap.set( "n", "se", "=" ) -- make split windows equal width +keymap.set( "n", "sx", ":close" ) -- close window +keymap.set( "n", "sm", ":MaximizerToggle" ) + +-- Window navigation +keymap.set( "n", "", "h") +keymap.set( "n", "", "j") +keymap.set( "n", "", "k") +keymap.set( "n", "", "l") + +-- Resize window with arrows +keymap.set( "n", "", ":vertical resize -2") +keymap.set( "n", "", ":vertical resize +2") +keymap.set( "n", "", ":resize +2") +keymap.set( "n", "", ":resize -2") + +-- keymap.set( "n", "e", ":Lex 30 ") + +-- Buffers +keymap.set( "n", "", ":bnext" ) -- next buffer +keymap.set( "n", "", ":bprevious" ) -- prev buffer +keymap.set( "n", "", ":bd" ) -- delete buffer + +-- TABs +keymap.set( "n", "to", ":tabnew" ) -- open new tab +keymap.set( "n", "tx", ":tabclose" ) -- close current tab +keymap.set( "n", "tn", ":tabn" ) -- go to next tab +keymap.set( "n", "tp", ":tabp" ) -- go to prev tab + +-- diagnostic warning/error navigation +keymap.set( "n", "g[", vim.diagnostic.goto_prev) +keymap.set( "n", "g]", vim.diagnostic.goto_next) + +-- ---------------------------------------------------------------------------- +-- Insert mode +-- ---------------------------------------------------------------------------- +keymap.set("i", "jk", "") + +-- ---------------------------------------------------------------------------- +-- Visual mode +-- ---------------------------------------------------------------------------- +-- Stay in indent mode +keymap.set("v", "<", "", ">gv") + +-- Visual Block -- +keymap.set("v", "", ":m .+1==") +keymap.set("v", "", ":m .-2==") +keymap.set("v", "p", '"_dP') + +-- Move text up and down +keymap.set( "x", "J", ":move '>+1gv-gv") +keymap.set( "x", "K", ":move '<-2gv-gv") +keymap.set( "x", "", ":move '>+1gv-gv") +keymap.set( "x", "", ":move '<-2gv-gv") + + +-- Terminal -- +-- Better terminal navigation +keymap.set( "t", "", "h") +keymap.set( "t", "", "j") +keymap.set( "t", "", "k") +keymap.set( "t", "", "l") + +keymap.set("n", "nh", ":nohl") +keymap.set("n", "x", '"_x"') + +keymap.set("n", "", ":tabn") -- go to next tab +keymap.set("n", "", ":tabp") -- go to prev tab +-- plugin keymaps + +-- nvim-tree +keymap.set("n", "e", ":NvimTreeToggle") + +-- telescope +keymap.set("n", "ff", ":Telescope find_files" ) +keymap.set("n", "fs", ":Telescope live_grep" ) +keymap.set("n", "fc", ":Telescope grep_string") +keymap.set("n", "fb", ":Telescope buffers" ) +keymap.set("n", "fh", ":Telescope help_tags" ) + +keymap.set("n", "x", "lua require'telescope.builtin'.find_files(require('telescope.themes').get_dropdown({ previewer = false }))") +keymap.set("n", "", "Telescope live_grep") diff --git a/lua/roka/core/options.lua b/lua/roka/core/options.lua new file mode 100644 index 0000000..c34f6c4 --- /dev/null +++ b/lua/roka/core/options.lua @@ -0,0 +1,113 @@ +local opt = vim.opt + +-- [[ Font ]] +--opt.guifont = { "SauceCodePro NF:h11:r:#e-subpixelantialias:#h-none" } +--opt.guifont = { "BlexMono NFM:h11:l:i:#e-subpixelantialias:#h-none" } +opt.guifont = { "BlexMono NFM:h11:l:#e-subpixelantialias:#h-none" } + +-- [[ Context ]] +opt.number = true -- set numbered lines +opt.relativenumber = true -- show relative numbers +opt.numberwidth = 4 -- set line number column width to 4 +opt.colorcolumn = '100' -- show color for max line length + +-- [[ Whitespace ]] +opt.expandtab = true -- convert tabs to spaces +opt.shiftwidth = 4 -- size of an indent +opt.softtabstop = 4 -- number of spaces tabs count for in insert mode +opt.tabstop = 4 -- number of spaces tabs count for + +opt.autoindent = true + +-- [[ Filetypes ]] +opt.encoding = 'utf8' -- string encoding +opt.fileencoding = 'utf8' -- file encoding + +-- [[ Theme ]] +opt.syntax = 'ON' -- allow syntax highlighting +opt.termguicolors = true -- set term gui colors (most terminals support this) + +-- ------------------------------------------------------------------------------------------------ +-- line wrapping +-- ------------------------------------------------------------------------------------------------ +opt.wrap = false -- display lines as one long line + +-- ------------------------------------------------------------------------------------------------ +-- search settings +-- ------------------------------------------------------------------------------------------------ +-- [[ Search ]] +opt.ignorecase = true -- ignore case in search patterns +opt.smartcase = true -- override ignorecase if search contains capital +opt.incsearch = true -- use incremental search +opt.hlsearch = true -- highlight search matches + +-- ------------------------------------------------------------------------------------------------ +-- cursor line +-- ------------------------------------------------------------------------------------------------ +opt.cursorline = false -- highlight the current line + +-- ------------------------------------------------------------------------------------------------ +-- appearance +-- ------------------------------------------------------------------------------------------------ + +opt.background = "dark" +opt.signcolumn = "yes" -- always show the sign column, otherwise it would shift the text each time +opt.scrolloff = 4 -- is one of my fav +opt.sidescrolloff = 4 -- The minimal number of screen columns to keep +opt.cmdheight = 1 -- more space in the neovim command line for displaying messages + +vim.cmd([[ +set noshowmode +]]) + + +-- ------------------------------------------------------------------------------------------------ +-- backspace +-- ------------------------------------------------------------------------------------------------ +opt.backspace = "indent,eol,start" + +-- ------------------------------------------------------------------------------------------------ +-- split windows +-- ------------------------------------------------------------------------------------------------ +-- [[ Splits ]] +opt.splitright = true -- place new window to right of current one +opt.splitbelow = true -- place new window below the current one + +-- ------------------------------------------------------------------------------------------------ +-- AutoCompletion +-- +-- set the completeopt to have a better completion experience +-- :help completeopt +-- +-- menuone : popup even when there's only one match +-- noinsert : do not insert text until a selection is made +-- noselect : do not select, force to select one from the menu +-- shortmess : avoid showing extra messages when using completion +-- updatetime : set updatetime for CursorHold +-- ------------------------------------------------------------------------------------------------ +opt.completeopt = {'menuone', 'noselect', 'noinsert'} +opt.shortmess = opt.shortmess + { c = true} +opt.updatetime = 100 +--vim.api.nvim_set_option( 'updatetime', 300) + +-- fixed column for diagnostic to appear +-- show autodiagnostic popup on cursor hover_range +-- goto previous/next diagnostic warning/error +-- show inlay_hints more frequently +vim.cmd([[ +set signcolumn=yes +autocmd CursorHold * lua vim.diagnostic.open_float(nil, { focusable = false }) +]]) + +-- ------------------------------------------------------------------------------------------------ +-- clipboard +-- ------------------------------------------------------------------------------------------------ +opt.clipboard:append("unnamedplus") -- allows neovim to access the system clipboard +opt.iskeyword:append("-") + +--vim.g.neovide_cursor_vfx_mode = "" +--vim.g.neovide_cursor_animation_length = 0 +--vim.g.neovide_transparency = 1.0 +--vim.g.neovide_remember_window_size = true +---- vim.g.neovide_profiler =false +--vim.g.neovide_scroll_animation_length = 0.0 diff --git a/lua/roka/core/plugins.lua b/lua/roka/core/plugins.lua new file mode 100644 index 0000000..585210b --- /dev/null +++ b/lua/roka/core/plugins.lua @@ -0,0 +1,72 @@ +local fn = vim.fn + +-- ---------------------------------------------------------------------------- +-- Automatically install packer +-- ---------------------------------------------------------------------------- +local install_path = fn.stdpath "data" .. "/site/pack/packer/start/packer.nvim" + +if fn.empty(fn.glob(install_path)) > 0 then + PACKER_BOOTSTRAP = fn.system { + "git", + "clone", + "--depth", + "1", + "https://github.com/wbthomason/packer.nvim", + install_path, + } + + print "Installing packer. Close and reopen Neovim..." + + vim.cmd [[ + packadd packer.nvim + ]] +end + +-- ---------------------------------------------------------------------------- +-- Autocommand that reloads neovim whenever you save the plugins.lua file +-- ---------------------------------------------------------------------------- +vim.cmd [[ + augroup packer_user_config + autocmd! + autocmd BufWritePost plugins.lua source | PackerSync + augroup end +]] + +-- ---------------------------------------------------------------------------- +-- Use a protected call so we don't error out on first use +-- ---------------------------------------------------------------------------- +local status, packer = pcall(require, "packer") +if not status then + return +end + +-- ---------------------------------------------------------------------------- +-- Have packer use a popup window +-- ---------------------------------------------------------------------------- +packer.init { + display = { + open_fn = function() + return require("packer.util").float { border = "rounded" } + end, + }, +} + +-- ---------------------------------------------------------------------------- +-- Install plugins +-- ---------------------------------------------------------------------------- +return packer.startup(function(use) + + -- ------------------------------------------------------ + -- Have packer manage itself + -- ------------------------------------------------------ + use "wbthomason/packer.nvim" + + + -- ------------------------------------------------------------------- + -- 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) diff --git a/readme.md b/readme.md new file mode 100644 index 0000000..fe65074 --- /dev/null +++ b/readme.md @@ -0,0 +1,6 @@ +# Important !!! +after switching to another branch, the following folders must be deleted + +- delete `%XDG_CACHE_HOME%\nvim` folder +- delete `%XDG_CONFIG_HOME%\nvim\plugin` folder +- delete `%XDG_DATA_HOME%\nvim-data` folder