diff --git a/alacritty/.config/alacritty/alacritty.yml b/alacritty/.config/alacritty/alacritty.yml index edf9c61..52fab34 100644 --- a/alacritty/.config/alacritty/alacritty.yml +++ b/alacritty/.config/alacritty/alacritty.yml @@ -9,7 +9,7 @@ # All imports must either be absolute paths starting with `/`, or paths relative # to the user's home directory starting with `~/`. import: - - ~/.config/alacritty/nightfox_alacritty.yml + - ~/.config/alacritty/material_ocean.yml # Any items in the `env` entry below will be added as # environment variables. Some entries may override variables @@ -111,7 +111,7 @@ font: # - (macOS) Menlo # - (Linux/BSD) monospace # - (Windows) Consolas - family: Fira Code Nerd Font + family: JetBrains Mono Nerd Font # The `style` can be specified to pick a specific face. #style: Regular @@ -150,7 +150,7 @@ font: #style: Bold Italic # Point size - size: 13.0 + size: 12.0 # Offset is the extra space around each character. `offset.y` can be thought # of as modifying the line spacing, and `offset.x` as modifying the letter diff --git a/nvim/.config/nvim/lua/lspconf.lua b/nvim/.config/nvim/lua/lspconf.lua index 43293f6..310917b 100644 --- a/nvim/.config/nvim/lua/lspconf.lua +++ b/nvim/.config/nvim/lua/lspconf.lua @@ -6,63 +6,83 @@ local cmp_autopairs = require("nvim-autopairs.completion.cmp") local luasnip = require("luasnip") require("luasnip.loaders.from_vscode").lazy_load() cmp.setup({ - formatting = { - format = lspkind.cmp_format(), - }, - snippet = { - expand = function(args) - require("luasnip").lsp_expand(args.body) - end, - }, - mapping = { - [""] = cmp.mapping.select_prev_item(), - [""] = cmp.mapping.select_next_item(), - [""] = cmp.mapping({ - i = cmp.mapping.abort(), - c = cmp.mapping.close(), - }), - [""] = cmp.mapping.confirm({ select = true }), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_next_item() - elseif luasnip.expandable() then - luasnip.expand() - elseif luasnip.expand_or_jumpable() then - luasnip.expand_or_jump() - else - fallback() - end - end), - [""] = cmp.mapping(function(fallback) - if cmp.visible() then - cmp.select_prev_item() - elseif luasnip.jumpable(-1) then - luasnip.jump(-1) - else - fallback() - end - end), - }, - sources = cmp.config.sources({ - { name = "nvim_lsp" }, - { name = "luasnip" }, - { name = "buffer" }, - { name = "path" }, - }), - ghost_text = true, + formatting = { + format = lspkind.cmp_format(), + }, + snippet = { + expand = function(args) + require("luasnip").lsp_expand(args.body) + end, + }, + mapping = { + [""] = cmp.mapping.select_prev_item(), + [""] = cmp.mapping.select_next_item(), + [""] = cmp.mapping({ + i = cmp.mapping.abort(), + c = cmp.mapping.close(), + }), + [""] = cmp.mapping.confirm({ select = true }), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_next_item() + elseif luasnip.expandable() then + luasnip.expand() + elseif luasnip.expand_or_jumpable() then + luasnip.expand_or_jump() + else + fallback() + end + end), + [""] = cmp.mapping(function(fallback) + if cmp.visible() then + cmp.select_prev_item() + elseif luasnip.jumpable(-1) then + luasnip.jump(-1) + else + fallback() + end + end), + }, + sources = cmp.config.sources({ + { name = "nvim_lsp" }, + { name = "luasnip" }, + { name = "buffer" }, + { name = "path" }, + }), + ghost_text = true, }) cmp.event:on("confirm_done", cmp_autopairs.on_confirm_done()) + +local formatting_on_attach = function(client, bufnr) + local augroup = vim.api.nvim_create_augroup("LspFormatting", {}) + if client.supports_method("textDocument/formatting") then + vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) + vim.api.nvim_create_autocmd("BufWritePre", { + group = augroup, + buffer = bufnr, + callback = function() + vim.lsp.buf.formatting_sync() + end, + }) + end +end + local capabilities = require("cmp_nvim_lsp").update_capabilities(vim.lsp.protocol.make_client_capabilities()) local servers = { "pyright", "vimls", "ansiblels", "dockerls", "bashls", "solc", "eslint", "gopls", "marksman" } for _, lsp in ipairs(servers) do - -- Handles setup for only adding language servers for those that are installed - local result = vim.api.nvim_exec([[echo executable("]] .. lsp .. [[")]], true) - if tonumber(result) ~= 0 then - nvim_lsp[lsp].setup({ - capabilities = capabilities, - }) - end + -- Handles setup for only adding language servers for those that are installed + local result = vim.api.nvim_exec([[echo executable("]] .. lsp .. [[")]], true) + if tonumber(result) ~= 0 then + nvim_lsp[lsp].setup({ + capabilities = capabilities, + on_attach = function(client, bufnr) + if lsp == "gopls" then + formatting_on_attach(client, bufnr) + end + end + }) + end end local lsp_formatting = function(bufnr) vim.lsp.buf.format({ @@ -88,35 +108,36 @@ local formatting_attach = end, require("lspconfig").sumneko_lua.setup({ - settings = { - Lua = { - runtime = { - -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) - version = "LuaJIT", - }, - diagnostics = { - -- Get the language server to recognize the `vim` global - globals = { "vim", "use" }, - }, - workspace = { - -- Make the server aware of Neovim runtime files - library = vim.api.nvim_get_runtime_file("", true), - }, - -- Do not send telemetry data containing a randomized but unique identifier - telemetry = { - enable = false, - }, - }, - }, - on_attach = formatting_attach, - }) + settings = { + Lua = { + runtime = { + -- Tell the language server which version of Lua you're using (most likely LuaJIT in the case of Neovim) + version = "LuaJIT", + }, + diagnostics = { + -- Get the language server to recognize the `vim` global + globals = { "vim", "use", "beautiful", "awful" }, + }, + workspace = { + -- Make the server aware of Neovim runtime files + library = vim.api.nvim_get_runtime_file("", true), + }, + -- Do not send telemetry data containing a randomized but unique identifier + telemetry = { + enable = false, + }, + }, + }, + capabilities = capabilities, + on_attach = formatting_on_attach +}) local rust_opts = { - server = { - on_attach = function(client) - client.server_capabilities.document_formatting = false - client.server_capabilities.document_range_formatting = false - end, - }, + server = { + on_attach = function(client) + client.server_capabilities.document_formatting = false + client.server_capabilities.document_range_formatting = false + end, + }, } require("rust-tools").setup(rust_opts) require("trouble").setup({}) @@ -130,3 +151,23 @@ require("null-ls").setup({ formatting.stylua, }, }) +-- local formatting = require("null-ls").builtins.formatting +-- require("null-ls").setup({ +-- -- you can reuse a shared lspconfig on_attach callback here +-- on_attach = function(client, bufnr) +-- if client.supports_method("textDocument/formatting") then +-- vim.api.nvim_clear_autocmds({ group = augroup, buffer = bufnr }) +-- vim.api.nvim_create_autocmd("BufWritePre", { +-- group = augroup, +-- buffer = bufnr, +-- callback = function() +-- vim.lsp.buf.formatting_sync() +-- end, +-- }) +-- end +-- end, +-- sources = { +-- formatting.gofmt, +-- formatting.stylua, +-- }, +-- }) diff --git a/nvim/.config/nvim/lua/packer-plugins.lua b/nvim/.config/nvim/lua/packer-plugins.lua index 69434d6..c6d94bf 100644 --- a/nvim/.config/nvim/lua/packer-plugins.lua +++ b/nvim/.config/nvim/lua/packer-plugins.lua @@ -67,6 +67,7 @@ return require("packer").startup({ }) use("lukas-reineke/indent-blankline.nvim") use("EdenEast/nightfox.nvim") + use("folke/tokyonight.nvim") -- Treesitter use({ "nvim-treesitter/nvim-treesitter", run = ":TSUpdate" }) use("p00f/nvim-ts-rainbow") diff --git a/nvim/.config/nvim/lua/ui.lua b/nvim/.config/nvim/lua/ui.lua index d861a07..25a6c99 100644 --- a/nvim/.config/nvim/lua/ui.lua +++ b/nvim/.config/nvim/lua/ui.lua @@ -7,3 +7,4 @@ require("indent_blankline").setup({ }) require("telescope").load_extension("fzf") +require("telescope").load_extension("harpoon") diff --git a/tmux/.config/tmux/tmux.conf b/tmux/.config/tmux/tmux.conf index fa4b740..6396e5d 100644 --- a/tmux/.config/tmux/tmux.conf +++ b/tmux/.config/tmux/tmux.conf @@ -1,4 +1,5 @@ -set -g default-terminal "tmux-256color" +set -g default-terminal "xterm-256color" +set-option -ga terminal-overrides ",xterm-256color:Tc" # tmux options set -ga terminal-overrides ",alacritty:RGB" set-option -sg escape-time 10 diff --git a/zsh/.config/zsh/.zshrc b/zsh/.config/zsh/.zshrc index 463f225..6a85d81 100644 --- a/zsh/.config/zsh/.zshrc +++ b/zsh/.config/zsh/.zshrc @@ -29,6 +29,8 @@ export GPG_TTY=$(tty) export EDITOR='nvim' export SUDO_EDITOR='nvim' +#set terminal to emacs bindings so that Ctr+R works in tmux +bindkey -e alias python='python3' # if [[ ! $(uname -r) == *"WSL"* ]]; then diff --git a/zsh/.zshenv b/zsh/.zshenv index 1601f21..2b21eb1 100644 --- a/zsh/.zshenv +++ b/zsh/.zshenv @@ -1 +1,2 @@ export ZDOTDIR=$HOME/.config/zsh +. "$HOME/.cargo/env"