local inspect = require('inspect') require('ldraneyLua/sudoCheckSave') require('hotkeys') require('netrw/netrw') --Global options vim.opt.list = true --vim.opt.listchars:append("space:⋅") vim.opt.listchars:append("eol:↴") --require("indent_blankline").setup { --show_end_of_line = true, --space_char_blankline = " ", --} --turn off automatic comments for newlines with o --https://www.reddit.com/r/neovim/comments/sqld76/stop_automatic_newline_continuation_of_comments/ vim.cmd("autocmd BufEnter * set formatoptions-=cro") vim.cmd("autocmd BufEnter * setlocal formatoptions-=cro") --local function tmux_split_even_horizontal() --local filepath = vim.fn.expand('%:p') --if filepath ~= '' then --local tmux_command = "tmux split-window -h -c '" .. vim.fn.expand('%:p:h') .. "' && tmux send-keys -t '.tmux.active-pane' 'nvim " .. vim.fn.shellescape(filepath) .. "' Enter && tmux select-layout even-horizontal" --vim.fn.system(tmux_command) --end --end --vim.api.nvim_set_keymap('n', 'th', ':lua tmux_split_even_horizontal()', { noremap = true, silent = true }) --_G.tmux_split_even_horizontal = function() --local filepath = vim.fn.expand('%:p') --if filepath ~= '' then --local tmux_command = "tmux split-window -h -c '" .. vim.fn.expand('%:p:h') .. "' && tmux send-keys -t '.tmux.active-pane' 'nvim " .. vim.fn.shellescape(filepath) .. "' Enter && tmux select-layout even-horizontal" --vim.fn.system(tmux_command) --end --end --_G.tmux_split_even_horizontal = function() --local filepath = vim.fn.expand('%:p') --if filepath ~= '' then --local tmux_command = "tmux split-window -h 'nvim'" --vim.fn.system(tmux_command) ----print("Pane ID: " .. tmux_pane_id) --print("Filepath: " .. filepath) --end --end _G.tmux_split_even_horizontal = function() local filepath = vim.fn.expand('%:p') if filepath ~= '' then local tmux_command = "tmux split-window -h 'nvim -n " .. filepath .. "'; select-layout even-horizontal" vim.fn.system(tmux_command) print("Filepath: " .. filepath) end end vim.api.nvim_set_keymap('n', 'th', ':lua _G.tmux_split_even_horizontal()', { noremap = true, silent = true }) -- -- -- --require('lspconfig').pyright.setup{} --require('lspconfig').bashls.setup{} --require'lspconfig'.pylsp.setup{} ---- Mappings. ---- See `:help vim.diagnostic.*` for documentation on any of the below functions --local opts = { noremap=true, silent=true } --vim.api.nvim_set_keymap('n', 'e', 'lua vim.diagnostic.open_float()', opts) --vim.api.nvim_set_keymap('n', '[d', 'lua vim.diagnostic.goto_prev()', opts) --vim.api.nvim_set_keymap('n', ']d', 'lua vim.diagnostic.goto_next()', opts) --vim.api.nvim_set_keymap('n', 'q', 'lua vim.diagnostic.setloclist()', opts) ---- Use an on_attach function to only map the following keys ---- after the language server attaches to the current buffer --local on_attach = function(client, bufnr) ---- Enable completion triggered by --vim.api.nvim_buf_set_option(bufnr, 'omnifunc', 'v:lua.vim.lsp.omnifunc') ---- Mappings. ---- See `:help vim.lsp.*` for documentation on any of the below functions --vim.api.nvim_set_keymap("n", "rn", "lua vim.lsp.buf.rename()", { noremap = true }) --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gD', 'lua vim.lsp.buf.declaration()', opts) --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gd', 'lua vim.lsp.buf.definition()', opts) --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'K', 'lua vim.lsp.buf.hover()', opts) --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gi', 'lua vim.lsp.buf.implementation()', opts) --vim.api.nvim_buf_set_keymap(bufnr, 'n', '', 'lua vim.lsp.buf.signature_help()', opts) --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wa', 'lua vim.lsp.buf.add_workspace_folder()', opts) --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wr', 'lua vim.lsp.buf.remove_workspace_folder()', opts) --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'wl', 'lua print(vim.inspect(vim.lsp.buf.list_workspace_folders()))', opts) --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'D', 'lua vim.lsp.buf.type_definition()', opts) --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'rn', 'lua vim.lsp.buf.rename()', opts) --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'ca', 'lua vim.lsp.buf.code_action()', opts) --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'gr', 'lua vim.lsp.buf.references()', opts) --vim.api.nvim_buf_set_keymap(bufnr, 'n', 'f', 'lua vim.lsp.buf.formatting()', opts) --end ---- Use a loop to conveniently call 'setup' on multiple servers and ---- map buffer local keybindings when the language server attaches --local servers = { 'pyright', 'rust_analyzer', 'tsserver' } --for _, lsp in pairs(servers) do --require('lspconfig')[lsp].setup { --on_attach = on_attach, --flags = { ---- This will be the default in neovim 0.7+ --debounce_text_changes = 150, --} --} --end ---- Add additional capabilities supported by nvim-cmp --local capabilities = vim.lsp.protocol.make_client_capabilities() --capabilities = require('cmp_nvim_lsp').update_capabilities(capabilities) --local lspconfig = require('lspconfig') ---- Enable some language servers with the additional completion capabilities offered by nvim-cmp --local servers = { 'clangd', 'rust_analyzer', 'pyright', 'tsserver' } --for _, lsp in ipairs(servers) do --lspconfig[lsp].setup { ---- on_attach = my_custom_on_attach, --capabilities = capabilities, --} --end ---- luasnip setup --local luasnip = require 'luasnip' ---- nvim-cmp setup --local cmp = require 'cmp' --cmp.setup { --snippet = { --expand = function(args) --require('luasnip').lsp_expand(args.body) --end, --}, --mapping = { --[''] = cmp.mapping.select_prev_item(), --[''] = cmp.mapping.select_next_item(), --[''] = cmp.mapping.scroll_docs(-4), --[''] = cmp.mapping.scroll_docs(4), --[''] = cmp.mapping.complete(), --[''] = cmp.mapping.close(), --[''] = cmp.mapping.confirm { --behavior = cmp.ConfirmBehavior.Replace, --select = true, --}, --[''] = function(fallback) --if cmp.visible() then --cmp.select_next_item() --elseif luasnip.expand_or_jumpable() then --luasnip.expand_or_jump() --else --fallback() --end --end, --[''] = function(fallback) --if cmp.visible() then --cmp.select_prev_item() --elseif luasnip.jumpable(-1) then --luasnip.jump(-1) --else --fallback() --end --end, --}, --sources = { --{ name = 'nvim_lsp' }, --{ name = 'luasnip' }, --}, --}