diff --git a/bashrc b/bashrc index 380f861..971e8c3 100644 --- a/bashrc +++ b/bashrc @@ -39,6 +39,10 @@ alias alert='notify-send --urgency=low -i "$([ $? = 0 ] && echo terminal || echo PATH="$HOME/.local/bin:$HOME/.cargo/bin:$HOME/.npm/bin:$PATH" +EDITOR=/usr/bin/nvim +SUDO_EDITOR=/usr/bin/nvim +VISUAL=/usr/bin/nvim + alias lz="lazygit" alias vi="nvim" alias vim="nvim" diff --git a/config/nvim/init.lua b/config/nvim/init.lua index 5e760ac..383007d 100644 --- a/config/nvim/init.lua +++ b/config/nvim/init.lua @@ -42,7 +42,6 @@ vim.o.softtabstop = 4 vim.o.cursorline = true vim.o.pumheight = 10 - vim.o.relativenumber = true vim.o.scrolloff = 8 @@ -113,12 +112,7 @@ require('lazy').setup({ -- LSP ---------------------------------------------------- { - 'neovim/nvim-lspconfig', - event = { "BufReadPre", "BufNewFile" }, - dependencies = { - { 'williamboman/mason.nvim', config = true }, - 'williamboman/mason-lspconfig.nvim', - }, + "neovim/nvim-lspconfig" }, { @@ -132,7 +126,6 @@ require('lazy').setup({ { 'hrsh7th/nvim-cmp', dependencies = { - 'onsails/lspkind.nvim', 'saadparwaiz1/cmp_luasnip', 'hrsh7th/cmp-nvim-lsp', 'rafamadriz/friendly-snippets', @@ -142,21 +135,6 @@ require('lazy').setup({ }, }, - -- { - -- 'zbirenbaum/copilot.lua', - -- config = function() - -- require('copilot').setup { - -- suggestion = { enabled = false }, - -- panel = { enabled = false }, - -- filetypes = { markdown = true }, - -- } - -- end, - -- }, - - -- { - -- 'zbirenbaum/copilot-cmp', - -- config = function() require('copilot_cmp').setup() end, - -- }, { "ahmedkhalf/project.nvim", config = function() @@ -196,64 +174,7 @@ require('lazy').setup({ end }, - -- { - -- "jay-babu/mason-null-ls.nvim", - -- event = { "BufReadPre", "BufNewFile" }, - -- dependencies = { - -- "williamboman/mason.nvim", - -- "jose-elias-alvarez/null-ls.nvim", - -- }, - -- config = function() - -- require("mason").setup() - -- require("mason-null-ls").setup({ - -- ensure_installed = { - -- -- Opt to list sources here, when available in mason. - -- }, - -- automatic_installation = false, - -- handlers = {}, - -- }) - -- require("null-ls").setup({ - -- sources = { - -- -- Anything not supported by mason. - -- } - -- }) - -- end, - -- }, - -- File explorer ------------------------------------------- - -- { - -- 's1n7ax/nvim-window-picker', - -- version = '2.*', - -- config = function() - -- require 'window-picker'.setup({ - -- filter_rules = { - -- include_current_win = false, - -- autoselect_one = true, - -- -- filter using buffer options - -- bo = { - -- -- if the file type is one of following, the window will be ignored - -- filetype = { 'neo-tree', "neo-tree-popup", "notify" }, - -- -- if the buffer type is one of following, the window will be ignored - -- buftype = { 'terminal', "quickfix" }, - -- }, - -- }, - -- highlights = { - -- statusline = { - -- unfocused = { - -- fg = '#d7af5f', - -- bg = '#262626', - -- bold = true, - -- }, - -- focused = { - -- fg = '#d7af5f', - -- bg = '#262626', - -- bold = true, - -- }, - -- }, - -- }, - -- }) - -- end, - -- }, { "ibhagwan/fzf-lua", -- optional for icon support @@ -536,8 +457,15 @@ require('lazy').setup({ }, { - "folke/neodev.nvim", - opts = {} + "folke/lazydev.nvim", + 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" } }, + }, + }, }, { @@ -593,32 +521,6 @@ require('lazy').setup({ { 'numToStr/Comment.nvim', opts = {} }, - -- { - -- "kdheepak/lazygit.nvim", - -- dependencies = { - -- "nvim-lua/plenary.nvim", - -- }, - -- }, - - -- { - -- 'akinsho/toggleterm.nvim', - -- version = "*", - -- config = function() - -- require("toggleterm").setup { - -- open_mapping = [[]], - -- shade_terminals = false, - -- highlights = { - -- Normal = { - -- guibg = "#262626", - -- }, - -- NormalNC = { - -- guibg = "#262626", - -- }, - -- }, - -- } - -- end, - -- }, - { "folke/todo-comments.nvim", dependencies = { "nvim-lua/plenary.nvim" }, @@ -646,153 +548,18 @@ require('lazy').setup({ ------------------------------------------------------------------- -- LSP Configurations ------------------------------------------------------------------- -local on_attach = function(_, bufnr) - local nmap = function(keys, func, desc) - if desc then - desc = 'LSP: ' .. desc - end - vim.keymap.set('n', keys, func, { buffer = bufnr, desc = desc }) - end +local lspconfig = require('lspconfig') - nmap('rn', vim.lsp.buf.rename, 'Rename') - nmap('ca', vim.lsp.buf.code_action, 'Code Action') - nmap('gd', vim.lsp.buf.definition, 'Goto Definition') - nmap('gD', vim.lsp.buf.declaration, 'Goto Declaration') - nmap('gI', vim.lsp.buf.implementation, 'Goto Implementation') - -- nmap('gr', require('telescope.builtin').lsp_references, 'Goto References') - nmap('D', vim.lsp.buf.type_definition, 'Type Definition') - nmap('K', vim.lsp.buf.hover, 'Hover Documentation') - nmap('', vim.lsp.buf.signature_help, 'Signature Documentation') - -- nmap('', vim.lsp.buf.format(), 'Format current buffer') - -- nmap('ds', require('telescope.builtin').lsp_document_symbols, 'Document Symbols') - -- nmap('ws', require('telescope.builtin').lsp_dynamic_workspace_symbols, 'Workspace Symbols') - - -- Create a command `:Format` local to the LSP buffer - vim.api.nvim_buf_create_user_command(bufnr, 'Format', function(_) - vim.lsp.buf.format() - end, { desc = 'Format current buffer with LSP' }) -end - --- Add LSP servers -local servers = { - lua_ls = { - Lua = { - workspace = { checkThirdParty = false }, - telemetry = { enable = false }, - }, - }, - clangd = { - cmd = { 'clangd', '--background-index' }, - filetypes = { 'c', 'cpp', 'objc', 'objcpp' }, - }, - rust_analyzer = {}, - bashls = {}, - pyright = {}, - marksman = {}, -} - -------------------------------------------------------------------- --- Plugin Setup -------------------------------------------------------------------- --- nvim-cmp supports additional completion capabilities, so broadcast that to servers -local capabilities = vim.lsp.protocol.make_client_capabilities() -capabilities = require('cmp_nvim_lsp').default_capabilities(capabilities) - --- Ensure the servers above are installed -local mason_lspconfig = require 'mason-lspconfig' - -mason_lspconfig.setup { - ensure_installed = vim.tbl_keys(servers), -} - --- mason_lspconfig.setup_handlers { --- function(server_name) --- require('lspconfig')[server_name].setup { --- capabilities = capabilities, --- on_attach = on_attach, --- settings = servers[server_name], --- } --- end, --- } - -local handlers = { - ["textDocument/hover"] = vim.lsp.with(vim.lsp.handlers.hover, { border = "solid" }), - ["textDocument/signatureHelp"] = vim.lsp.with(vim.lsp.handlers.signature_help, { border = "solid" }), -} - -require('lspconfig').rust_analyzer.setup { - on_attach = on_attach, - handlers = handlers, -} - -local opts = { - tools = { - runnables = { - use_telescope = true, - }, - inlay_hints = { - auto = true, - show_parameter_hints = false, - parameter_hints_prefix = "=> ", - other_hints_prefix = "=> ", - }, - }, - - -- all the opts to send to nvim-lspconfig - -- these override the defaults set by rust-tools.nvim - -- see https://github.com/neovim/nvim-lspconfig/blob/master/CONFIG.md#rust_analyzer - server = { - -- on_attach is a callback called when the language server attachs to the buffer - on_attach = on_attach, - settings = { - -- to enable rust-analyzer settings visit: - -- https://github.com/rust-analyzer/rust-analyzer/blob/master/docs/user/generated_config.adoc - ["rust-analyzer"] = { - -- enable clippy on save - checkOnSave = { - command = "clippy", - }, - }, - }, - }, -} - -require("rust-tools").setup(opts) - -require('lspconfig').clangd.setup { - on_attach = on_attach, - capabilities = { offsetEncoding = 'utf-16' }, - handlers = handlers, -} - -local runtime_path = vim.split(package.path, ';') -table.insert(runtime_path, "lua/?.lua") -table.insert(runtime_path, "lua/?/init.lua") -require 'lspconfig'.lua_ls.setup { - on_attach = on_attach, - capabilities = capabilities, - handlers = handlers, +-- Lua +lspconfig.lua_ls.setup {} +-- Rust +lspconfig.rust_analyzer.setup { + -- Server-specific settings. See `:help lspconfig-setup` settings = { - Lua = { - runtime = { - version = 'LuaJIT', - path = runtime_path, - }, - diagnostics = { - globals = { 'vim' }, - }, - workspace = { - library = vim.api.nvim_get_runtime_file("", true), - }, - telemetry = { - enable = false, - }, - }, + ['rust-analyzer'] = {}, }, } --- Setup neovim lua configuration - -- [[ Configure nvim-cmp ]] local cmp = require 'cmp' local luasnip = require 'luasnip' @@ -898,7 +665,6 @@ cmp.setup.cmdline(':', { -- [[ Configure Treesitter ]] require('nvim-treesitter.configs').setup { -- Add languages to be installed here that you want installed for treesitter - ensure_installed = { 'markdown_inline', 'markdown', 'c', 'cpp', 'go', 'lua', 'python', 'rust', 'tsx', 'typescript', 'vimdoc', 'vim' }, auto_install = true, highlight = { enable = true }, @@ -973,6 +739,13 @@ vim.keymap.set('n', 'h', require('smart-splits').swap_buf_left, vim.keymap.set('n', 'j', require('smart-splits').swap_buf_down, { desc = 'Swap buffer down' }) vim.keymap.set('n', 'k', require('smart-splits').swap_buf_up, { desc = 'Swap buffer up' }) vim.keymap.set('n', 'l', require('smart-splits').swap_buf_right, { desc = 'Swap buffer right' }) +-- Yank, delete, and paste always use system clipboard +vim.keymap.set({ 'n', 'v' }, 'y', '"+y', { noremap = true, silent = true }) +vim.keymap.set({ 'n', 'v' }, 'Y', '"+Y', { noremap = true, silent = true }) +vim.keymap.set({ 'n', 'v' }, 'd', '"+d', { noremap = true, silent = true }) +-- vim.keymap.set({ 'n', 'v' }, 'x', '"+x', { noremap = true, silent = true }) +vim.keymap.set({ 'n', 'v' }, 'p', '"+p', { noremap = true, silent = true }) +vim.keymap.set({ 'n', 'v' }, 'P', '"+P', { noremap = true, silent = true }) --Other vim.keymap.set('n', 's', ":HopWord", { desc = 'hop', silent = true }) vim.keymap.set('n', '', ":tabNext", { desc = 'Next tab', silent = true }) diff --git a/tmux.conf b/tmux.conf index b7d9549..fb3c8e1 100644 --- a/tmux.conf +++ b/tmux.conf @@ -37,12 +37,16 @@ bind -n M-3 select-window -t 3 bind -n M-4 select-window -t 4 bind -n M-5 select-window -t 5 bind -n C-M-n select-window -n + bind -n C-M-c new-window bind -n C-M-x confirm kill-pane -bind -n C-M-h split-window -v -c "#{pane_current_path}" + bind -n C-M-v split-window -h -c "#{pane_current_path}" +bind -n C-M-s split-window -v -c "#{pane_current_path}" + bind -n C-g display-popup -d "#{pane_current_path}" -E -w 90% -h 90% "lazygit" bind -n C-t display-popup -d "#{pane_current_path}" -E -w 90% -h 90% "btop" +bind -n C-f display-popup -d "#{pane_current_path}" -E -w 90% -h 90% "EDITOR=nvim ranger" set-option -g status-position top set-option -g default-terminal "tmux-256color" @@ -50,6 +54,7 @@ set-option -sa terminal-features ',xterm-256color:RGB' set-option -sg escape-time 1 set-option -g focus-events on set-option -g status-right-length 100 +set-option -g set-clipboard on # set -g allow-passthrough on # set -g extended-keys on