dot folder
commit
f44a6aecf7
@ -0,0 +1,329 @@
|
|||||||
|
" Set encoding
|
||||||
|
set encoding=UTF-8
|
||||||
|
|
||||||
|
" Set keymodel
|
||||||
|
set keymodel=startsel,stopsel
|
||||||
|
set backspace=indent,eol,start
|
||||||
|
set grepprg=rg\ --vimgrep\ --smart-case\ --follow
|
||||||
|
set clipboard+=unnamedplus
|
||||||
|
|
||||||
|
" Set colorscheme
|
||||||
|
colorscheme codedark
|
||||||
|
|
||||||
|
" Disable compatibility with vi which can cause unexpected issues.
|
||||||
|
set nocompatible
|
||||||
|
|
||||||
|
" Enable type file detection. Vim will be able to try to detect the type of file in use.
|
||||||
|
filetype on
|
||||||
|
|
||||||
|
" Enable plugins and load plugin for the detected file type.
|
||||||
|
filetype plugin on
|
||||||
|
|
||||||
|
" Load an indent file for the detected file type.
|
||||||
|
filetype indent on
|
||||||
|
|
||||||
|
" Turn syntax highlighting on
|
||||||
|
syntax on
|
||||||
|
|
||||||
|
" Add numbers to each line on the left-hand side
|
||||||
|
set number
|
||||||
|
set relativenumber
|
||||||
|
|
||||||
|
" Hihglight cursor line
|
||||||
|
set cursorline
|
||||||
|
|
||||||
|
" Set mouse scroll
|
||||||
|
set mouse=a
|
||||||
|
|
||||||
|
" Set shift width to 4 spaces
|
||||||
|
set shiftwidth=4
|
||||||
|
|
||||||
|
" Set tab width to 4 columns
|
||||||
|
set tabstop=4
|
||||||
|
|
||||||
|
" Use space instead of tab
|
||||||
|
set expandtab
|
||||||
|
|
||||||
|
" Do not wrap lines.
|
||||||
|
set nowrap
|
||||||
|
|
||||||
|
" Do not let cursor scroll below or above N number of lines when scrolling
|
||||||
|
set scrolloff=10
|
||||||
|
|
||||||
|
" While searching through a file incrementally highlight matching characters
|
||||||
|
set incsearch
|
||||||
|
|
||||||
|
" Show partial command you type in the last line of screen
|
||||||
|
set showcmd
|
||||||
|
|
||||||
|
" Show the mode you are in last line
|
||||||
|
set showmode
|
||||||
|
|
||||||
|
" Show matching words during search
|
||||||
|
set showmatch
|
||||||
|
|
||||||
|
" Use highlighting when doing a search
|
||||||
|
set hlsearch
|
||||||
|
|
||||||
|
" Set the commands to save in history, default is 20
|
||||||
|
set history=1000
|
||||||
|
|
||||||
|
" Enable auto completion menu after pressing TAB
|
||||||
|
set wildmenu
|
||||||
|
|
||||||
|
" Make wildmenu behave like Bash completion
|
||||||
|
set wildmode=list:longest
|
||||||
|
|
||||||
|
" Wildmenu will ignore files with these extensions, bc we don't want to edit
|
||||||
|
" them with vim
|
||||||
|
set wildignore=*.docx,*.jpg,*.png,*.gif,*.pdf,*.pyc,*.exe,*.flv,*.img,*.xlsx
|
||||||
|
|
||||||
|
" PLUGINS ----------------------------------------------------------------- {{{
|
||||||
|
" Plugin code goes here
|
||||||
|
|
||||||
|
let data_dir = has('nvim') ? stdpath('data') . '/site' : '~/.vim'
|
||||||
|
if empty(glob(data_dir . '/autoload/plug.vim'))
|
||||||
|
silent execute '!curl -fLo '.data_dir.'/autoload/plug.vim --create-dirs https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim'
|
||||||
|
autocmd VimEnter * PlugInstall --sync | source $MYVIMRC
|
||||||
|
endif
|
||||||
|
|
||||||
|
call plug#begin('~/.vim/plugged')
|
||||||
|
|
||||||
|
Plug 'tomasiser/vim-code-dark'
|
||||||
|
|
||||||
|
Plug 'dense-analysis/ale'
|
||||||
|
|
||||||
|
Plug 'preservim/nerdtree'
|
||||||
|
Plug 'mbbill/undotree'
|
||||||
|
|
||||||
|
Plug 'ryanoasis/vim-devicons'
|
||||||
|
|
||||||
|
Plug 'junegunn/goyo.vim'
|
||||||
|
|
||||||
|
Plug 'tpope/vim-fugitive'
|
||||||
|
Plug 'airblade/vim-gitgutter'
|
||||||
|
Plug 'ap/vim-css-color'
|
||||||
|
|
||||||
|
Plug 'tpope/vim-commentary'
|
||||||
|
Plug 'tpope/vim-unimpaired'
|
||||||
|
Plug 'tpope/vim-surround'
|
||||||
|
|
||||||
|
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } }
|
||||||
|
Plug 'junegunn/fzf.vim'
|
||||||
|
|
||||||
|
Plug 'mattn/emmet-vim'
|
||||||
|
Plug 'manzeloth/live-server'
|
||||||
|
|
||||||
|
Plug 'pangloss/vim-javascript'
|
||||||
|
Plug 'vim-python/python-syntax'
|
||||||
|
|
||||||
|
Plug 'vim-airline/vim-airline'
|
||||||
|
Plug 'vim-airline/vim-airline-themes'
|
||||||
|
|
||||||
|
if has('nvim')
|
||||||
|
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'}
|
||||||
|
Plug 'nvim-treesitter/nvim-treesitter-context'
|
||||||
|
endif
|
||||||
|
|
||||||
|
" if has('nvim')
|
||||||
|
" Plug 'Shougo/deoplete.nvim', { 'do': ':UpdateRemotePlugins' }
|
||||||
|
" else
|
||||||
|
" Plug 'Shougo/deoplete.nvim'
|
||||||
|
" Plug 'roxma/nvim-yarp'
|
||||||
|
" Plug 'roxma/vim-hug-neovim-rpc'
|
||||||
|
" endif
|
||||||
|
" let g:deoplete#enable_at_startup = 1
|
||||||
|
|
||||||
|
|
||||||
|
call plug#end()
|
||||||
|
|
||||||
|
|
||||||
|
let g:ale_linters = {
|
||||||
|
\ 'python': ['flake8'],
|
||||||
|
\ }
|
||||||
|
|
||||||
|
let g:ale_fixers = {
|
||||||
|
\ '*': ['remove_trailing_lines', 'trim_whitespace'],
|
||||||
|
\ 'javascript': ['prettier_eslint'],
|
||||||
|
\ 'css': ['prettier'],
|
||||||
|
\ 'python': ['black', 'isort']
|
||||||
|
\}
|
||||||
|
|
||||||
|
let g:ale_fix_on_save = 1
|
||||||
|
|
||||||
|
let g:ale_sign_error = '●'
|
||||||
|
let g:ale_sign_warning = '.'
|
||||||
|
|
||||||
|
|
||||||
|
" call deoplete#custom#option('sources', {
|
||||||
|
" \ '_': ['ale'],
|
||||||
|
" \ })
|
||||||
|
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" MAPPINGS ----------------------------------------------------------------- {{{
|
||||||
|
" Mappings code goes here
|
||||||
|
|
||||||
|
" Set backslash as leader key
|
||||||
|
let mapleader = '\'
|
||||||
|
|
||||||
|
" Press \\ to jump back to last cursor position
|
||||||
|
nnoremap <leader>\ ``
|
||||||
|
|
||||||
|
" Type jj to exit insert mode quickly
|
||||||
|
inoremap jj <Esc>
|
||||||
|
|
||||||
|
" Press the space bar to type the : char in command mode
|
||||||
|
nnoremap <space> :
|
||||||
|
|
||||||
|
" Press the letter o will open a new line below the current one
|
||||||
|
" Exit insert mode after creating a new line above or below current line
|
||||||
|
nnoremap o o<esc>
|
||||||
|
nnoremap O O<esc>
|
||||||
|
|
||||||
|
" Center the cursor vertically when moving to next word during search
|
||||||
|
nnoremap n nzz
|
||||||
|
nnoremap N Nzz
|
||||||
|
|
||||||
|
" Yank from cursor to the end of line
|
||||||
|
nnoremap Y y$
|
||||||
|
|
||||||
|
" Map F5 key to run a Python script
|
||||||
|
" F5 is mapped with a chain of commands
|
||||||
|
" :w saves file
|
||||||
|
" <CR> is like pressing enter
|
||||||
|
" !clear runs the external clear screen command
|
||||||
|
" !python3 % executes current file with python
|
||||||
|
nnoremap <f5> :w <CR>:!clear <CR>:!python3 % <CR>
|
||||||
|
|
||||||
|
nnoremap <f12> :bel term <CR><c-w>N <CR>:res 5 <CR>
|
||||||
|
|
||||||
|
" You can split window in Vim by typing :split or :vsplit
|
||||||
|
" Navigate the split view easier by pressing CTRL+j CTRL+k CTRL+h CTRL+l
|
||||||
|
nnoremap <c-j> <c-w>j
|
||||||
|
nnoremap <c-k> <c-w>k
|
||||||
|
nnoremap <c-h> <c-w>h
|
||||||
|
nnoremap <c-l> <c-w>l
|
||||||
|
|
||||||
|
" Resize split windows using arrow keys by pressing:
|
||||||
|
" CTRL+UP CTRL+DOWN CTRL+LEFT CTRL+RIGHT
|
||||||
|
nnoremap <c-up> <c-w>+
|
||||||
|
nnoremap <c-down> <c-w>-
|
||||||
|
nnoremap <c-left> <c-w>>
|
||||||
|
nnoremap <c-right> <c-w><
|
||||||
|
|
||||||
|
" Ctrl c ctrl v ecc
|
||||||
|
vmap <C-c> y<Esc>i
|
||||||
|
vmap <C-x> d<Esc>i
|
||||||
|
map <C-v> Pi
|
||||||
|
imap <C-v> <Esc>Pi
|
||||||
|
imap <C-z> <Esc>ui
|
||||||
|
|
||||||
|
" Word wrap navigation
|
||||||
|
nnoremap <expr> j v:count ? 'j' : 'gj'
|
||||||
|
nnoremap <expr> k v:count ? 'k' : 'gk'
|
||||||
|
|
||||||
|
" Overwrite arrow navigation
|
||||||
|
|
||||||
|
" Move text left and right
|
||||||
|
nmap <left> <<
|
||||||
|
nmap <right> >>
|
||||||
|
vmap <left> <gv
|
||||||
|
vmap <right> >gv
|
||||||
|
|
||||||
|
" Move text up and down
|
||||||
|
nmap <up> [e
|
||||||
|
nmap <down> ]e
|
||||||
|
vmap <up> [egv
|
||||||
|
vmap <down> ]egv
|
||||||
|
|
||||||
|
" fzf specific mappings
|
||||||
|
nnoremap <silent> <Leader>b :Buffer<CR>
|
||||||
|
nnoremap <silent> <C-f> :Files<CR>
|
||||||
|
nnoremap <silent> <Leader>f :Rg<CR>
|
||||||
|
nnoremap <silent> <Leader>/ :BLines<CR>
|
||||||
|
nnoremap <silent> <Leader>' :Marks<CR>
|
||||||
|
nnoremap <silent> <Leader>g :Commits<CR>
|
||||||
|
nnoremap <silent> <Leader>H :Helptags<CR>
|
||||||
|
nnoremap <silent> <Leader>hh :History<CR>
|
||||||
|
nnoremap <silent> <Leader>h: :History:<CR>
|
||||||
|
nnoremap <silent> <Leader>h/ :History/<CR>
|
||||||
|
|
||||||
|
|
||||||
|
" Terminal specific mappings
|
||||||
|
|
||||||
|
" vim-powered terminal in new window
|
||||||
|
map <Leader>t :term ++close<cr>
|
||||||
|
tmap <Leader>t <c-w>:term ++close<cr>
|
||||||
|
|
||||||
|
" vim-powered terminal in new tab
|
||||||
|
map <Leader>T :tab term ++close<cr>
|
||||||
|
tmap <Leader>T <c-w>:tab term ++close<cr>
|
||||||
|
|
||||||
|
" Goyo specific mappings
|
||||||
|
nnoremap <leader>z :Goyo<cr>
|
||||||
|
|
||||||
|
|
||||||
|
" NERDTree specific mappings
|
||||||
|
" Map the F3 key to toggle NERDTree open and close
|
||||||
|
nnoremap <F3> :NERDTreeToggle<cr>
|
||||||
|
|
||||||
|
" Have nerdtree ignore certain files and directories
|
||||||
|
let NERDTreeIgnore=['\.git$', '\.mp4$', '\.ogg$', '\.iso$', '\.pdf$', '\.pyc$', '\.odt$', '\.db$']
|
||||||
|
|
||||||
|
nnoremap <F4> :UndotreeToggle<CR>
|
||||||
|
|
||||||
|
|
||||||
|
" ALE specific mappings
|
||||||
|
|
||||||
|
nmap <silent> <C-e> <Plug>(ale_next_wrap)
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" VIMSCRIPT ----------------------------------------------------------------- {{{
|
||||||
|
" This will enable code folding
|
||||||
|
" Use the marker method of folding
|
||||||
|
augroup filetype_vim
|
||||||
|
autocmd!
|
||||||
|
autocmd FileType vim setlocal foldmethod=marker
|
||||||
|
augroup END
|
||||||
|
|
||||||
|
" If the current file type is MD, set line wrap
|
||||||
|
autocmd FileType markdown setlocal wrap linebreak nolist
|
||||||
|
|
||||||
|
set backup
|
||||||
|
if !isdirectory($HOME."/.vim/backup")
|
||||||
|
silent! execute "!mkdir ~/.vim/backup"
|
||||||
|
endif
|
||||||
|
set backupdir=~/.vim/backup
|
||||||
|
"not generate .swap
|
||||||
|
set noswapfile
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
" More Vimscripts code goes here
|
||||||
|
|
||||||
|
" }}}
|
||||||
|
|
||||||
|
" " STATUS LINE ----------------------------------------------------------------- {{{
|
||||||
|
" " Status bar code goes here
|
||||||
|
|
||||||
|
" set statusline=
|
||||||
|
|
||||||
|
" " Status line left side
|
||||||
|
" set statusline+=\ %F\ %M\ %Y\ %R
|
||||||
|
|
||||||
|
" " Use a divider to separate left side from right side
|
||||||
|
" set statusline+=%=
|
||||||
|
|
||||||
|
|
||||||
|
" " Status line right side
|
||||||
|
" set statusline+=\ ascii:\ %b\ hex:\ 0x%B\ row:\ %l\ col:\ %c\ percent:\ %p%%
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
" " Show status on second to last line
|
||||||
|
" set laststatus=2
|
||||||
|
|
||||||
|
" " }}}
|
Loading…
Reference in New Issue