Created
June 6, 2024 09:14
-
-
Save RGGH/5da860b2e887a3c708883180db26bf47 to your computer and use it in GitHub Desktop.
init.vim - June 2024
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
call plug#begin(stdpath("data") . '/plugged') | |
Plug 'catppuccin/nvim', { 'as': 'catppuccin' } | |
Plug 'styled-components/vim-styled-components' | |
Plug 'brooth/far.vim' | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'folke/trouble.nvim' | |
Plug 'preservim/nerdcommenter' | |
Plug 'simrat39/rust-tools.nvim' | |
Plug 'luochen1990/rainbow' | |
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} | |
Plug 'nvim-treesitter/completion-treesitter' | |
Plug 'preservim/nerdtree' | |
Plug 'matze/vim-move' | |
Plug 'junegunn/rainbow_parentheses.vim' | |
Plug 'nvim-lua/plenary.nvim' | |
Plug 'nvim-telescope/telescope.nvim', { 'tag': '0.1.2' } | |
Plug 'ryanoasis/vim-devicons' | |
Plug 'DaikyXendo/nvim-material-icon' | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
call plug#end() | |
" Theme | |
set termguicolors | |
colorscheme catppuccin | |
let g:airline_theme = 'bubblegum' | |
syntax enable | |
let g:rainbow_active = 1 | |
let g:airline_powerline_fonts = 1 | |
let g:one_allow_italics = 1 | |
" Set the custom text to the far right corner (section z) | |
" Remember folds | |
set foldcolumn=1 | |
set sessionoptions+=folds | |
set relativenumber | |
noremap <S-\> <S-^> | |
vnoremap kj <esc> | |
" Trouble - squares | |
nnoremap <leader>xx <cmd>TroubleToggle<cr> | |
let g:trouble_signs_icon = {'Error': '', 'Warning': '', 'Information': '', 'Hint': ''} | |
" nav buffers | |
nnoremap <PageUp> :bprevious<CR> | |
nnoremap <PageDown> :bnext<CR> | |
" display open buffers | |
set statusline+=%n\ %f\ %h%m%r%y%=%w\ %l/%L\ %p%%\ %c | |
" noh | |
nnoremap <Leader>n :noh<CR> | |
" file explorer | |
nnoremap <leader>n :NERDTreeFocus<CR> | |
nnoremap <C-n> :NERDTree<CR> | |
nnoremap <C-t> :NERDTreeToggle<CR> | |
nnoremap <C-f> :NERDTreeFind<CR> | |
" esc in command mode | |
cnoremap kj <C-C> | |
inoremap kj <C-C> | |
" Map Ctrl + S to save | |
nnoremap <C-s> :w<CR> | |
inoremap <C-s> <Esc>:w<CR> | |
" Map F3 to run :!cargo r | |
nnoremap <C-b> :vsp \| :term cargo run --quiet<CR> | |
" Map F2 to open the file explorer | |
nnoremap <F2> :Ve<CR> | |
" Remap 'cargo fmt' in a terminal window | |
nnoremap <leader>cf :!cargo fmt<CR><CR> | |
" Map <S-`> to insert text at the top of the file | |
nnoremap <C-w> <Esc>ggO#![allow(unused)]<Esc> | |
" Remap Shift+Tab in insert mode to insert println!("{:?}", x); and position the cursor after x | |
inoremap <S-Tab> println!("{:?}", x);<Left> | |
nnoremap <S-Tab> println!("{:?}", x);<Left> | |
" Search and replacer | |
nnoremap <Leader>r :%s///g<Left><Left> | |
" toggle inlayHints | |
nnoremap <Leader>ti :CocCommand document.toggleInlayHint<CR> | |
" nav between splits using ctrl | |
nnoremap <C-J> <C-W><C-J> | |
nnoremap <C-K> <C-W><C-K> | |
nnoremap <C-L> <C-W><C-L> | |
nnoremap <C-H> <C-W><C-H> | |
" Find files using Telescope command-line sugar. | |
nnoremap <leader>ff <cmd>Telescope find_files<cr> | |
nnoremap <leader>fg <cmd>Telescope live_grep<cr> | |
nnoremap <leader>fb <cmd>Telescope buffers<cr> | |
nnoremap <leader>fh <cmd>Telescope help_tags<cr> | |
" Make <CR> to accept selected completion item or notify coc.nvim to format | |
" <C-g>u breaks current undo, please make your own choice. | |
inoremap <silent><expr> <CR> coc#pum#visible() ? coc#pum#confirm() | |
\: "\<C-g>u\<CR>\<c-r>=coc#on_enter()\<CR>" | |
filetype plugin on |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment