apply rework

This commit is contained in:
Јован Ђокић-Шумарац 2024-02-10 19:47:43 +01:00
parent 728f11abcf
commit cc8be5490f
6 changed files with 138 additions and 3 deletions

View file

@ -9,10 +9,11 @@ local options = { noremap = true }
local cmd_options = { noremap = true, silent = true } local cmd_options = { noremap = true, silent = true }
map("n", "<leader>tt", "<cmd>lua require('FTerm').toggle()<CR>", options)
-- slef explanitory -- slef explanitory
map("n", "<leader>tw", "<cmd>lua MiniTrailspace.trim()<CR>", options) map("n", "<leader>tw", "<cmd>lua MiniTrailspace.trim()<CR>", options)
map("n", "<leader>fm", "<cmd>NvimTreeToggle<CR>", options) map("n", "<leader>fm", "<cmd>NvimTreeToggle<CR>", options)
map("n", "<leader>tt", "<cmd>12 split <CR><cmd>Tnew<CR>", options)
-- remap keys so that they dont skip camelCase -- remap keys so that they dont skip camelCase

63
lua/plugins/fterm.lua Normal file
View file

@ -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<string,number>
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<string,string>|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,
})

View file

@ -10,3 +10,4 @@ require("plugins.bufferline")
require("plugins.wilder") require("plugins.wilder")
require("plugins.mini") require("plugins.mini")
require("plugins.harpoon") require("plugins.harpoon")
require("plugins.fterm")

59
lua/plugins/keybind.lua Normal file
View file

@ -0,0 +1,59 @@
vim.g.mapleader = " "
vim.opt.laststatus=2
vim.keymap.set('i', '<Tab>', [[pumvisible() ? "\<C-n>" : "\<Tab>"]], { expr = true })
vim.keymap.set('i', '<S-Tab>', [[pumvisible() ? "\<C-p>" : "\<S-Tab>"]], { 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", "<leader>tt", "<cmd>lua require('FTerm').toggle()<CR>", options)
-- slef explanitory
map("n", "<leader>tw", "<cmd>lua MiniTrailspace.trim()<CR>", options)
map("n", "<leader>fm", "<cmd>NvimTreeToggle<CR>", options)
-- remap keys so that they dont skip camelCase
map("n", "w", "<Plug>CamelCaseMotion_w", cmd_options)
map("n", "b", "<Plug>CamelCaseMotion_b", cmd_options)
map("n", "e", "<Plug>CamelCaseMotion_e", cmd_options)
map("n", "ge", "<Plug>CamelCaseMotion_ge", cmd_options)
-- this little guy helps you move text, really helpful
map("v", "J", ":m '>+1<CR>gv=gv", options)
map("v", "K", ":m '<-2<CR>gv=gv", options)
-- Cursor always stays on center
map("n", "J", "mzJ`z", options)
map("n", "<C-d>", "<C-d>zz", options)
map("n", "<C-u>", "<C-u>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", "<leader>p", [["+dP]])
-- delete text but DONT copy to clipboard
cmap({ "n", "v" }, "<leader>d", [["_d]])
-- quickfix stuff
--
--
map("n", "<C-k>", "<cmd>cnext<CR>zz", options)
map("n", "<C-j>", "<cmd>cprev<CR>zz", options)
map("n", "<leader>k", "<cmd>lnext<CR>zz", options)
map("n", "<leader>j", "<cmd>lprev<CR>zz", options)
-- search and replace every instance of word under cursor
cmap("n", "<leader>s", [[:%s/\<<C-r><C-w>\>/<C-r><C-w>/gI<Left><Left><Left>]])

View file

@ -22,7 +22,6 @@ require("lazy").setup({
-- colorscheme -- colorscheme
"EdenEast/nightfox.nvim", "EdenEast/nightfox.nvim",
-- 'nyoom-engineering/oxocarbon.nvim',
'luckasRanarison/tree-sitter-hypr', 'luckasRanarison/tree-sitter-hypr',
'lambdalisue/nerdfont.vim', 'lambdalisue/nerdfont.vim',
@ -54,6 +53,10 @@ require("lazy").setup({
}, },
{
'numToStr/FTerm.nvim'
},
-- highlight current scope -- highlight current scope
{ {
@ -97,6 +100,14 @@ require("lazy").setup({
end end
}, },
{
"williamboman/mason.nvim"
},
{"neovim/nvim-lspconfig"}, -- Required
{"williamboman/mason.nvim"}, -- Optional
{"williamboman/mason-lspconfig.nvim"},
-- this is pure magic, i love this guy -- this is pure magic, i love this guy
{ {
"VonHeikemen/lsp-zero.nvim", "VonHeikemen/lsp-zero.nvim",
@ -125,7 +136,6 @@ require("lazy").setup({
vim.opt.laststatus=2 vim.opt.laststatus=2
vim.keymap.set('i', '<Tab>', [[pumvisible() ? "\<C-n>" : "\<Tab>"]], { expr = true }) vim.keymap.set('i', '<Tab>', [[pumvisible() ? "\<C-n>" : "\<Tab>"]], { expr = true })

View file

@ -1,3 +1,4 @@
require('mason').setup()
local lsp = require('lsp-zero').preset({}) local lsp = require('lsp-zero').preset({})
lsp.on_attach(function(client, bufnr) lsp.on_attach(function(client, bufnr)