add nvim config
This commit is contained in:
2
nvim/lua/markaya/init.lua
Normal file
2
nvim/lua/markaya/init.lua
Normal file
@@ -0,0 +1,2 @@
|
||||
require 'markaya.settings'
|
||||
require 'markaya.remap'
|
||||
28
nvim/lua/markaya/lazy.lua
Normal file
28
nvim/lua/markaya/lazy.lua
Normal file
@@ -0,0 +1,28 @@
|
||||
-- [[ Install `lazy.nvim` plugin manager ]]
|
||||
local lazypath = vim.fn.stdpath 'data' .. '/lazy/lazy.nvim'
|
||||
if not vim.loop.fs_stat(lazypath) then
|
||||
local lazyrepo = 'https://github.com/folke/lazy.nvim.git'
|
||||
vim.fn.system {
|
||||
'git',
|
||||
'clone',
|
||||
'--filter=blob:none',
|
||||
-- Ovde zaključavamo na v11.17.5 umesto '--branch=stable'
|
||||
'--branch=v11.17.5',
|
||||
lazyrepo,
|
||||
lazypath
|
||||
}
|
||||
end
|
||||
vim.opt.rtp:prepend(lazypath)
|
||||
|
||||
-- Setup lazy.nvim
|
||||
require('lazy').setup('markaya.plugins', {
|
||||
-- Opciono: takođe možete dodati samu lazy.nvim u listu specifikacija
|
||||
-- unutar foldera 'markaya/plugins' kako biste osigurali da je Lazy uvek na toj verziji
|
||||
ui = {
|
||||
icons = vim.g.have_nerd_font and {} or {
|
||||
cmd = '⌘', config = '🛠', event = '📅', ft = '📂', init = '⚙',
|
||||
keys = '🗝', plugin = '🔌', runtime = '💻', require = '🌙',
|
||||
source = '📄', start = '🚀', task = '📌', lazy = '💤 ',
|
||||
},
|
||||
},
|
||||
})
|
||||
63
nvim/lua/markaya/plugins/blink.lua
Normal file
63
nvim/lua/markaya/plugins/blink.lua
Normal file
@@ -0,0 +1,63 @@
|
||||
return {
|
||||
'saghen/blink.cmp',
|
||||
-- optional: provides snippets for the snippet source
|
||||
dependencies = { 'rafamadriz/friendly-snippets' },
|
||||
|
||||
-- use a release tag to download pre-built binaries
|
||||
version = 'v1.8.0',
|
||||
---@module 'blink.cmp'
|
||||
---@type blink.cmp.Config
|
||||
opts = {
|
||||
-- 'default' (recommended) for mappings similar to built-in completions (C-y to accept)
|
||||
-- 'super-tab' for mappings similar to vscode (tab to accept)
|
||||
-- 'enter' for enter to accept
|
||||
-- 'none' for no mappings
|
||||
--
|
||||
-- All presets have the following mappings:
|
||||
-- C-space: Open menu or open docs if already open
|
||||
-- C-n/C-p or Up/Down: Select next/previous item
|
||||
-- C-e: Hide menu
|
||||
-- C-k: Toggle signature help (if signature.enabled = true)
|
||||
--
|
||||
-- See :h blink-cmp-config-keymap for defining your own keymap
|
||||
keymap = {
|
||||
preset = 'default',
|
||||
-- ['<C-space>'] = { function(cmp) cmp.show({ providers = { 'snippets' } }) end },
|
||||
['<C-l>'] = { 'snippet_forward', 'fallback' },
|
||||
['<C-h>'] = { 'snippet_backward', 'fallback' },
|
||||
['<C-b>'] = { 'scroll_documentation_up' },
|
||||
['<C-f>'] = { 'scroll_documentation_down' },
|
||||
},
|
||||
|
||||
appearance = {
|
||||
nerd_font_variant = 'mono',
|
||||
},
|
||||
|
||||
signature = { enabled = true },
|
||||
|
||||
completion = {
|
||||
menu = {
|
||||
border = 'rounded',
|
||||
},
|
||||
ghost_text = {
|
||||
enabled = true,
|
||||
show_with_menu = false,
|
||||
},
|
||||
documentation = { auto_show = true },
|
||||
},
|
||||
|
||||
-- Default list of enabled providers defined so that you can extend it
|
||||
-- elsewhere in your config, without redefining it, due to `opts_extend`
|
||||
sources = {
|
||||
default = { 'lsp', 'path', 'snippets', 'buffer' },
|
||||
},
|
||||
|
||||
-- (Default) Rust fuzzy matcher for typo resistance and significantly better performance
|
||||
-- You may use a lua implementation instead by using `implementation = "lua"` or fallback to the lua implementation,
|
||||
-- when the Rust fuzzy matcher is not available, by using `implementation = "prefer_rust"`
|
||||
--
|
||||
-- See the fuzzy documentation for more information
|
||||
fuzzy = { implementation = 'prefer_rust_with_warning' },
|
||||
},
|
||||
opts_extend = { 'sources.default' },
|
||||
}
|
||||
36
nvim/lua/markaya/plugins/conform.lua
Normal file
36
nvim/lua/markaya/plugins/conform.lua
Normal file
@@ -0,0 +1,36 @@
|
||||
return {
|
||||
{
|
||||
'stevearc/conform.nvim',
|
||||
version = 'v9.1.0',
|
||||
lazy = false,
|
||||
keys = {
|
||||
{
|
||||
'<leader>f',
|
||||
function()
|
||||
require('conform').format { async = true, lsp_fallback = true }
|
||||
end,
|
||||
mode = '',
|
||||
desc = '[F]ormat buffer',
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
notify_on_error = false,
|
||||
format_on_save = function(bufnr)
|
||||
local disable_filetypes = { c = true, cpp = true }
|
||||
return {
|
||||
timeout_ms = 500,
|
||||
lsp_fallback = not disable_filetypes[vim.bo[bufnr].filetype],
|
||||
}
|
||||
end,
|
||||
formatters_by_ft = {
|
||||
lua = { 'stylua' },
|
||||
-- Conform can also run multiple formatters sequentially
|
||||
-- python = { "isort", "black" },
|
||||
--
|
||||
-- You can use a sub-list to tell conform to run *until* a formatter
|
||||
-- is found.
|
||||
-- javascript = { { "prettierd", "prettier" } },
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
41
nvim/lua/markaya/plugins/fugitive.lua
Normal file
41
nvim/lua/markaya/plugins/fugitive.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
return {
|
||||
'tpope/vim-fugitive',
|
||||
commit = '61b51c0',
|
||||
config = function()
|
||||
vim.keymap.set('n', '<leader>gs', vim.cmd.Git, { desc = ':Git' })
|
||||
|
||||
local markaya_fugitive = vim.api.nvim_create_augroup('markaya_fugitive', {})
|
||||
|
||||
local autocmd = vim.api.nvim_create_autocmd
|
||||
autocmd('BufWinEnter', {
|
||||
group = markaya_fugitive,
|
||||
pattern = '*',
|
||||
callback = function()
|
||||
if vim.bo.ft ~= 'fugitive' then
|
||||
return
|
||||
end
|
||||
|
||||
local bufnr = vim.api.nvim_get_current_buf()
|
||||
local opts = { buffer = bufnr, remap = false }
|
||||
|
||||
-- TODO: Must fix these remaps to work
|
||||
|
||||
--[[ vim.keymap.set('n', '<leader>p', function()
|
||||
vim.cmd.Git 'push'
|
||||
end, vim.tbl_deep_extend('keep', opts, { desc = 'Git push' }))
|
||||
|
||||
vim.keymap.set('n', '<leader>P', function()
|
||||
vim.cmd.Git { 'pull', '--rebase' }
|
||||
end, vim.tbl_deep_extend('keep', opts, { desc = 'Git pull --rebase' }))
|
||||
|
||||
-- NOTE: It allows me to easily set the branch i am pushing and any tracking
|
||||
-- needed if i did not set the branch up correctly
|
||||
|
||||
vim.keymap.set('n', '<leader>t', ':Git push -u origin ', vim.tbl_deep_extend('keep', opts, { desc = 'Git pull --rebase' })) ]]
|
||||
end,
|
||||
})
|
||||
|
||||
-- vim.keymap.set('n', 'gu', '<cmd>diffget //2<CR>')
|
||||
-- vim.keymap.set('n', 'gh', '<cmd>diffget //3<CR>')
|
||||
end,
|
||||
}
|
||||
67
nvim/lua/markaya/plugins/gitsigns.lua
Normal file
67
nvim/lua/markaya/plugins/gitsigns.lua
Normal file
@@ -0,0 +1,67 @@
|
||||
return {
|
||||
{
|
||||
'lewis6991/gitsigns.nvim',
|
||||
version = 'v1.0.2',
|
||||
config = function()
|
||||
require('gitsigns').setup {
|
||||
signs = {
|
||||
add = { text = '+' },
|
||||
change = { text = '~' },
|
||||
delete = { text = '_' },
|
||||
topdelete = { text = '‾' },
|
||||
changedelete = { text = '~' },
|
||||
},
|
||||
on_attach = function(bufnr)
|
||||
local gitsigns = require 'gitsigns'
|
||||
|
||||
local function map(mode, l, r, opts)
|
||||
opts = opts or {}
|
||||
opts.buffer = bufnr
|
||||
vim.keymap.set(mode, l, r, opts)
|
||||
end
|
||||
|
||||
-- Navigation
|
||||
map('n', ']c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { ']c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'next'
|
||||
end
|
||||
end, { desc = 'Jump to next git [c]hange' })
|
||||
|
||||
map('n', '[c', function()
|
||||
if vim.wo.diff then
|
||||
vim.cmd.normal { '[c', bang = true }
|
||||
else
|
||||
gitsigns.nav_hunk 'prev'
|
||||
end
|
||||
end, { desc = 'Jump to previous git [c]hange' })
|
||||
|
||||
-- Actions
|
||||
-- visual mode
|
||||
map('v', '<leader>hs', function()
|
||||
gitsigns.stage_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'stage git hunk' })
|
||||
map('v', '<leader>hr', function()
|
||||
gitsigns.reset_hunk { vim.fn.line '.', vim.fn.line 'v' }
|
||||
end, { desc = 'reset git hunk' })
|
||||
-- normal mode
|
||||
map('n', '<leader>hs', gitsigns.stage_hunk, { desc = 'git [s]tage hunk' })
|
||||
map('n', '<leader>hr', gitsigns.reset_hunk, { desc = 'git [r]eset hunk' })
|
||||
map('n', '<leader>hS', gitsigns.stage_buffer, { desc = 'git [S]tage buffer' })
|
||||
map('n', '<leader>hu', gitsigns.undo_stage_hunk, { desc = 'git [u]ndo stage hunk' })
|
||||
map('n', '<leader>hR', gitsigns.reset_buffer, { desc = 'git [R]eset buffer' })
|
||||
map('n', '<leader>hp', gitsigns.preview_hunk, { desc = 'git [p]review hunk' })
|
||||
map('n', '<leader>hb', gitsigns.blame_line, { desc = 'git [b]lame line' })
|
||||
map('n', '<leader>hd', gitsigns.diffthis, { desc = 'git [d]iff against index' })
|
||||
map('n', '<leader>hD', function()
|
||||
gitsigns.diffthis '@'
|
||||
end, { desc = 'git [D]iff against last commit' })
|
||||
-- Toggles
|
||||
map('n', '<leader>tb', gitsigns.toggle_current_line_blame, { desc = '[T]oggle git show [b]lame line' })
|
||||
map('n', '<leader>tD', gitsigns.toggle_deleted, { desc = '[T]oggle git show [D]eleted' })
|
||||
end,
|
||||
}
|
||||
end,
|
||||
},
|
||||
}
|
||||
31
nvim/lua/markaya/plugins/harpoon.lua
Normal file
31
nvim/lua/markaya/plugins/harpoon.lua
Normal file
@@ -0,0 +1,31 @@
|
||||
return {
|
||||
'ThePrimeagen/harpoon',
|
||||
branch = 'harpoon2',
|
||||
commit = '87b1a35',
|
||||
dependencies = { 'nvim-telescope/telescope.nvim', 'nvim-lua/plenary.nvim' },
|
||||
config = function()
|
||||
local harpoon = require 'harpoon'
|
||||
|
||||
harpoon:setup()
|
||||
|
||||
vim.keymap.set('n', '<leader>a', function()
|
||||
harpoon:list():add()
|
||||
end, { desc = '[A]dd to Harpoon List' })
|
||||
vim.keymap.set('n', '<C-e>', function()
|
||||
harpoon.ui:toggle_quick_menu(harpoon:list())
|
||||
end, { desc = 'Toggle Harpoon List' })
|
||||
|
||||
vim.keymap.set('n', '<C-h>', function()
|
||||
harpoon:list():select(1)
|
||||
end, { desc = '1st in Harpoon List' })
|
||||
vim.keymap.set('n', '<C-t>', function()
|
||||
harpoon:list():select(2)
|
||||
end, { desc = '2nd in Harpoon List' })
|
||||
vim.keymap.set('n', '<C-n>', function()
|
||||
harpoon:list():select(3)
|
||||
end, { desc = '3rd in Harpoon List' })
|
||||
vim.keymap.set('n', '<C-s>', function()
|
||||
harpoon:list():select(4)
|
||||
end, { desc = '4th in Harpoon List' })
|
||||
end,
|
||||
}
|
||||
12
nvim/lua/markaya/plugins/indent_line.lua
Normal file
12
nvim/lua/markaya/plugins/indent_line.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
return {
|
||||
{ -- Add indentation guides even on blank lines
|
||||
'lukas-reineke/indent-blankline.nvim',
|
||||
version = 'v3.9.0',
|
||||
-- See `:help ibl`
|
||||
main = 'ibl',
|
||||
opts = {},
|
||||
config = function ()
|
||||
require("ibl").setup()
|
||||
end
|
||||
},
|
||||
}
|
||||
154
nvim/lua/markaya/plugins/lspconfig.lua
Normal file
154
nvim/lua/markaya/plugins/lspconfig.lua
Normal file
@@ -0,0 +1,154 @@
|
||||
return {
|
||||
{
|
||||
'neovim/nvim-lspconfig',
|
||||
version = 'v2.5.0',
|
||||
dependencies = {
|
||||
{ 'j-hui/fidget.nvim', version = 'v1.6.1', opts = {} },
|
||||
{ 'saghen/blink.cmp' },
|
||||
{
|
||||
'folke/lazydev.nvim',
|
||||
version = 'v1.10.0',
|
||||
ft = 'lua', -- only load on lua files
|
||||
opts = {
|
||||
library = {
|
||||
-- See the configuration section for more details
|
||||
-- Load luvit types when the `vim.uv` word is found
|
||||
{ path = '${3rd}/luv/library', words = { 'vim%.uv' } },
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
opts = {
|
||||
servers = {
|
||||
lua_ls = {},
|
||||
gopls = {},
|
||||
pyright = {},
|
||||
golangci_lint_ls = {
|
||||
init_options = {
|
||||
command = {
|
||||
'golangci-lint',
|
||||
'run',
|
||||
'--output.json.path',
|
||||
'stdout',
|
||||
'--show-stats=false',
|
||||
'--issues-exit-code=1',
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
config = function(_, opts)
|
||||
--local lspconfig = require 'lspconfig'
|
||||
for server, config in pairs(opts.servers) do
|
||||
-- passing config.capabilities to blink.cmp merges with the capabilities in your
|
||||
-- `opts[server].capabilities, if you've defined it
|
||||
config.capabilities = require('blink.cmp').get_lsp_capabilities(config.capabilities)
|
||||
-- lspconfig[server].setup(config)
|
||||
|
||||
vim.lsp.enable(server)
|
||||
vim.lsp.config(server, config)
|
||||
end
|
||||
|
||||
vim.api.nvim_create_autocmd('LspAttach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-attach', { clear = true }),
|
||||
callback = function(event)
|
||||
local map = function(keys, func, desc)
|
||||
vim.keymap.set('n', keys, func, { buffer = event.buf, desc = 'LSP: ' .. desc })
|
||||
end
|
||||
|
||||
local opts = { buffer = event.buf }
|
||||
-- Jump to the definition of the word under your cursor.
|
||||
-- This is where a variable was first declared, or where a function is defined, etc.
|
||||
-- To jump back, press <C-t>.
|
||||
map('gd', require('telescope.builtin').lsp_definitions, '[G]oto [D]efinition')
|
||||
|
||||
-- Find references for the word under your cursor.
|
||||
map('gr', require('telescope.builtin').lsp_references, '[G]oto [R]eferences')
|
||||
|
||||
-- Jump to the implementation of the word under your cursor.
|
||||
-- Useful when your language has ways of declaring types without an actual implementation.
|
||||
map('gi', require('telescope.builtin').lsp_implementations, '[G]oto [I]mplementation')
|
||||
|
||||
-- Jump to the type of the word under your cursor.
|
||||
-- Useful when you're not sure what type a variable is and you want to see
|
||||
-- the definition of its *type*, not where it was *defined*.
|
||||
map('<leader>D', require('telescope.builtin').lsp_type_definitions, 'Type [D]efinition')
|
||||
|
||||
-- Fuzzy find all the symbols in your current document.
|
||||
-- Symbols are things like variables, functions, types, etc.
|
||||
map('<leader>ds', require('telescope.builtin').lsp_document_symbols, '[D]ocument [S]ymbols')
|
||||
|
||||
-- Fuzzy find all the symbols in your current workspace.
|
||||
-- Similar to document symbols, except searches over your entire project.
|
||||
map('<leader>ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, '[W]orkspace [S]ymbols')
|
||||
|
||||
-- Rename the variable under your cursor.
|
||||
-- Most Language Servers support renaming across files, etc.
|
||||
map('<leader>rn', vim.lsp.buf.rename, '[R]e[n]ame')
|
||||
|
||||
-- Execute a code action, usually your cursor needs to be on top of an error
|
||||
-- or a suggestion from your LSP for this to activate.
|
||||
map('<leader>ca', vim.lsp.buf.code_action, '[C]ode [A]ction')
|
||||
|
||||
-- Opens a popup that displays documentation about the word under your cursor
|
||||
-- See `:help K` for why this keymap.
|
||||
map('K', vim.lsp.buf.hover, 'Hover Documentation')
|
||||
|
||||
-- WARN: This is not Goto Definition, this is Goto Declaration.
|
||||
-- For example, in C this would take you to the header.
|
||||
map('gD', vim.lsp.buf.declaration, '[G]oto [D]eclaration')
|
||||
|
||||
-- NOTE: Primagean
|
||||
vim.keymap.set('i', '<C-g>', function()
|
||||
vim.lsp.buf.signature_help()
|
||||
end, vim.tbl_deep_extend('keep', opts, { desc = 'LSP: Signature Help' }))
|
||||
|
||||
map('<space>wa', vim.lsp.buf.add_workspace_folder, '[W]orkspace folder [A]dd')
|
||||
map('<space>wr', vim.lsp.buf.remove_workspace_folder, '[W]orkspace folder [R]emove')
|
||||
map('<space>wl', function()
|
||||
print(vim.inspect(vim.lsp.buf.list_workspace_folders()))
|
||||
end, '[W]orkspace folders, [L]ist')
|
||||
|
||||
-- The following two autocommands are used to highlight references of the
|
||||
-- word under your cursor when your cursor rests there for a little while.
|
||||
-- See `:help CursorHold` for information about when this is executed
|
||||
--
|
||||
-- When you move your cursor, the highlights will be cleared (the second autocommand).
|
||||
local client = vim.lsp.get_client_by_id(event.data.client_id)
|
||||
if client and client.server_capabilities.documentHighlightProvider then
|
||||
local highlight_augroup = vim.api.nvim_create_augroup('kickstart-lsp-highlight', { clear = false })
|
||||
vim.api.nvim_create_autocmd({ 'CursorHold', 'CursorHoldI' }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.document_highlight,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd({ 'CursorMoved', 'CursorMovedI' }, {
|
||||
buffer = event.buf,
|
||||
group = highlight_augroup,
|
||||
callback = vim.lsp.buf.clear_references,
|
||||
})
|
||||
|
||||
vim.api.nvim_create_autocmd('LspDetach', {
|
||||
group = vim.api.nvim_create_augroup('kickstart-lsp-detach', { clear = true }),
|
||||
callback = function(event2)
|
||||
vim.lsp.buf.clear_references()
|
||||
vim.api.nvim_clear_autocmds { group = 'kickstart-lsp-highlight', buffer = event2.buf }
|
||||
end,
|
||||
})
|
||||
end
|
||||
|
||||
-- The following autocommand is used to enable inlay hints in your
|
||||
-- code, if the language server you are using supports them
|
||||
--
|
||||
-- This may be unwanted, since they displace some of your code
|
||||
if client and client.server_capabilities.inlayHintProvider and vim.lsp.inlay_hint then
|
||||
map('<leader>th', function()
|
||||
vim.lsp.inlay_hint.enable(not vim.lsp.inlay_hint.is_enabled {})
|
||||
end, '[T]oggle Inlay [H]ints')
|
||||
end
|
||||
end,
|
||||
})
|
||||
end,
|
||||
},
|
||||
}
|
||||
14
nvim/lua/markaya/plugins/lualine.lua
Normal file
14
nvim/lua/markaya/plugins/lualine.lua
Normal file
@@ -0,0 +1,14 @@
|
||||
return {
|
||||
'nvim-lualine/lualine.nvim',
|
||||
commit = '47f91c4',
|
||||
dependencies = {
|
||||
{'nvim-tree/nvim-web-devicons', commit = '8033534'},
|
||||
},
|
||||
config = function()
|
||||
require('lualine').setup {
|
||||
options = {
|
||||
theme = 'codedark',
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
12
nvim/lua/markaya/plugins/noneckpain.lua
Normal file
12
nvim/lua/markaya/plugins/noneckpain.lua
Normal file
@@ -0,0 +1,12 @@
|
||||
return {
|
||||
'shortcuts/no-neck-pain.nvim',
|
||||
version = 'v2.5.3',
|
||||
config = function()
|
||||
require('no-neck-pain').setup {
|
||||
width = 130,
|
||||
autocmds = {
|
||||
enableOnVimEnter = true,
|
||||
},
|
||||
}
|
||||
end,
|
||||
}
|
||||
50
nvim/lua/markaya/plugins/nvim-lint.lua
Normal file
50
nvim/lua/markaya/plugins/nvim-lint.lua
Normal file
@@ -0,0 +1,50 @@
|
||||
return {
|
||||
'mfussenegger/nvim-lint',
|
||||
commit = 'ca6ea12',
|
||||
event = { 'BufReadPre', 'BufNewFile' },
|
||||
config = function()
|
||||
local lint = require 'lint'
|
||||
|
||||
-- To allow other plugins to add linters to require('lint').linters_by_ft,
|
||||
-- instead set linters_by_ft like this:
|
||||
lint.linters_by_ft = lint.linters_by_ft or {}
|
||||
-- lint.linters_by_ft['markdown'] = { 'markdownlint-cli2' }
|
||||
--
|
||||
-- However, note that this will enable a set of default linters,
|
||||
-- which will cause errors unless these tools are available:
|
||||
-- {
|
||||
-- clojure = { "clj-kondo" },
|
||||
-- dockerfile = { "hadolint" },
|
||||
-- inko = { "inko" },
|
||||
-- janet = { "janet" },
|
||||
-- json = { "jsonlint" },
|
||||
-- markdown = { "vale" },
|
||||
-- rst = { "vale" },
|
||||
-- ruby = { "ruby" },
|
||||
-- terraform = { "tflint" },
|
||||
-- text = { "vale" }
|
||||
-- }
|
||||
--
|
||||
-- You can disable the default linters by setting their filetypes to nil:
|
||||
-- lint.linters_by_ft['clojure'] = nil
|
||||
-- lint.linters_by_ft['dockerfile'] = nil
|
||||
-- lint.linters_by_ft['inko'] = nil
|
||||
-- lint.linters_by_ft['janet'] = nil
|
||||
-- lint.linters_by_ft['json'] = nil
|
||||
-- lint.linters_by_ft['markdown'] = nil
|
||||
-- lint.linters_by_ft['rst'] = nil
|
||||
-- lint.linters_by_ft['ruby'] = nil
|
||||
-- lint.linters_by_ft['terraform'] = nil
|
||||
-- lint.linters_by_ft['text'] = nil
|
||||
|
||||
-- Create autocommand which carries out the actual linting
|
||||
-- on the specified events.
|
||||
local lint_augroup = vim.api.nvim_create_augroup('lint', { clear = true })
|
||||
vim.api.nvim_create_autocmd({ 'BufEnter', 'BufWritePost', 'InsertLeave' }, {
|
||||
group = lint_augroup,
|
||||
callback = function()
|
||||
lint.try_lint()
|
||||
end,
|
||||
})
|
||||
end,
|
||||
}
|
||||
82
nvim/lua/markaya/plugins/telescope.lua
Normal file
82
nvim/lua/markaya/plugins/telescope.lua
Normal file
@@ -0,0 +1,82 @@
|
||||
return {
|
||||
{ -- Fuzzy Finder (files, lsp, etc)
|
||||
'nvim-telescope/telescope.nvim',
|
||||
event = 'VimEnter',
|
||||
tag = 'v0.2.1',
|
||||
dependencies = {
|
||||
'nvim-lua/plenary.nvim',
|
||||
{
|
||||
'nvim-telescope/telescope-fzf-native.nvim',
|
||||
build = 'make',
|
||||
cond = function()
|
||||
return vim.fn.executable 'make' == 1
|
||||
end,
|
||||
},
|
||||
{ 'nvim-telescope/telescope-ui-select.nvim' },
|
||||
{ 'nvim-tree/nvim-web-devicons', enabled = vim.g.have_nerd_font },
|
||||
},
|
||||
config = function()
|
||||
require('telescope').setup {
|
||||
extensions = {
|
||||
['ui-select'] = {
|
||||
require('telescope.themes').get_dropdown(),
|
||||
},
|
||||
fzf = {},
|
||||
},
|
||||
}
|
||||
|
||||
-- https://www.youtube.com/watch?v=xdXE1tOT-qg&list=PLep05UYkc6wTyBe7kPjQFWVXTlhKeQejM&index=11
|
||||
-- On this video there is a tutorial how to create live multigrep to filter files over
|
||||
-- multiple arguments
|
||||
-- e.g. .lua[ ]telescope -- will search all .lua files with telescope in them
|
||||
|
||||
pcall(require('telescope').load_extension, 'fzf')
|
||||
pcall(require('telescope').load_extension, 'ui-select')
|
||||
|
||||
local builtin = require 'telescope.builtin'
|
||||
vim.keymap.set('n', '<leader>sh', builtin.help_tags, { desc = '[S]earch [H]elp' })
|
||||
vim.keymap.set('n', '<leader>sk', builtin.keymaps, { desc = '[S]earch [K]eymaps' })
|
||||
-- most important
|
||||
--vim.keymap.set('n', '<leader>sg', builtin.live_grep, { desc = '[S]earch by [G]rep' })
|
||||
vim.keymap.set('n', '<leader>sf', builtin.find_files, { desc = '[S]earch [F]iles' })
|
||||
--
|
||||
vim.keymap.set('n', '<leader>ss', builtin.builtin, { desc = '[S]earch [S]elect Telescope' })
|
||||
vim.keymap.set('n', '<leader>sd', builtin.diagnostics, { desc = '[S]earch [D]iagnostics' })
|
||||
vim.keymap.set('n', '<leader>sr', builtin.resume, { desc = '[S]earch [R]esume' })
|
||||
vim.keymap.set('n', '<leader>s.', builtin.oldfiles, { desc = '[S]earch Recent Files ("." for repeat)' })
|
||||
vim.keymap.set('n', '<leader><leader>', builtin.buffers, { desc = '[ ] Find existing buffers' })
|
||||
vim.keymap.set('n', '<C-p>', builtin.git_files, { desc = 'Git files' })
|
||||
|
||||
vim.keymap.set('n', '<leader>pws', function()
|
||||
local word = vim.fn.expand '<cword>'
|
||||
builtin.grep_string { search = word }
|
||||
end, { desc = '[S]earch current [w]ord' })
|
||||
|
||||
vim.keymap.set('n', '<leader>pWs', function()
|
||||
local word = vim.fn.expand '<cWORD>'
|
||||
builtin.grep_string { search = word }
|
||||
end, { desc = '[S]earch current [W]ORD' })
|
||||
|
||||
vim.keymap.set('n', '<leader>/', function()
|
||||
builtin.current_buffer_fuzzy_find(require('telescope.themes').get_dropdown {
|
||||
winblend = 10,
|
||||
previewer = false,
|
||||
})
|
||||
end, { desc = '[/] Fuzzily search in current buffer' })
|
||||
|
||||
vim.keymap.set('n', '<leader>s/', function()
|
||||
builtin.live_grep {
|
||||
grep_open_files = true,
|
||||
prompt_title = 'Live Grep in Open Files',
|
||||
}
|
||||
end, { desc = '[S]earch [/] in Open Files' })
|
||||
|
||||
-- Shortcut for searching your Neovim configuration files
|
||||
vim.keymap.set('n', '<leader>sn', function()
|
||||
builtin.find_files { cwd = vim.fn.stdpath 'config' }
|
||||
end, { desc = '[S]earch [N]eovim files' })
|
||||
|
||||
require('markaya.telescope.multigrep').setup()
|
||||
end,
|
||||
},
|
||||
}
|
||||
33
nvim/lua/markaya/plugins/treesitter.lua
Normal file
33
nvim/lua/markaya/plugins/treesitter.lua
Normal file
@@ -0,0 +1,33 @@
|
||||
return {
|
||||
{ -- Highlight, edit, and navigate code
|
||||
'nvim-treesitter/nvim-treesitter',
|
||||
build = ':TSUpdate',
|
||||
tag = 'v0.10.0',
|
||||
opts = {
|
||||
ensure_installed = {
|
||||
'lua',
|
||||
'luadoc',
|
||||
'vim',
|
||||
'vimdoc',
|
||||
'bash',
|
||||
-- Go ecosystem
|
||||
'go',
|
||||
'gomod',
|
||||
'gowork',
|
||||
'gosum'
|
||||
},
|
||||
-- Autoinstall languages that are not installed
|
||||
auto_install = true,
|
||||
highlight = {
|
||||
enable = true,
|
||||
additional_vim_regex_highlighting = { 'ruby' },
|
||||
},
|
||||
indent = { enable = true, disable = { 'ruby' } },
|
||||
},
|
||||
config = function(_, opts)
|
||||
require('nvim-treesitter.install').prefer_git = true
|
||||
---@diagnostic disable-next-line: missing-fields
|
||||
require('nvim-treesitter.configs').setup(opts)
|
||||
end,
|
||||
},
|
||||
}
|
||||
38
nvim/lua/markaya/plugins/trouble.lua
Normal file
38
nvim/lua/markaya/plugins/trouble.lua
Normal file
@@ -0,0 +1,38 @@
|
||||
return {
|
||||
"folke/trouble.nvim",
|
||||
version = 'v3.7.1',
|
||||
opts = {}, -- for default options, refer to the configuration section for custom setup.
|
||||
cmd = "Trouble",
|
||||
keys = {
|
||||
{
|
||||
"<leader>xx",
|
||||
"<cmd>Trouble diagnostics toggle<cr>",
|
||||
desc = "Diagnostics (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>xX",
|
||||
"<cmd>Trouble diagnostics toggle filter.buf=0<cr>",
|
||||
desc = "Buffer Diagnostics (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>cs",
|
||||
"<cmd>Trouble symbols toggle focus=false<cr>",
|
||||
desc = "Symbols (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>cl",
|
||||
"<cmd>Trouble lsp toggle focus=false win.position=right<cr>",
|
||||
desc = "LSP Definitions / references / ... (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>xL",
|
||||
"<cmd>Trouble loclist toggle<cr>",
|
||||
desc = "Location List (Trouble)",
|
||||
},
|
||||
{
|
||||
"<leader>xQ",
|
||||
"<cmd>Trouble qflist toggle<cr>",
|
||||
desc = "Quickfix List (Trouble)",
|
||||
},
|
||||
},
|
||||
}
|
||||
8
nvim/lua/markaya/plugins/undotree.lua
Normal file
8
nvim/lua/markaya/plugins/undotree.lua
Normal file
@@ -0,0 +1,8 @@
|
||||
return {
|
||||
'mbbill/undotree',
|
||||
commit = '0f1c981',
|
||||
ignore_install = { '' },
|
||||
config = function()
|
||||
vim.keymap.set('n', '<leader>u', vim.cmd.UndotreeToggle, { desc = 'UndotreeToggle' })
|
||||
end,
|
||||
}
|
||||
4
nvim/lua/markaya/plugins/vim_sleuth.lua
Normal file
4
nvim/lua/markaya/plugins/vim_sleuth.lua
Normal file
@@ -0,0 +1,4 @@
|
||||
return {
|
||||
'tpope/vim-sleuth', -- Detect tabstop and shiftwidth automatically
|
||||
tag = 'v2.0',
|
||||
}
|
||||
41
nvim/lua/markaya/remap.lua
Normal file
41
nvim/lua/markaya/remap.lua
Normal file
@@ -0,0 +1,41 @@
|
||||
vim.keymap.set('n', '<leader>pv', vim.cmd.Ex, { desc = 'Browse project files' })
|
||||
|
||||
vim.keymap.set('v', 'J', ":m '>+1<CR>gv=gv", { desc = 'Move highlighted line up' })
|
||||
vim.keymap.set('v', 'K', ":m '>-2<CR>gv=gv", { desc = 'Move highlighted line down' })
|
||||
|
||||
-- Primagean kemap to save your pasted text inside buffer after you paste it over highlighted text
|
||||
-- This usuaslly causes highlighted text to be deleted which is them moved to buffer
|
||||
-- Remap is useful when changing some text on multiple places using same text
|
||||
vim.keymap.set('x', '<leader>p', '"_dP')
|
||||
|
||||
vim.keymap.set('n', '<C-d>', '<C-d>zz', { desc = 'Move half page down and center cursor' })
|
||||
vim.keymap.set('n', '<C-u>', '<C-u>zz', { desc = 'Move half page up and center cursor' })
|
||||
|
||||
vim.keymap.set('n', 'n', 'nzzzv', { desc = 'Center view when moving to next instance of search' })
|
||||
vim.keymap.set('n', 'N', 'Nzzzv', { desc = 'Center view when moving to .instance of search' })
|
||||
|
||||
-- When pressing Esc key, also remove highlighted text from search.
|
||||
vim.keymap.set('n', '<esc>', '<cmd>nohlsearch<cr>')
|
||||
|
||||
vim.diagnostic.config { jump = { float = true } }
|
||||
-- diagnostic keymaps - goto_prev & goto_next are deprecated so I added line above
|
||||
-- vim.keymap.set('n', '[d', vim.diagnostic.goto_prev, { desc = 'go to previous [d]iagnostic message' })
|
||||
-- vim.keymap.set('n', ']d', vim.diagnostic.goto_next, { desc = 'go to next [d]iagnostic message' })
|
||||
vim.keymap.set('n', '<leader>e', vim.diagnostic.open_float, { desc = 'show diagnostic [e]rror messages' })
|
||||
vim.keymap.set('n', '<leader>q', vim.diagnostic.setloclist, { desc = 'open diagnostic [q]uickfix list' })
|
||||
|
||||
vim.keymap.set('n', '<leader>zd', '_f[lrx', { desc = 'toggle checkbox done' })
|
||||
vim.keymap.set('n', '<leader>zn', '_f[lr ', { desc = 'toggle checkbox not done' })
|
||||
|
||||
-- c for quicklist
|
||||
vim.keymap.set('n', '<M-j>', '<cmd>cnext<CR>', { desc = 'quicklist next item' })
|
||||
vim.keymap.set('n', '<M-k>', '<cmd>cprev<CR>', { desc = 'quicklist next item' })
|
||||
--cclose closes
|
||||
|
||||
--terminal options
|
||||
vim.keymap.set('n', '<space>to', function()
|
||||
vim.cmd.vnew()
|
||||
vim.cmd.term()
|
||||
vim.cmd.wincmd 'J'
|
||||
vim.api.nvim_win_set_height(0, 15)
|
||||
end)
|
||||
101
nvim/lua/markaya/settings.lua
Normal file
101
nvim/lua/markaya/settings.lua
Normal file
@@ -0,0 +1,101 @@
|
||||
vim.g.mapleader = ' '
|
||||
vim.g.maplocalleader = [[\]]
|
||||
vim.g.have_nerd_font = true
|
||||
|
||||
-- [[ Setting options ]]
|
||||
-- See `:help vim.opt`
|
||||
-- For more options, you can see `:help option-list`
|
||||
--
|
||||
|
||||
vim.opt.clipboard = 'unnamedplus'
|
||||
|
||||
vim.opt.termguicolors = true
|
||||
|
||||
vim.opt.number = true
|
||||
vim.opt.relativenumber = true
|
||||
|
||||
-- Enable mouse mode, can be useful for resizing splits for example!
|
||||
-- vim.opt.mouse = 'a'
|
||||
|
||||
-- Don't show the mode, since it's already in the status line
|
||||
vim.opt.showmode = false
|
||||
|
||||
-- Sync clipboard between OS and Neovim.
|
||||
-- Remove this option if you want your OS clipboard to remain independent.
|
||||
-- See `:help 'clipboard'`
|
||||
--vim.opt.clipboard = 'unnamedplus'
|
||||
--
|
||||
|
||||
vim.opt.tabstop = 4
|
||||
vim.opt.softtabstop = 4
|
||||
vim.opt.shiftwidth = 4
|
||||
vim.opt.expandtab = true
|
||||
|
||||
vim.opt.smartindent = true
|
||||
|
||||
-- Enable break indent
|
||||
vim.opt.breakindent = true
|
||||
|
||||
-- Save undo history
|
||||
vim.opt.undofile = true
|
||||
|
||||
-- Case-insensitive searching UNLESS \C or one or more capital letters in the search term
|
||||
vim.opt.ignorecase = true
|
||||
vim.opt.smartcase = true
|
||||
|
||||
-- Keep signcolumn on by default
|
||||
vim.opt.signcolumn = 'yes'
|
||||
|
||||
-- line wrap
|
||||
vim.opt.colorcolumn = { 80, 120, 160 }
|
||||
|
||||
-- Decrease update time
|
||||
vim.opt.updatetime = 250
|
||||
|
||||
-- Decrease mapped sequence wait time
|
||||
-- Displays which-key popup sooner
|
||||
vim.opt.timeoutlen = 300
|
||||
|
||||
-- Configure how new splits should be opened
|
||||
-- vim.opt.splitright = true
|
||||
-- vim.opt.splitbelow = true
|
||||
|
||||
-- Sets how neovim will display certain whitespace characters in the editor.
|
||||
-- See `:help 'list'`
|
||||
-- and `:help 'listchars'`
|
||||
vim.opt.list = true
|
||||
vim.opt.listchars = { tab = '» ', trail = '·', nbsp = '␣' }
|
||||
|
||||
-- Preview substitutions live, as you type!
|
||||
vim.opt.inccommand = 'split'
|
||||
|
||||
-- Show which line your cursor is on
|
||||
vim.opt.cursorline = true
|
||||
|
||||
-- Minimal number of screen lines to keep above and below the cursor.
|
||||
vim.opt.scrolloff = 10
|
||||
|
||||
-- [[ Basic Keymaps ]]
|
||||
-- See `:help vim.keymap.set()`
|
||||
|
||||
-- Set highlight on search, but clear on pressing <Esc> in normal mode
|
||||
vim.opt.hlsearch = true
|
||||
|
||||
-- highlight when yanking (copying) text
|
||||
-- try it with `yap` in normal mode
|
||||
-- see `:help vim.highlight.on_yank()`
|
||||
vim.api.nvim_create_autocmd('textyankpost', {
|
||||
desc = 'highlight when yanking (copying) text',
|
||||
group = vim.api.nvim_create_augroup('kickstart-highlight-yank', { clear = true }),
|
||||
callback = function()
|
||||
vim.hl.on_yank()
|
||||
-- vim.highlight.on_yank()
|
||||
end,
|
||||
})
|
||||
|
||||
function GoToLinkDefinition()
|
||||
vim.fn.search('\\[\\[', 'W')
|
||||
vim.cmd 'normal gd'
|
||||
end
|
||||
|
||||
vim.api.nvim_create_user_command('FindAndGoToDefinition', GoToLinkDefinition, {})
|
||||
54
nvim/lua/markaya/telescope/multigrep.lua
Normal file
54
nvim/lua/markaya/telescope/multigrep.lua
Normal file
@@ -0,0 +1,54 @@
|
||||
local pickers = require 'telescope.pickers'
|
||||
local finders = require 'telescope.finders'
|
||||
local make_entry = require 'telescope.make_entry'
|
||||
local conf = require('telescope.config').values
|
||||
|
||||
local M = {}
|
||||
|
||||
local live_multigrep = function(opts)
|
||||
opts = opts or {}
|
||||
opts.cwd = opts.cwd or vim.uv.cwd()
|
||||
|
||||
local finder = finders.new_async_job {
|
||||
command_generator = function(prompt)
|
||||
if not prompt or prompt == '' then
|
||||
return nil
|
||||
end
|
||||
local pieces = vim.split(prompt, ' ')
|
||||
local args = { 'rg' }
|
||||
if pieces[1] then
|
||||
table.insert(args, '-e')
|
||||
table.insert(args, pieces[1])
|
||||
end
|
||||
|
||||
if pieces[2] then
|
||||
table.insert(args, '-g')
|
||||
table.insert(args, pieces[2])
|
||||
end
|
||||
|
||||
---@diagnostic disable-next-line: deprecated
|
||||
return vim.tbl_flatten {
|
||||
args,
|
||||
{ '--color=never', '--no-heading', '--with-filename', '--line-number', '--column', '--smart-case' },
|
||||
}
|
||||
end,
|
||||
entry_maker = make_entry.gen_from_vimgrep(opts),
|
||||
cwd = opts.cwd,
|
||||
}
|
||||
|
||||
pickers
|
||||
.new(opts, {
|
||||
debounce = 100,
|
||||
prompt_title = 'Multi Grep',
|
||||
finder = finder,
|
||||
previewer = conf.grep_previewer(opts),
|
||||
sorter = require('telescope.sorters').empty(),
|
||||
})
|
||||
:find()
|
||||
end
|
||||
|
||||
M.setup = function()
|
||||
vim.keymap.set('n', '<leader>sg', live_multigrep, { desc = '[S]earch Multi [G]rep' })
|
||||
end
|
||||
|
||||
return M
|
||||
Reference in New Issue
Block a user