From cc8be5490f043c14273cfb34bbe57f078427c78f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=88=D0=BE=D0=B2=D0=B0=D0=BD=20=D0=82=D0=BE=D0=BA=D0=B8?= =?UTF-8?q?=D1=9B-=D0=A8=D1=83=D0=BC=D0=B0=D1=80=D0=B0=D1=86?= Date: Sat, 10 Feb 2024 19:47:43 +0100 Subject: [PATCH] apply rework --- lua/options/keybind.lua | 3 +- lua/plugins/fterm.lua | 63 ++++++++++++++++++++++++++++++++++++++++ lua/plugins/init.lua | 1 + lua/plugins/keybind.lua | 59 +++++++++++++++++++++++++++++++++++++ lua/plugins/lazy.lua | 14 +++++++-- lua/plugins/lsp-zero.lua | 1 + 6 files changed, 138 insertions(+), 3 deletions(-) create mode 100644 lua/plugins/fterm.lua create mode 100644 lua/plugins/keybind.lua diff --git a/lua/options/keybind.lua b/lua/options/keybind.lua index b7ba50e..f1e1cc6 100755 --- a/lua/options/keybind.lua +++ b/lua/options/keybind.lua @@ -9,10 +9,11 @@ local options = { noremap = true } local cmd_options = { noremap = true, silent = true } +map("n", "tt", "lua require('FTerm').toggle()", options) + -- slef explanitory map("n", "tw", "lua MiniTrailspace.trim()", options) map("n", "fm", "NvimTreeToggle", options) -map("n", "tt", "12 split Tnew", options) -- remap keys so that they dont skip camelCase diff --git a/lua/plugins/fterm.lua b/lua/plugins/fterm.lua new file mode 100644 index 0000000..5dc3641 --- /dev/null +++ b/lua/plugins/fterm.lua @@ -0,0 +1,63 @@ +require('FTerm').setup({ + ---Filetype of the terminal buffer + ---@type string + ft = 'FTerm', + + ---Command to run inside the terminal + ---NOTE: if given string[], it will skip the shell and directly executes the command + ---@type fun():(string|string[])|string|string[] + cmd = os.getenv('SHELL'), + + ---Neovim's native window border. See `:h nvim_open_win` for more configuration options. + border = 'single', + + ---Close the terminal as soon as shell/command exits. + ---Disabling this will mimic the native terminal behaviour. + ---@type boolean + auto_close = false, + + ---Highlight group for the terminal. See `:h winhl` + ---@type string + hl = 'Normal', + + ---Transparency of the floating window. See `:h winblend` + ---@type integer + blend = 0, + + ---Object containing the terminal window dimensions. + ---The value for each field should be between `0` and `1` + ---@type table + dimensions = { + height = 0.8, -- Height of the terminal window + width = 0.8, -- Width of the terminal window + x = 0.5, -- X axis of the terminal window + y = 0.5, -- Y axis of the terminal window + }, + + ---Replace instead of extend the current environment with `env`. + ---See `:h jobstart-options` + ---@type boolean + clear_env = false, + + ---Map of environment variables extending the current environment. + ---See `:h jobstart-options` + ---@type table|nil + env = nil, + + ---Callback invoked when the terminal exits. + ---See `:h jobstart-options` + ---@type fun()|nil + on_exit = nil, + + ---Callback invoked when the terminal emits stdout data. + ---See `:h jobstart-options` + ---@type fun()|nil + on_stdout = nil, + + ---Callback invoked when the terminal emits stderr data. + ---See `:h jobstart-options` + ---@type fun()|nil + on_stderr = nil, +}) + + diff --git a/lua/plugins/init.lua b/lua/plugins/init.lua index 8bc2817..35c37ec 100755 --- a/lua/plugins/init.lua +++ b/lua/plugins/init.lua @@ -10,3 +10,4 @@ require("plugins.bufferline") require("plugins.wilder") require("plugins.mini") require("plugins.harpoon") +require("plugins.fterm") diff --git a/lua/plugins/keybind.lua b/lua/plugins/keybind.lua new file mode 100644 index 0000000..6d8849d --- /dev/null +++ b/lua/plugins/keybind.lua @@ -0,0 +1,59 @@ +vim.g.mapleader = " " +vim.opt.laststatus=2 + +vim.keymap.set('i', '', [[pumvisible() ? "\" : "\"]], { expr = true }) +vim.keymap.set('i', '', [[pumvisible() ? "\" : "\"]], { expr = true }) + + +local map = vim.api.nvim_set_keymap +local cmap = vim.keymap.set + +local options = { noremap = true } +local cmd_options = { noremap = true, silent = true } + + +map("n", "tt", "lua require('FTerm').toggle()", options) + +-- slef explanitory +map("n", "tw", "lua MiniTrailspace.trim()", options) +map("n", "fm", "NvimTreeToggle", options) + + +-- remap keys so that they dont skip camelCase +map("n", "w", "CamelCaseMotion_w", cmd_options) +map("n", "b", "CamelCaseMotion_b", cmd_options) +map("n", "e", "CamelCaseMotion_e", cmd_options) +map("n", "ge", "CamelCaseMotion_ge", cmd_options) + + +-- this little guy helps you move text, really helpful +map("v", "J", ":m '>+1gv=gv", options) +map("v", "K", ":m '<-2gv=gv", options) + + +-- Cursor always stays on center +map("n", "J", "mzJ`z", options) +map("n", "", "zz", options) +map("n", "", "zz", options) +map("n", "n", "nzzzv", options) +map("n", "N", "Nzzzv", options) + + + +-- paste text but DONT copy the overridden text +cmap("x", "p", [["_dP]]) +cmap("x", "p", [["+dP]]) +-- delete text but DONT copy to clipboard +cmap({ "n", "v" }, "d", [["_d]]) + +-- quickfix stuff +-- +-- +map("n", "", "cnextzz", options) +map("n", "", "cprevzz", options) +map("n", "k", "lnextzz", options) +map("n", "j", "lprevzz", options) + + +-- search and replace every instance of word under cursor +cmap("n", "s", [[:%s/\<\>//gI]]) diff --git a/lua/plugins/lazy.lua b/lua/plugins/lazy.lua index 45cdd46..93291cb 100755 --- a/lua/plugins/lazy.lua +++ b/lua/plugins/lazy.lua @@ -22,7 +22,6 @@ require("lazy").setup({ -- colorscheme "EdenEast/nightfox.nvim", - -- 'nyoom-engineering/oxocarbon.nvim', 'luckasRanarison/tree-sitter-hypr', 'lambdalisue/nerdfont.vim', @@ -54,6 +53,10 @@ require("lazy").setup({ }, + { + 'numToStr/FTerm.nvim' + }, + -- highlight current scope { @@ -97,6 +100,14 @@ require("lazy").setup({ end }, + { + "williamboman/mason.nvim" + }, + + {"neovim/nvim-lspconfig"}, -- Required + {"williamboman/mason.nvim"}, -- Optional + {"williamboman/mason-lspconfig.nvim"}, + -- this is pure magic, i love this guy { "VonHeikemen/lsp-zero.nvim", @@ -125,7 +136,6 @@ require("lazy").setup({ - vim.opt.laststatus=2 vim.keymap.set('i', '', [[pumvisible() ? "\" : "\"]], { expr = true }) diff --git a/lua/plugins/lsp-zero.lua b/lua/plugins/lsp-zero.lua index cd8efa6..603255f 100755 --- a/lua/plugins/lsp-zero.lua +++ b/lua/plugins/lsp-zero.lua @@ -1,3 +1,4 @@ +require('mason').setup() local lsp = require('lsp-zero').preset({}) lsp.on_attach(function(client, bufnr)