diff --git a/CHEATSHEET.md b/CHEATSHEET.md index 2dd6d0e..9b0ee1c 100644 --- a/CHEATSHEET.md +++ b/CHEATSHEET.md @@ -1,5 +1,9 @@ # Neovim cheatsheet for this setup +## Frequent use cases + +### Files navigation + ## Save and exit diff --git a/README.md b/README.md index df30541..f44cf4e 100644 --- a/README.md +++ b/README.md @@ -1,19 +1,25 @@ # Basic neovim configuration +Focused on cognitive load reduction and productivity. + +## Helps mechanisms To open [CHEATSHEET.md](./CHEATSHEET.md): `h`. To open [README.md](./README.md): `hr` -## Used package +## Selected packages -- [x] kanagawa: color schema -- [x] oil: files manager -- [x] mini-statusline - -## References - - - https://www.youtube.com/watch?v=g1gyYttzxcI +- kanagawa: color schema +- oil: files manager +- mini-statusline +- vim-sleuth: autodetect file indentation rules/policies +- showkeys: show typped keys +- smear-cursor: visual cue of motion +### mainstream packages +- lazy +- treesitter +- telescope diff --git a/REFERENCES.md b/REFERENCES.md new file mode 100644 index 0000000..5a679a5 --- /dev/null +++ b/REFERENCES.md @@ -0,0 +1,6 @@ + +## References + + - https://www.youtube.com/watch?v=g1gyYttzxcI + + diff --git a/TODO.md b/TODO.md new file mode 100644 index 0000000..0d7a2fe --- /dev/null +++ b/TODO.md @@ -0,0 +1,7 @@ +# Problems and missing features + + +## Files browsing + +- [ ] open oil in the current file directory +- [ ] see the current path of oil diff --git a/init.lua b/init.lua index 551ec67..db3d321 100644 --- a/init.lua +++ b/init.lua @@ -1,2 +1,6 @@ -require("config.lazy") + +require("config.keymap") +require("config.options") +require("config.lazy") +require("config.clipboard") diff --git a/lazy-lock.json b/lazy-lock.json index 6124fb6..fe5c3c6 100644 --- a/lazy-lock.json +++ b/lazy-lock.json @@ -3,6 +3,10 @@ "lazy.nvim": { "branch": "main", "commit": "85c7ff3711b730b4030d03144f6db6375044ae82" }, "mini.icons": { "branch": "main", "commit": "ff2e4f1d29f659cc2bad0f9256f2f6195c6b2428" }, "mini.statusline": { "branch": "main", "commit": "e331175f10d9f400b42523b3890841aba202ce16" }, + "nvim-treesitter": { "branch": "master", "commit": "42fc28ba918343ebfd5565147a42a26580579482" }, "oil.nvim": { "branch": "master", "commit": "7e1cd7703ff2924d7038476dcbc04b950203b902" }, - "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" } + "showkeys": { "branch": "main", "commit": "cb0a50296f11f1e585acffba8c253b9e8afc1f84" }, + "smear-cursor.nvim": { "branch": "main", "commit": "abfa5835920b1d76c0e24e1465a618ad914be90a" }, + "vim-sleuth": { "branch": "master", "commit": "be69bff86754b1aa5adcbb527d7fcd1635a84080" }, + "zenbones.nvim": { "branch": "main", "commit": "a934bc07d2ed4a98b74526c172d7f043736d8935" } } diff --git a/lua/config/clipboard.lua b/lua/config/clipboard.lua new file mode 100644 index 0000000..b035b62 --- /dev/null +++ b/lua/config/clipboard.lua @@ -0,0 +1,23 @@ + +local function paste() + return { + vim.fn.split(vim.fn.getreg(""), "\n"), + vim.fn.getregtype(""), + } +end + +vim.g.clipboard = { + name = "OSC 52", + copy = { + ["+"] = require("vim.ui.clipboard.osc52").copy("+"), + ["*"] = require("vim.ui.clipboard.osc52").copy("*"), + }, + paste = { + ["+"] = paste, + ["*"] = paste, + }, +} + +vim.opt.clipboard:append { 'unnamed', 'unnamedplus' } + + diff --git a/lua/config/keymap.lua b/lua/config/keymap.lua index 4fff024..1301f35 100644 --- a/lua/config/keymap.lua +++ b/lua/config/keymap.lua @@ -1,3 +1,11 @@ + +local km = vim.keymap.set + +--remaps +vim.g.mapleader = " " +vim.g.maplocalleader = "," + +-- oil vim.keymap.set('n', "-", "Oil --float", { desc ="Enter file explorer (Oil)" }) vim.keymap.set('n', "w", "w", { desc = "Save" } ) @@ -8,6 +16,12 @@ vim.keymap.set('n', "wq", "wq", { desc = "Save and quit" } ) vim.keymap.set('n', "qq", "q!", { desc = "Force to quit without saving" } ) +-- TERMINAL +-- exit t mode +km("t", "", "", { desc = "Exit terminal mode"}) +km("n", "t" , "term", { desc = "Create a terminal" } ) + + -- todo: this is not robust... add autocompletion and verify that file exists vim.keymap.set("n", "e", function() local file_name = vim.fn.input("Open file: ") @@ -16,11 +30,14 @@ vim.keymap.set("n", "e", function() end end, { desc = "edit a file"}) +-- BUFFERS navigation and manipulation vim.keymap.set("n","ls", "ls", { desc = "list buffers" }) vim.keymap.set("n","f", "bnext", { desc = "goto next buffers" }) vim.keymap.set("n","d", "bprevious", { desc = "goto previous buffers" }) vim.keymap.set("n","c", "bd", { desc = "close buffers" }) + +-- CUSTOM HELP FILES vim.keymap.set("n", "h", function() local config_path = vim.fn.stdpath('config') local readme_path = config_path .. '/CHEATSHEET.md' diff --git a/lua/config/lazy.lua b/lua/config/lazy.lua index c69b300..6641181 100644 --- a/lua/config/lazy.lua +++ b/lua/config/lazy.lua @@ -18,8 +18,6 @@ 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({ @@ -34,5 +32,3 @@ require("lazy").setup({ checker = { enabled = true }, }) -require("config.keymap") -require("config.options") diff --git a/lua/config/options.lua b/lua/config/options.lua index 2057548..9c91c13 100644 --- a/lua/config/options.lua +++ b/lua/config/options.lua @@ -22,5 +22,23 @@ vim.o.signcolumn = "yes" vim.o.list = true vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' } - - +--[[ +-- Set options +vim.opt.number = true +vim.opt.relativenumber = true +vim.opt.mouse = 'a' +vim.opt.ignorecase = true +vim.opt.smartcase = true +vim.opt.hlsearch = true +vim.opt.wrap = true +vim.opt.breakindent = true +vim.opt.tabstop = 2 +vim.opt.shiftwidth = 2 +vim.opt.expandtab = true +vim.opt.signcolumn = "yes" +vim.opt.termguicolors = true +vim.opt.updatetime = 250 +vim.opt.timeoutlen = 300 +vim.opt.undofile = true +vim.opt.completeopt = "menu,menuone,noselect" +]] diff --git a/lua/plugins/kanagawa.lua b/lua/plugins/kanagawa.lua index 1081741..4ca503c 100644 --- a/lua/plugins/kanagawa.lua +++ b/lua/plugins/kanagawa.lua @@ -1,14 +1,13 @@ return { "rebelot/kanagawa.nvim", opt = {}, config = function() - require("kanagawa").setup({ -compile = true, - -transparent = true - }); -vim.cmd("colorscheme kanagawa"); -end, -build = function() - vim.cmd("KanagawaCompile"); -- this line fail at first install -end, + require("kanagawa").setup({ + compile = true, + transparent = true + }); + vim.cmd("colorscheme kanagawa"); + end, + build = function() + vim.cmd("KanagawaCompile"); -- this line fail at first install + end, } diff --git a/lua/plugins/oil.lua b/lua/plugins/oil.lua index 8f5d6ff..c7b0326 100644 --- a/lua/plugins/oil.lua +++ b/lua/plugins/oil.lua @@ -8,4 +8,11 @@ return { -- dependencies = { "nvim-tree/nvim-web-devicons" }, -- use if you prefer nvim-web-devicons -- Lazy loading is not recommended because it is very tricky to make it work correctly in all situations. lazy = false, + config = function() + require("oil").setup({ + view_options = { + show_hidden = true; + }, + }); + end } diff --git a/lua/plugins/showkeys.lua b/lua/plugins/showkeys.lua new file mode 100644 index 0000000..16cc47b --- /dev/null +++ b/lua/plugins/showkeys.lua @@ -0,0 +1,10 @@ +return { + "nvzone/showkeys", + enabled = false, + cmd = "ShowkeysToggle", + opts = { + timeout = 1, + maxkeys = 5, + -- more opts + } +} diff --git a/lua/plugins/smear-cursor.lua b/lua/plugins/smear-cursor.lua new file mode 100644 index 0000000..0032e20 --- /dev/null +++ b/lua/plugins/smear-cursor.lua @@ -0,0 +1,4 @@ +return { + "sphamba/smear-cursor.nvim", + opts = {}, +} diff --git a/lua/plugins/treesitter.lua b/lua/plugins/treesitter.lua new file mode 100644 index 0000000..d05eb4f --- /dev/null +++ b/lua/plugins/treesitter.lua @@ -0,0 +1,33 @@ +-- treesitter +return { + "nvim-treesitter/nvim-treesitter", + build = ":TSUpdate", + config = function() + -- treesitter config + local config = require("nvim-treesitter.configs") + config.setup({ + ignore_install = {}, + ensure_installed = { + "vimdoc", + "go", + "rust", + "c", + "lua", + "python", + "html", + "css", + "javascript", + "typescript", + "sql", + "markdown", + }, + highlight = { + enable = true, + }, + indent = { enable = true }, + modules = {}, + sync_install = true, + auto_install = true, + }) + end +} diff --git a/lua/plugins/zenbone.lua b/lua/plugins/zenbone.lua new file mode 100644 index 0000000..3d882a0 --- /dev/null +++ b/lua/plugins/zenbone.lua @@ -0,0 +1,19 @@ + return { + "zenbones-theme/zenbones.nvim", + -- Optionally install Lush. Allows for more configuration or extending the colorscheme + -- If you don't want to install lush, make sure to set g:zenbones_compat = 1 + -- In Vim, compat mode is turned on as Lush only works in Neovim. + -- dependencies = "rktjmp/lush.nvim", + lazy = false, + priority = 1000, + config = function() + -- set g:zenbones_compat = 1 + vim.g.zenbones_compat = 1 + end + -- you can set set configuration options here + -- config = function() + -- vim.g.zenbones_darken_comments = 45 + -- vim.cmd.colorscheme('zenbones') + -- end + } +