diff --git a/init.lua b/init.lua new file mode 100644 index 0000000..6b25163 --- /dev/null +++ b/init.lua @@ -0,0 +1,4 @@ +require("config.lazy") + +require("config.behaviour") +require("config.keymap") diff --git a/lua/config/behaviour.lua b/lua/config/behaviour.lua new file mode 100644 index 0000000..4f86cf8 --- /dev/null +++ b/lua/config/behaviour.lua @@ -0,0 +1,37 @@ +-- Encoding +vim.opt.encoding = "UTF-8" + +-- Line numbers +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.cursorline = true + +-- Formatting +-- -- Indent +vim.opt.shiftwidth = 4 +vim.opt.tabstop = 4 +vim.opt.autoindent = true +vim.opt.expandtab = false + +-- Terminal +vim.opt.wildmenu = true +vim.opt.showcmd = true +vim.opt.showmatch = true + +-- Mouse +vim.opt.mouse = "a" + +-- Copy +vim.g.clipboard = { + name = 'WslClipboard', + copy = { + ["+"] = 'clip.exe', + ["*"] = 'clip.exe', + }, + paste = { + ["+"] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', + ["*"] = 'powershell.exe -c [Console]::Out.Write($(Get-Clipboard -Raw).tostring().replace("`r", ""))', + }, + cache_enabled = 0, +} +vim.api.nvim_set_option("clipboard","unnamed") -- Always copy to clipboard diff --git a/lua/config/keymap.lua b/lua/config/keymap.lua new file mode 100644 index 0000000..21f8206 --- /dev/null +++ b/lua/config/keymap.lua @@ -0,0 +1,16 @@ +--vim.keymap.set("", "", "", { remap = true }) + +-- Move by words +vim.keymap.set("", "", "b") +vim.keymap.set("", "", "e") +vim.keymap.set("", "", "b") +vim.keymap.set("", "", "e") +vim.keymap.set("i", "", "b") +vim.keymap.set("i", "", "e") + +-- Select +vim.keymap.set("", "", "ggVG") + +-- reselect visual selection after indentation +vim.keymap.set("v", "<", "< gv") +vim.keymap.set("v", ">", "> gv") diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua new file mode 100644 index 0000000..f5ee74c --- /dev/null +++ b/lua/config/lazy.lua @@ -0,0 +1,35 @@ +-- Bootstrap lazy.nvim +local lazypath = vim.fn.stdpath("data") .. "/lazy/lazy.nvim" +if not (vim.uv or vim.loop).fs_stat(lazypath) then + local lazyrepo = "https://github.com/folke/lazy.nvim.git" + local out = vim.fn.system({ "git", "clone", "--filter=blob:none", "--branch=stable", lazyrepo, lazypath }) + if vim.v.shell_error ~= 0 then + vim.api.nvim_echo({ + { "Failed to clone lazy.nvim:\n", "ErrorMsg" }, + { out, "WarningMsg" }, + { "\nPress any key to exit..." }, + }, true, {}) + vim.fn.getchar() + os.exit(1) + end +end +vim.opt.rtp:prepend(lazypath) + +-- Make sure to setup `mapleader` and `maplocalleader` before +-- loading lazy.nvim so that mappings are correct. +-- This is also a good place to setup other settings (vim.opt) +vim.g.mapleader = " " +vim.g.maplocalleader = "\\" + +-- Setup lazy.nvim +require("lazy").setup({ + spec = { + -- import your plugins + { import = "plugins" }, + }, + -- Configure any other settings here. See the documentation for more details. + -- colorscheme that will be used when installing plugins. + install = { colorscheme = { "habamax" } }, + -- automatically check for plugin updates + checker = { enabled = true }, +}) diff --git a/lua/plugins/filesystem.lua b/lua/plugins/filesystem.lua new file mode 100644 index 0000000..a564707 --- /dev/null +++ b/lua/plugins/filesystem.lua @@ -0,0 +1 @@ +return {} diff --git a/lua/plugins/looks.lua b/lua/plugins/looks.lua new file mode 100644 index 0000000..d4b9814 --- /dev/null +++ b/lua/plugins/looks.lua @@ -0,0 +1,11 @@ +return { + { + "nvim-lualine/lualine.nvim", + dependencies = { + "nvim-tree/nvim-web-devicons", + }, + config = function() + require('lualine').setup() + end, + }, +} diff --git a/lua/plugins/syntax.lua b/lua/plugins/syntax.lua new file mode 100644 index 0000000..486cc40 --- /dev/null +++ b/lua/plugins/syntax.lua @@ -0,0 +1,29 @@ +return { + { + "nvim-treesitter/nvim-treesitter", + event = { "BufReadPre", "BufNewFile" }, + build = ":TSUpdate", + opts = { + ensure_installed = { + -- must be installed + "c", "lua", "vim", "vimdoc", "query", "markdown", "markdown_inline", + + -- C + "cmake", + }, + sync_install = false, + auto_install = false, + highlight = { + enable = true, + additional_vim_regex_higlighting = false, + }, + indent = { + enable = true, + }, + incremental_selection = { + init_selection = "", + + }, + } + } +} diff --git a/lua/plugins/themes.lua b/lua/plugins/themes.lua new file mode 100644 index 0000000..9e54083 --- /dev/null +++ b/lua/plugins/themes.lua @@ -0,0 +1,13 @@ +return { + { + "tiagovla/tokyodark.nvim", + opts = { + lazy = false, + priority = 100, + }, + config = function(_, opts) + require("tokyodark").setup(opts) -- calling setup is optional + vim.cmd [[colorscheme tokyodark]] + end, + } +}