migrate vim config
This commit is contained in:
parent
4db59f48da
commit
52fa46eb43
5 changed files with 189 additions and 27 deletions
|
|
@ -16,7 +16,7 @@
|
|||
./ripgrep.nix
|
||||
./shell.nix
|
||||
./tmux
|
||||
./vim.nix
|
||||
./vim
|
||||
./w3m.nix
|
||||
./yazi.nix
|
||||
./zoxide.nix
|
||||
|
|
|
|||
|
|
@ -94,10 +94,10 @@ vim.keymap.set("t", "<Esc><Esc>", "<C-\\><C-n>", { desc = "Exit terminal mode" }
|
|||
-- Use CTRL+<hjkl> to switch between windows
|
||||
--
|
||||
-- See `:help wincmd` for a list of all window commands
|
||||
vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
|
||||
vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
|
||||
vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
|
||||
vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
|
||||
-- vim.keymap.set("n", "<C-h>", "<C-w><C-h>", { desc = "Move focus to the left window" })
|
||||
-- vim.keymap.set("n", "<C-l>", "<C-w><C-l>", { desc = "Move focus to the right window" })
|
||||
-- vim.keymap.set("n", "<C-j>", "<C-w><C-j>", { desc = "Move focus to the lower window" })
|
||||
-- vim.keymap.set("n", "<C-k>", "<C-w><C-k>", { desc = "Move focus to the upper window" })
|
||||
|
||||
-- [[ Basic Autocommands ]]
|
||||
-- See `:help lua-guide-autocommands`
|
||||
|
|
@ -186,7 +186,7 @@ require("lazy").setup({
|
|||
{ "<leader>d", group = "[D]ocument" },
|
||||
{ "<leader>r", group = "[R]ename" },
|
||||
{ "<leader>s", group = "[S]earch" },
|
||||
{ "<leader>w", group = "[W]orkspace" },
|
||||
{ "<leader>w", group = "[W]orkspace|[W]indow" },
|
||||
{ "<leader>t", group = "[T]oggle" },
|
||||
{ "<leader>h", group = "Git [H]unk", mode = { "n", "v" } },
|
||||
},
|
||||
|
|
@ -779,8 +779,8 @@ require("lazy").setup({
|
|||
keys = {
|
||||
-- stylua: ignore start
|
||||
{ "-", "<CMD>Oil<CR>", desc = "Open parent directory" },
|
||||
{ "<leader>fm", "<cmd>Oil<cr>", desc = "[F]ile [M]anager" },
|
||||
{ "<leader>fM", "<cmd>Oil --float<cr>", desc = "[F]ile [M]anager" },
|
||||
{ "<leader>fm", "<CMD>Oil<CR>", desc = "[F]ile [M]anager" },
|
||||
{ "<leader>fM", "<CMD>Oil --float<CR>", desc = "[F]ile [M]anager" },
|
||||
-- stylua: ignore end
|
||||
},
|
||||
init = function()
|
||||
|
|
@ -796,7 +796,13 @@ require("lazy").setup({
|
|||
"TmuxNavigateRight",
|
||||
},
|
||||
-- stylua: ignore start
|
||||
keys = { "<C-h>", "<C-j>", "<C-k>", "<C-l>" },
|
||||
keys = {
|
||||
"<C-h>", "<C-j>", "<C-k>", "<C-l>",
|
||||
{ "<leader>wh", "<cmd>TmuxNavigateLeft<CR>", desc = "[W]indow Left" },
|
||||
{ "<leader>wl", "<cmd>TmuxNavigateRight<CR>", desc = "[W]indow Right" },
|
||||
{ "<leader>wk", "<cmd>TmuxNavigateUp<CR>", desc = "[W]indow Up" },
|
||||
{ "<leader>wj", "<cmd>TmuxNavigateDown<CR>", 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", "<C-[>", "<cmd>nohlsearch<CR>")
|
||||
vim.keymap.set("t", "<C-[><C-[>", "<C-\\><C-n>", { desc = "Exit terminal mode" })
|
||||
vim.keymap.set("n", "<leader>fs", "<cmd>w<cr><Esc>", { desc = "Save file" })
|
||||
vim.keymap.set("n", "<leader>ws", "<cmd>split<cr>", { desc = "[W]indow Horizontal [S]plit" }) -- split horizontal
|
||||
vim.keymap.set("n", "<leader>wv", "<cmd>vsplit<cr>", { desc = "[W]indow [V]ertical Split" }) -- split vertical
|
||||
vim.keymap.set("n", "<leader>wq", "<C-w>q", { desc = "[W]indow [Q]uit" }) -- quit
|
||||
vim.keymap.set("n", "<leader>ws", "<cmd>split<cr>", { desc = "[W]indow Horizontal [S]plit" })
|
||||
vim.keymap.set("n", "<leader>wv", "<cmd>vsplit<cr>", { desc = "[W]indow [V]ertical Split" })
|
||||
vim.keymap.set("n", "<leader>wq", "<C-w>q", { desc = "[W]indow [Q]uit" })
|
||||
vim.keymap.set("n", "<leader>x", "<cmd>!chmod +x %<CR>", { desc = "Chmod File E[x]ecutable", silent = true })
|
||||
vim.keymap.set("n", "<leader>lz", "<cmd>Lazy<CR>", { desc = "[L]azy", silent = true })
|
||||
vim.keymap.set("n", "<leader>lp", "<cmd>Lazy profile<CR>", { desc = "[L]azy [P]rofile", silent = true })
|
||||
|
|
|
|||
|
|
@ -1,15 +0,0 @@
|
|||
{ pkgs, ... }:
|
||||
{
|
||||
home.packages = with pkgs; [
|
||||
vim-full
|
||||
];
|
||||
|
||||
custom.persist = {
|
||||
home.directories = [
|
||||
".vim"
|
||||
];
|
||||
home.files = [
|
||||
".vimrc"
|
||||
];
|
||||
};
|
||||
}
|
||||
22
src/home/shell/vim/default.nix
Normal file
22
src/home/shell/vim/default.nix
Normal file
|
|
@ -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"
|
||||
# ];
|
||||
};
|
||||
}
|
||||
148
src/home/shell/vim/vimrc
Normal file
148
src/home/shell/vim/vimrc
Normal file
|
|
@ -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="<C-d>"
|
||||
let g:VM_maps = {}
|
||||
let g:VM_maps["Exit"] = '<C-[>'
|
||||
let g:VM_maps['Find Under'] = '<C-d>'
|
||||
let g:VM_maps['Find Subword Under'] = '<C-d>'
|
||||
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 <silent> <Esc> <CMD>nohlsearch<CR>
|
||||
nmap <silent> <C-[> <Esc>
|
||||
nmap <silent> <leader>fs <CMD>w<CR><Esc>
|
||||
" if <expr>FugitiveHead() != ''
|
||||
" nnoremap <silent> <leader>sf <CMD>GFiles --cached --others --exclude-standard<CR>
|
||||
" else
|
||||
" nnoremap <silent> <leader>sf <CMD>Files<CR>
|
||||
" endif
|
||||
nnoremap <silent><expr> <leader>sf FugitiveHead() != '' ? '<CMD>GFiles --cached --others --exclude-standard<CR>' : '<CMD>Files<CR>'
|
||||
nnoremap <silent> <leader>ff <CMD>Files<CR>
|
||||
nnoremap <silent> <leader>sg <CMD>Rg<CR>
|
||||
nnoremap <silent> <leader>so <CMD>History<CR>
|
||||
nnoremap <silent> <leader><leader> <CMD>Buffers<CR>
|
||||
nnoremap <silent> <leader>bd <CMD>bd<CR>
|
||||
nnoremap <silent> <leader>ws <CMD>split<CR>
|
||||
nnoremap <silent> <leader>wv <CMD>vsplit<CR>
|
||||
nnoremap <silent> <leader>wj <C-w>j
|
||||
nnoremap <silent> <leader>wk <C-w>k
|
||||
nnoremap <silent> <leader>wh <C-w>h
|
||||
nnoremap <silent> <leader>wl <C-w>l
|
||||
nnoremap <silent> <leader>wq <C-w>q
|
||||
nnoremap <silent> <leader>fm <CMD>Ex<CR>
|
||||
nnoremap <silent> <leader><tab>n <CMD>tabnew<CR>
|
||||
nnoremap <silent> <leader><tab>l <CMD>tabnext<CR>
|
||||
nnoremap <silent> <leader><tab>h <CMD>tabprevious<CR>
|
||||
nnoremap <silent> <leader><tab>d <CMD>tabclose<CR>
|
||||
nnoremap <silent> <leader><tab>1 <CMD>tabfirst<CR>
|
||||
nnoremap <silent> <leader><tab>0 <CMD>tablast<CR>
|
||||
nnoremap <silent> <leader>mx <CMD>!chmod +x %<CR>
|
||||
nnoremap <silent> <leader>ss <CMD>source %<CR>
|
||||
nnoremap <silent> <F5> <CMD>UndotreeToggle<CR>
|
||||
nnoremap <silent> <leader>ut <CMD>UndotreeToggle<CR>
|
||||
xmap gc <Plug>Commentary
|
||||
nmap gc <Plug>Commentary
|
||||
omap gc <Plug>Commentary
|
||||
nmap gcc <Plug>CommentaryLine
|
||||
nmap gcu <Plug>Commentary<Plug>Commentary
|
||||
nnoremap <silent> <leader>ca <CMD>LspCodeAction<CR>
|
||||
nnoremap <silent> <leader>D <CMD>LspGotoTypeDef<CR>
|
||||
nnoremap <silent> <leader>rn <CMD>LspRename<CR>
|
||||
nnoremap <silent> gd <CMD>LspGotoDefinition<CR>
|
||||
nnoremap <silent> gD <CMD>LspGotoDeclaration<CR>
|
||||
nnoremap <silent> K <CMD>LspHover<CR>
|
||||
nnoremap <silent> <leader>ds <CMD>LspDocumentSymbol<CR>
|
||||
nnoremap <silent> <leader>ds <CMD>LspDocumentSymbol<CR>
|
||||
nnoremap <silent> <leader>ps <CMD>LspSymbolSearch<CR>
|
||||
nnoremap <silent> <leader>f <CMD>LspFormat<CR>
|
||||
nnoremap <silent> <leader>gg <CMD>FloatermNew --height=0.7 --width=0.8 lazygit<CR>
|
||||
nnoremap <silent> <leader>tt <CMD>FloatermToggle<CR>
|
||||
" imap <silent><script><expr> <C-m> copilot#Accept("\<CR>")
|
||||
|
||||
" Copilot
|
||||
|
||||
" let g:copilot_no_tab_map = v:true
|
||||
|
||||
" LSP
|
||||
|
||||
let lspopts = #{autoHighlightDiags: v:false, highlightDiagInline: v:false}
|
||||
" let lspopts = #{}
|
||||
autocmd User LspSetup call LspOptionsSet(lspopts)
|
||||
|
||||
let lspservers = []
|
||||
if executable("clangd")
|
||||
call add (lspservers, #{
|
||||
\ name: 'clang',
|
||||
\ filetype: ['c', 'cpp'],
|
||||
\ path: exepath('clangd'),
|
||||
\ args: ['--background-index']
|
||||
\ })
|
||||
endif
|
||||
if executable("pylsp")
|
||||
call add (lspservers, #{
|
||||
\ name: 'pylsp',
|
||||
\ filetype: 'python',
|
||||
\ path: exepath('pylsp'),
|
||||
\ args: []
|
||||
\ })
|
||||
endif
|
||||
autocmd User LspSetup call LspAddServer(lspservers)
|
||||
Loading…
Reference in a new issue