diff --git a/src/home/shell/default.nix b/src/home/shell/default.nix index a209d89..7f465c6 100644 --- a/src/home/shell/default.nix +++ b/src/home/shell/default.nix @@ -16,7 +16,7 @@ ./ripgrep.nix ./shell.nix ./tmux - ./vim.nix + ./vim ./w3m.nix ./yazi.nix ./zoxide.nix diff --git a/src/home/shell/neovim/config/init.lua b/src/home/shell/neovim/config/init.lua index 755cf25..db19913 100644 --- a/src/home/shell/neovim/config/init.lua +++ b/src/home/shell/neovim/config/init.lua @@ -94,10 +94,10 @@ vim.keymap.set("t", "", "", { desc = "Exit terminal mode" } -- Use CTRL+ to switch between windows -- -- See `:help wincmd` for a list of all window commands -vim.keymap.set("n", "", "", { desc = "Move focus to the left window" }) -vim.keymap.set("n", "", "", { desc = "Move focus to the right window" }) -vim.keymap.set("n", "", "", { desc = "Move focus to the lower window" }) -vim.keymap.set("n", "", "", { desc = "Move focus to the upper window" }) +-- vim.keymap.set("n", "", "", { desc = "Move focus to the left window" }) +-- vim.keymap.set("n", "", "", { desc = "Move focus to the right window" }) +-- vim.keymap.set("n", "", "", { desc = "Move focus to the lower window" }) +-- vim.keymap.set("n", "", "", { desc = "Move focus to the upper window" }) -- [[ Basic Autocommands ]] -- See `:help lua-guide-autocommands` @@ -186,7 +186,7 @@ require("lazy").setup({ { "d", group = "[D]ocument" }, { "r", group = "[R]ename" }, { "s", group = "[S]earch" }, - { "w", group = "[W]orkspace" }, + { "w", group = "[W]orkspace|[W]indow" }, { "t", group = "[T]oggle" }, { "h", group = "Git [H]unk", mode = { "n", "v" } }, }, @@ -779,8 +779,8 @@ require("lazy").setup({ keys = { -- stylua: ignore start { "-", "Oil", desc = "Open parent directory" }, - { "fm", "Oil", desc = "[F]ile [M]anager" }, - { "fM", "Oil --float", desc = "[F]ile [M]anager" }, + { "fm", "Oil", desc = "[F]ile [M]anager" }, + { "fM", "Oil --float", desc = "[F]ile [M]anager" }, -- stylua: ignore end }, init = function() @@ -796,7 +796,13 @@ require("lazy").setup({ "TmuxNavigateRight", }, -- stylua: ignore start - keys = { "", "", "", "" }, + keys = { + "", "", "", "", + { "wh", "TmuxNavigateLeft", desc = "[W]indow Left" }, + { "wl", "TmuxNavigateRight", desc = "[W]indow Right" }, + { "wk", "TmuxNavigateUp", desc = "[W]indow Up" }, + { "wj", "TmuxNavigateDown", desc = "[W]indow Down" }, + }, -- stylua: ignore end config = function() vim.g.tmux_navigator_no_wrap = 1 @@ -899,12 +905,13 @@ require("lazy").setup({ }, }) +-- Keymaps vim.keymap.set("n", "", "nohlsearch") vim.keymap.set("t", "", "", { desc = "Exit terminal mode" }) vim.keymap.set("n", "fs", "w", { desc = "Save file" }) -vim.keymap.set("n", "ws", "split", { desc = "[W]indow Horizontal [S]plit" }) -- split horizontal -vim.keymap.set("n", "wv", "vsplit", { desc = "[W]indow [V]ertical Split" }) -- split vertical -vim.keymap.set("n", "wq", "q", { desc = "[W]indow [Q]uit" }) -- quit +vim.keymap.set("n", "ws", "split", { desc = "[W]indow Horizontal [S]plit" }) +vim.keymap.set("n", "wv", "vsplit", { desc = "[W]indow [V]ertical Split" }) +vim.keymap.set("n", "wq", "q", { desc = "[W]indow [Q]uit" }) vim.keymap.set("n", "x", "!chmod +x %", { desc = "Chmod File E[x]ecutable", silent = true }) vim.keymap.set("n", "lz", "Lazy", { desc = "[L]azy", silent = true }) vim.keymap.set("n", "lp", "Lazy profile", { desc = "[L]azy [P]rofile", silent = true }) diff --git a/src/home/shell/vim.nix b/src/home/shell/vim.nix deleted file mode 100644 index de5b1de..0000000 --- a/src/home/shell/vim.nix +++ /dev/null @@ -1,15 +0,0 @@ -{ pkgs, ... }: -{ - home.packages = with pkgs; [ - vim-full - ]; - - custom.persist = { - home.directories = [ - ".vim" - ]; - home.files = [ - ".vimrc" - ]; - }; -} diff --git a/src/home/shell/vim/default.nix b/src/home/shell/vim/default.nix new file mode 100644 index 0000000..3e1145d --- /dev/null +++ b/src/home/shell/vim/default.nix @@ -0,0 +1,22 @@ +{ + pkgs, + config, + dots, + ... +}: +{ + home.packages = with pkgs; [ + vim-full + ]; + + home.file.".vimrc".source = config.lib.file.mkOutOfStoreSymlink "${dots}/src/home/shell/vim/vimrc"; + + custom.persist = { + home.directories = [ + ".vim" + ]; + # home.files = [ + # ".vimrc" + # ]; + }; +} diff --git a/src/home/shell/vim/vimrc b/src/home/shell/vim/vimrc new file mode 100644 index 0000000..54857a7 --- /dev/null +++ b/src/home/shell/vim/vimrc @@ -0,0 +1,148 @@ +let g:plug_home=$HOME."/.vim/plugged" + +call plug#begin() +Plug 'tpope/vim-sensible' +Plug 'tpope/vim-sleuth' +Plug 'tpope/vim-eunuch' +Plug 'tpope/vim-vinegar' +Plug 'tpope/vim-markdown' +Plug 'tpope/vim-surround' +Plug 'tpope/vim-commentary' +Plug 'tpope/vim-fugitive' +Plug 'tpope/vim-abolish' +" Plug 'airblade/vim-gitgutter' +" Plug 'junegunn/fzf.vim' | Plug '/etc/profiles/per-user/rayandrew/share/vim-pl' +Plug 'junegunn/fzf' " , { 'do': { -> fzf#install() } } +Plug 'junegunn/fzf.vim' +Plug 'christoomey/vim-tmux-navigator' +Plug 'ryvnf/readline.vim' +Plug 'mg979/vim-visual-multi', {'branch': 'master'} +Plug 'yegappan/lsp' +Plug 'mbbill/undotree' +Plug 'github/copilot.vim' +Plug 'voldikss/vim-floaterm' +Plug 'jasonccox/vim-wayland-clipboard' +Plug 'tmux-plugins/vim-tmux-focus-events' +Plug 'roxma/vim-tmux-clipboard' +call plug#end() + +" Global settings +let mapleader = " " +let maplocalleader = " " +filetype plugin indent on +set shm+=I +set mouse=a +set number +" set paste +set clipboard^=unnamed,unnamedplus +" set clipboard=unnamed +" set clipboard=unnamedplus +set signcolumn=no + +" Vim visual multi +" let g:VM_leader="" +let g:VM_maps = {} +let g:VM_maps["Exit"] = '' +let g:VM_maps['Find Under'] = '' +let g:VM_maps['Find Subword Under'] = '' +let g:VM_mouse_mappings = 1 + +let g:markdown_fenced_languages = ['html', 'python', 'bash=sh'] + +" Undo +if has("persistent_undo") + let target_path = expand($HOME . '/.vim/undodir') + + " create the directory and any parent directories + " if the location does not exist. + if !isdirectory(target_path) + call mkdir(target_path, "p", 0700) + endif + + let &undodir=target_path + set undofile +endif + +let &backupdir = expand($HOME . '/.vim/backup_files/') +let &directory = expand($HOME . '/.vim/swap_files/') + +" Keybindings +nnoremap nohlsearch +nmap +nmap fs w +" if FugitiveHead() != '' +" nnoremap sf GFiles --cached --others --exclude-standard +" else +" nnoremap sf Files +" endif +nnoremap sf FugitiveHead() != '' ? 'GFiles --cached --others --exclude-standard' : 'Files' +nnoremap ff Files +nnoremap sg Rg +nnoremap so History +nnoremap Buffers +nnoremap bd bd +nnoremap ws split +nnoremap wv vsplit +nnoremap wj j +nnoremap wk k +nnoremap wh h +nnoremap wl l +nnoremap wq q +nnoremap fm Ex +nnoremap n tabnew +nnoremap l tabnext +nnoremap h tabprevious +nnoremap d tabclose +nnoremap 1 tabfirst +nnoremap 0 tablast +nnoremap mx !chmod +x % +nnoremap ss source % +nnoremap UndotreeToggle +nnoremap ut UndotreeToggle +xmap gc Commentary +nmap gc Commentary +omap gc Commentary +nmap gcc CommentaryLine +nmap gcu CommentaryCommentary +nnoremap ca LspCodeAction +nnoremap D LspGotoTypeDef +nnoremap rn LspRename +nnoremap gd LspGotoDefinition +nnoremap gD LspGotoDeclaration +nnoremap K LspHover +nnoremap ds LspDocumentSymbol +nnoremap ds LspDocumentSymbol +nnoremap ps LspSymbolSearch +nnoremap f LspFormat +nnoremap gg FloatermNew --height=0.7 --width=0.8 lazygit +nnoremap tt FloatermToggle +" imap