diff --git a/.config/nvim/init.lua b/.config/nvim/init.lua index ca5f795..4217c4e 100644 --- a/.config/nvim/init.lua +++ b/.config/nvim/init.lua @@ -7,6 +7,7 @@ require("user.options") require("user.keymaps") require("user.cmp") +require("user.nvim_navic") require("user.lsp") require("user.treesitter") require("user.blank_indent_highlight") @@ -18,9 +19,10 @@ require("user.dropbar") require("user.nvim_scrollbar") require("user.gitsigns") require("user.lualine") -require("user.dap.dap") require("user.dap.dapui") +require("user.dap.dap") require("user.neotree") +require("user.oil") require("user.which_key") require("user.harpoon") diff --git a/.config/nvim/lua/user/dap/dap.lua b/.config/nvim/lua/user/dap/dap.lua index f70ef13..e0e0977 100644 --- a/.config/nvim/lua/user/dap/dap.lua +++ b/.config/nvim/lua/user/dap/dap.lua @@ -1,37 +1,83 @@ local dap_status_ok, dap = pcall(require, "dap") if not dap_status_ok then + print("aaaaa") return end local dapui_status_ok, dapui = pcall(require, "dapui") if not dapui_status_ok then + print("fasdfasdfasdfasdf") return end + dap.adapters.coreclr = { - type = 'executable', - command = '/usr/local/netcoredbg', - args = {'--interpreter=vscode'} + type = 'executable', + command = '/home/nikita/.local/share/nvim/mason/bin/netcoredbg', + args = { '--interpreter=vscode' } } -dap.configurations.cs = { - { - type = "coreclr", - name = "launch - netcoredbg", - request = "launch", - program = function() - return vim.fn.input('Path to dll', vim.fn.getcwd() .. '/bin/Debug/', 'file') - end, - }, +vim.g.dotnet_build_project = function() + local default_path = vim.fn.getcwd() .. '/' + if vim.g['dotnet_last_proj_path'] ~= nil then + default_path = vim.g['dotnet_last_proj_path'] + end + local path = vim.fn.input('Path to your *proj file', default_path, 'file') + vim.g['dotnet_last_proj_path'] = path + local cmd = 'dotnet build -c Debug ' .. path .. ' > /dev/null' + print('') + print('Cmd to execute: ' .. cmd) + local f = os.execute(cmd) + if f == 0 then + print('\nBuild: ✔️ ') + else + print('\nBuild: ❌ (code: ' .. f .. ')') + end +end + +vim.g.dotnet_get_dll_path = function() + local request = function() + return vim.fn.input('Path to dll', vim.fn.getcwd(), 'file') + end + + if vim.g['dotnet_last_dll_path'] == nil then + vim.g['dotnet_last_dll_path'] = request() + else + if vim.fn.confirm('Do you want to change the path to dll?\n' .. vim.g['dotnet_last_dll_path'], '&yes\n&no', 2) == 1 then + vim.g['dotnet_last_dll_path'] = request() + end + end + + return vim.g['dotnet_last_dll_path'] +end + +local config = { + { + type = "coreclr", + name = "launch - netcoredbg", + request = "launch", + -- console = "integratedTerminal", + cwd = "${workspaceFolder}/src/ClientService.AspNet", + launchSettingsFilePath = "${workspaceFolder}/src/ClientService.AspNet/Properties/launchSettings.json", + launchSettingsProfile = "ClientService.AspNet", + program = function() + if vim.fn.confirm('Should I recompile first?', '&yes\n&no', 2) == 1 then + vim.g.dotnet_build_project() + end + return vim.g.dotnet_get_dll_path() + end, + }, } +dap.configurations.cs = config + --Autostart ui when debugging dap.listeners.after.event_initialized["dapui_config"] = function() - dapui.open() -end -dap.listeners.before.event_terminated["dapui_config"] = function() - dapui.close() -end -dap.listeners.before.event_exited["dapui_config"] = function() - dapui.close() + dapui.open() end +-- dap.listeners.before.event_terminated["dapui_config"] = function() +-- dapui.close() +-- end +-- dap.listeners.before.event_exited["dapui_config"] = function() +-- dapui.close() +-- end diff --git a/.config/nvim/lua/user/lsp/mason_lsp_config.lua b/.config/nvim/lua/user/lsp/mason_lsp_config.lua index 995deea..2b73bfc 100644 --- a/.config/nvim/lua/user/lsp/mason_lsp_config.lua +++ b/.config/nvim/lua/user/lsp/mason_lsp_config.lua @@ -1,5 +1,7 @@ local mason_lspconfig = require("mason-lspconfig") +local navic = require("nvim-navic") + mason_lspconfig.setup_handlers({ -- The first entry (without a key) will be the default handler -- and will be called for each installed server that doesn't have @@ -9,12 +11,16 @@ mason_lspconfig.setup_handlers({ on_attach = function(client, bufnr) if client.name == "omnisharp" then client.server_capabilities.semanticTokensProvider = nil + navic.attach(client, bufnr) end end, }) end, ["pylsp"] = function() require("lspconfig")["pylsp"].setup({ + on_attach = function(client, bufnr) + navic.attach(client, bufnr) + end, settings = { pylsp = { plugins = { @@ -29,6 +35,9 @@ mason_lspconfig.setup_handlers({ end, ["rust_analyzer"] = function() require("lspconfig")["rust_analyzer"].setup({ + on_attach = function(client, bufnr) + navic.attach(client, bufnr) + end, settings = { ["rust-analyzer"] = { cargo = { @@ -39,7 +48,11 @@ mason_lspconfig.setup_handlers({ }) end, function(server_name) -- default handler (optional) - require("lspconfig")[server_name].setup({}) + require("lspconfig")[server_name].setup({ + on_attach = function(client, bufnr) + navic.attach(client, bufnr) + end, + }) end, -- ["omnisharp"] = function() -- require("omnisharp").setup({}) diff --git a/.config/nvim/lua/user/neoscroll.lua b/.config/nvim/lua/user/neoscroll.lua index c814954..dbdd42c 100644 --- a/.config/nvim/lua/user/neoscroll.lua +++ b/.config/nvim/lua/user/neoscroll.lua @@ -11,16 +11,16 @@ require("neoscroll").setup({ performance_mode = false, }) -local t = {} --- Syntax: t[keys] = {function, {function arguments}} -t[''] = { 'scroll', { '-vim.wo.scroll', 'true', '250' } } -t[''] = { 'scroll', { 'vim.wo.scroll', 'true', '250' } } -t[''] = { 'scroll', { '-vim.api.nvim_win_get_height(0)', 'true', '450' } } -t[''] = { 'scroll', { 'vim.api.nvim_win_get_height(0)', 'true', '450' } } -t[''] = { 'scroll', { '-0.10', 'false', '100' } } -t[''] = { 'scroll', { '0.10', 'false', '100' } } -t['zt'] = { 'zt', { '250' } } -t['zz'] = { 'zz', { '250' } } -t['zb'] = { 'zb', { '250' } } +-- local t = {} +-- -- Syntax: t[keys] = {function, {function arguments}} +-- t[''] = { 'scroll', { '-vim.wo.scroll', 'true', '250' } } +-- t[''] = { 'scroll', { 'vim.wo.scroll', 'true', '250' } } +-- t[''] = { 'scroll', { '-vim.api.nvim_win_get_height(0)', 'true', '450' } } +-- t[''] = { 'scroll', { 'vim.api.nvim_win_get_height(0)', 'true', '450' } } +-- t[''] = { 'scroll', { '-0.10', 'false', '100' } } +-- t[''] = { 'scroll', { '0.10', 'false', '100' } } +-- t['zt'] = { 'zt', { '250' } } +-- t['zz'] = { 'zz', { '250' } } +-- t['zb'] = { 'zb', { '250' } } -require('neoscroll.config').set_mappings(t) +-- require('neoscroll.config').set_mappings(t) diff --git a/.config/nvim/lua/user/nvim_navic.lua b/.config/nvim/lua/user/nvim_navic.lua new file mode 100644 index 0000000..ca609c2 --- /dev/null +++ b/.config/nvim/lua/user/nvim_navic.lua @@ -0,0 +1,12 @@ +local nvim_navic_status_ok, nvim_navic = pcall(require, "nvim-navic") +if not nvim_navic_status_ok then + return +end + +nvim_navic.setup({ + lsp = { + auto_attach = true + } +}) + +-- vim.o.winbar = "%t %{%v:lua.require'nvim-navic'.get_location()%}" diff --git a/.config/nvim/lua/user/oil.lua b/.config/nvim/lua/user/oil.lua new file mode 100644 index 0000000..22663ba --- /dev/null +++ b/.config/nvim/lua/user/oil.lua @@ -0,0 +1,113 @@ +local oil_status_ok, oil = pcall(require, "scrollbar") +if not oil_status_ok then + return +end + +oil.setup({ + default_file_explorer = false, + columns = { + "icon", + }, + -- Buffer-local options to use for oil buffers + buf_options = { + buflisted = false, + bufhidden = "hide", + }, + -- Window-local options to use for oil buffers + win_options = { + wrap = false, + signcolumn = "no", + cursorcolumn = false, + foldcolumn = "0", + spell = false, + list = false, + conceallevel = 3, + concealcursor = "nvic", + }, + -- Send deleted files to the trash instead of permanently deleting them (:help oil-trash) + delete_to_trash = false, + -- Skip the confirmation popup for simple operations (:help oil.skip_confirm_for_simple_edits) + skip_confirm_for_simple_edits = false, + -- Selecting a new/moved/renamed file or directory will prompt you to save changes first + -- (:help prompt_save_on_select_new_entry) + prompt_save_on_select_new_entry = true, + -- Oil will automatically delete hidden buffers after this delay + -- You can set the delay to false to disable cleanup entirely + -- Note that the cleanup process only starts when none of the oil buffers are currently displayed + cleanup_delay_ms = 2000, + lsp_file_methods = { + -- Time to wait for LSP file operations to complete before skipping + timeout_ms = 1000, + -- Set to true to autosave buffers that are updated with LSP willRenameFiles + -- Set to "unmodified" to only save unmodified buffers + autosave_changes = false, + }, + -- Constrain the cursor to the editable parts of the oil buffer + -- Set to `false` to disable, or "name" to keep it on the file names + constrain_cursor = "editable", + -- Set to true to watch the filesystem for changes and reload oil + experimental_watch_for_changes = false, + -- Keymaps in oil buffer. Can be any value that `vim.keymap.set` accepts OR a table of keymap + -- options with a `callback` (e.g. { callback = function() ... end, desc = "", mode = "n" }) + -- Additionally, if it is a string that matches "actions.", + -- it will use the mapping at require("oil.actions"). + -- Set to `false` to remove a keymap + -- See :help oil-actions for a list of all available actions + keymaps = { + ["g?"] = "actions.show_help", + [""] = "actions.select", + [""] = { "actions.select", opts = { vertical = true }, desc = "Open the entry in a vertical split" }, + [""] = { "actions.select", opts = { horizontal = true }, desc = "Open the entry in a horizontal split" }, + [""] = { "actions.select", opts = { tab = true }, desc = "Open the entry in new tab" }, + [""] = "actions.preview", + [""] = "actions.close", + [""] = "actions.refresh", + ["-"] = "actions.parent", + ["_"] = "actions.open_cwd", + ["`"] = "actions.cd", + ["~"] = { "actions.cd", opts = { scope = "tab" }, desc = ":tcd to the current oil directory" }, + ["gs"] = "actions.change_sort", + ["gx"] = "actions.open_external", + ["g."] = "actions.toggle_hidden", + ["g\\"] = "actions.toggle_trash", + }, + -- Set to false to disable all of the above keymaps + use_default_keymaps = true, + view_options = { + -- Show files and directories that start with "." + show_hidden = false, + -- This function defines what is considered a "hidden" file + is_hidden_file = function(name, bufnr) + return vim.startswith(name, ".") + end, + -- This function defines what will never be shown, even when `show_hidden` is set + is_always_hidden = function(name, bufnr) + return false + end, + -- Sort file names in a more intuitive order for humans. Is less performant, + -- so you may want to set to false if you work with large directories. + natural_order = true, + sort = { + -- sort order can be "asc" or "desc" + -- see :help oil-columns to see which columns are sortable + { "type", "asc" }, + { "name", "asc" }, + }, + }, + -- Configuration for the floating window in oil.open_float + float = { + -- Padding around the floating window + padding = 2, + max_width = 0, + max_height = 0, + border = "rounded", + win_options = { + winblend = 0, + }, + -- This is the config that will be passed to nvim_open_win. + -- Change values here to customize the layout + override = function(conf) + return conf + end, + }, +}) diff --git a/.config/nvim/lua/user/options.lua b/.config/nvim/lua/user/options.lua index 5cee8f5..457beed 100644 --- a/.config/nvim/lua/user/options.lua +++ b/.config/nvim/lua/user/options.lua @@ -18,9 +18,13 @@ vim.opt.updatetime = 300 vim.opt.ttimeoutlen = 5 vim.opt.signcolumn = "yes:2" +vim.opt.keymap = "russian-jcukenwin" +vim.opt.iminsert=0 +vim.opt.imsearch=0 + vim.g.netrw_banner = 0 -vim.cmd("set showtabline=1") +-- vim.cmd("set showtabline=1") vim.api.nvim_create_autocmd("FileType", { pattern = "cs", diff --git a/.config/nvim/lua/user/plugins.lua b/.config/nvim/lua/user/plugins.lua index 1b4816d..5231910 100644 --- a/.config/nvim/lua/user/plugins.lua +++ b/.config/nvim/lua/user/plugins.lua @@ -24,10 +24,6 @@ lazy.setup({ "nvim-lua/popup.nvim", -- An implementation of the Popup API from vim in Neovim "nvim-lua/plenary.nvim", -- Useful lua functions used ny lots of plugins "navarasu/onedark.nvim", - "morhetz/gruvbox", - "Mofiqul/dracula.nvim", - "folke/tokyonight.nvim", - "windwp/nvim-autopairs", "hrsh7th/nvim-cmp", -- The completion plugin @@ -46,10 +42,18 @@ lazy.setup({ "williamboman/mason.nvim", -- simple to use language server installer "williamboman/mason-lspconfig.nvim", "neovim/nvim-lspconfig", -- enable LSP - -- "williamboman/nvim-lsp-installer") -- simple to use language server installer "nvim-treesitter/nvim-treesitter-refactor", -- file explorer + { + 'stevearc/oil.nvim', + opts = {}, + -- Optional dependencies + dependencies = { "nvim-tree/nvim-web-devicons" }, + init = function() + + end + }, { "nvim-neo-tree/neo-tree.nvim", branch = "v3.x", @@ -58,15 +62,8 @@ lazy.setup({ "nvim-tree/nvim-web-devicons", "MunifTanjim/nui.nvim", } - }, - { - "kyazdani42/nvim-tree.lua", - dependencies = { - "kyazdani42/nvim-web-devicons", -- optional, for file icons - }, - tag = "nightly", -- optional, updated every week. (see issue #1193) - }, - + } + , { "akinsho/bufferline.nvim", version = "*", @@ -124,7 +121,13 @@ lazy.setup({ --debugging "mfussenegger/nvim-dap", - "rcarriga/nvim-dap-ui", + { + "rcarriga/nvim-dap-ui", + dependencies = { + "mfussenegger/nvim-dap", + "nvim-neotest/nvim-nio" + } + }, "nvim-lualine/lualine.nvim", @@ -144,6 +147,9 @@ lazy.setup({ { "SmiteshP/nvim-navic" }, }, }, + -- { + -- "SmiteshP/nvim-navic", + -- }, { "karb94/neoscroll.nvim", }, diff --git a/.config/nvim/lua/user/which_key.lua b/.config/nvim/lua/user/which_key.lua index ad1ab8b..a203430 100644 --- a/.config/nvim/lua/user/which_key.lua +++ b/.config/nvim/lua/user/which_key.lua @@ -73,6 +73,10 @@ which_key.setup({ which_key.register({ name = "Hotkeys", + o = { + ":Oil --float ", + "Oil nvim toggle", + }, e = { ":Neotree toggle ", "File tree toggle", diff --git a/.zshrc b/.zshrc index 844f25b..b587fcd 100644 --- a/.zshrc +++ b/.zshrc @@ -15,7 +15,7 @@ zplug load ZSH_THEME="simple" -plugins=(git jsontools vi-mode sudo) +plugins=(git jsontools sudo) zstyle ':omz:update' mode disabled source $ZSH/oh-my-zsh.sh