Skip to content

Commit

Permalink
Update init.vim
Browse files Browse the repository at this point in the history
  • Loading branch information
David7ce authored Oct 21, 2024
1 parent c7ce035 commit 4f52720
Showing 1 changed file with 78 additions and 65 deletions.
143 changes: 78 additions & 65 deletions .config/nvim/init.vim
Original file line number Diff line number Diff line change
@@ -1,77 +1,90 @@
set nocompatible " disable compatibility to old-time vi
set showmatch " show matching
set ignorecase " case insensitive
set mouse=v " middle-click paste with
set hlsearch " highlight search
set incsearch " incremental search
set tabstop=4 " number of columns occupied by a tab
set softtabstop=4 " see multiple spaces as tabstops so <BS> does the right thing
set expandtab " converts tabs to white space
set shiftwidth=4 " width for autoindents
set autoindent " indent a new line the same amount as the line just typed
set number " add line numbers
set wildmode=longest,list " get bash-like tab completions
set cc=80 " set an 80 column border for good coding style
filetype plugin indent on "allow auto-indenting depending on file type
syntax on " syntax highlighting
set mouse=a " enable mouse click
set clipboard=unnamedplus " using system clipboard
filetype plugin on
set cursorline " highlight current cursorline
set ttyfast " Speed up scrolling in Vim
" set spell " enable spell check (may need to download language package)
" set noswapfile " disable creating swap file
" set backupdir=~/.cache/vim " Directory to store backup files.
" General Settings
set nocompatible " Disable compatibility to old-time vi
set showmatch " Show matching brackets
set ignorecase " Case insensitive searching
set mouse=a " Enable mouse support
set clipboard=unnamedplus " Use system clipboard
set number " Show line numbers
set relativenumber " Show relative line numbers
set cursorline " Highlight current line
set ttyfast " Speed up scrolling in Vim
set lazyredraw " Don't redraw while executing macros

call plug#begin(“~/.vim/plugged”)
Plugin Section
Plug 'dracula/vim'
Plug 'ryanoasis/vim-devicons'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'scrooloose/nerdtree'
Plug 'preservim/nerdcommenter'
Plug 'mhinz/vim-startify'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()
" Search Settings
set hlsearch " Highlight search results
set incsearch " Incremental search

" Indentation Settings
set tabstop=4 " Number of columns occupied by a tab
set softtabstop=4 " See multiple spaces as tabstops
set expandtab " Converts tabs to white space
set shiftwidth=4 " Width for autoindents
set autoindent " Indent a new line the same amount as the line just typed

" Appearance
set wildmode=longest,list " Get bash-like tab completions
set cc=80 " Set an 80 column border for good coding style
set splitright " Open new splits to the right
set splitbelow " Open new splits below

" Syntax and Filetype
filetype plugin indent on " Enable filetype-specific plugins and indentation
syntax on " Enable syntax highlighting

color schemes
if (has(“termguicolors”))
set termguicolors
endif
syntax enable
colorscheme evening
colorscheme dracula" open new split panes to right and below
set splitright
set splitbelow
" Plugin Management
call plug#begin('~/.vim/plugged')
Plug 'dracula/vim'
Plug 'ryanoasis/vim-devicons'
Plug 'SirVer/ultisnips'
Plug 'honza/vim-snippets'
Plug 'scrooloose/nerdtree'
Plug 'preservim/nerdcommenter'
Plug 'mhinz/vim-startify'
Plug 'neoclide/coc.nvim', {'branch': 'release'}
call plug#end()

" Color Schemes
if (has('termguicolors'))
set termguicolors
endif
colorscheme dracula

" move line or visually selected block - alt+j/k
" Mappings
" Move lines or visually selected blocks
inoremap <A-j> <Esc>:m .+1<CR>==gi
inoremap <A-k> <Esc>:m .-2<CR>==gi
vnoremap <A-j> :m '>+1<CR>gv=gv
vnoremap <A-k> :m '<-2<CR>gv=gv" move split panes to left/bottom/top/right
nnoremap <A-h> <C-W>H
nnoremap <A-j> <C-W>J
nnoremap <A-k> <C-W>K
nnoremap <A-l> <C-W>L" move between panes to left/bottom/top/right
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
vnoremap <A-k> :m '<-2<CR>gv=gv
" Move split panes
nnoremap <A-h> <C-W>H
nnoremap <A-j> <C-W>J
nnoremap <A-k> <C-W>K
nnoremap <A-l> <C-W>L
" Move between panes
nnoremap <C-h> <C-w>h
nnoremap <C-j> <C-w>j
nnoremap <C-k> <C-w>k
nnoremap <C-l> <C-w>l
" Custom mappings
inoremap ii <Esc>
inoremap jk <Esc>
inoremap kj <Esc>
vnoremap jk <Esc>
vnoremap kj <Esc>
" Open file in a vertical split
nnoremap gf :vert winc f<CR>
" Copy filepath to clipboard
nnoremap <silent> yf :let @+=expand('%:p')<CR>
" Press i to enter insert mode, and ii to exit insert mode.
:inoremap ii <Esc>
:inoremap jk <Esc>
:inoremap kj <Esc>
:vnoremap jk <Esc>
:vnoremap kj <Esc>
" Copy pwd to clipboard
nnoremap <silent> yd :let @+=expand('%:p:h')<CR>
" open file in a text by placing text and gf
nnoremap gf :vert winc f<cr>" copies filepath to clipboard by pressing yf
:nnoremap <silent> yf :let @+=expand('%:p')<CR>
" copies pwd to clipboard: command yd
:nnoremap <silent> yd :let @+=expand('%:p:h')<CR>" Vim jump to the last position when reopening a file
" Jump to the last position when reopening a file
if has("autocmd")
au BufReadPost * if line("'\"") > 0 && line("'\"") <= line("$")
\| exe "normal! g'\"" | endif
Expand Down

0 comments on commit 4f52720

Please sign in to comment.