dotfiles/dot_config/nvim/init.vim

113 lines
4.6 KiB
VimL

" set leader key
let g:mapleader = "\<Space>"
" vim hardcodes background color erase even if the terminfo file does
" not contain bce (not to mention that libvte based terminals
" incorrectly contain bce in their terminfo files). This causes
" incorrect background rendering when using a color theme with a
" background color.
let &t_ut=''
syntax enable " Enables syntax highlighing
set hidden " Required to keep multiple buffers open
set nowrap " Display long lines as just one line
set encoding=utf-8 " The encoding displayed
set pumheight=10 " Makes popup menu smaller
set fileencoding=utf-8 " The encoding written to file
set ruler " Show the cursor position all the time
set cmdheight=2 " More space for displaying messages
set iskeyword+=- " treat dash separated words as a word text object"
"set mouse=a " Enable your mouse
set splitbelow " Horizontal splits will automatically be below
set splitright " Vertical splits will automatically be to the right
set t_Co=256 " Support 256 colors
set conceallevel=0 " So that I can see `` in markdown files
set tabstop=4 " Insert 4 spaces for a tab
set shiftwidth=4 " Change the number of space characters inserted for indentation
set smarttab " Makes tabbing smarter will realize you have 2 vs 4
set expandtab " Converts tabs to spaces
set smartindent " Makes indenting smart
set autoindent " Good auto indent
set laststatus=0 " Always display the status line
"set number " Line numbers
"set cursorline " Enable highlighting of the current line
set background=dark " tell vim what the background color looks like
set showtabline=4 " Always show tabs
"set noshowmode " We don't need to see things like -- INSERT -- anymore
set nobackup " This is recommended by coc
set nowritebackup " This is recommended by coc
set updatetime=300 " Faster completion
set timeoutlen=500 " By default timeoutlen is 1000 ms
set formatoptions-=cro " Stop newline continution of comments
"set clipboard=unnamedplus " Copy paste between vim and everything else
set autochdir " Your working directory will always be the same as your working directory
au! BufWritePost $MYVIMRC source % " auto source when writing to init.vim alternatively you can run :source $MYVIMRC
" You can't stop me
cmap w!! w !sudo tee %
"" Plugins
" Install neovim-plug-git from AUR
call plug#begin()
" A fuzzy file finder
Plug 'kien/ctrlp.vim'
" Comment/Uncomment tool
Plug 'scrooloose/nerdcommenter'
" Switch to the begining and the end of a block by pressing %
Plug 'tmhedberg/matchit'
" A Tree-like side bar for better navigation
Plug 'scrooloose/nerdtree'
" A cool status bar
Plug 'vim-airline/vim-airline'
" Airline themes
Plug 'vim-airline/vim-airline-themes'
" Better syntax-highlighting for filetypes in vim
Plug 'sheerun/vim-polyglot'
" Intellisense engine
Plug 'neoclide/coc.nvim', {'branch': 'release'}
" Git integration
Plug 'tpope/vim-fugitive'
" Auto-close braces and scopes
Plug 'jiangmiao/auto-pairs'
""Themes
" Everforest theme
Plug 'sainnhe/everforest'
" Nord
"Plug 'arcticicestudio/nord-vim'
call plug#end()
" Important!!
if has('termguicolors')
set termguicolors
endif
" Set contrast.
" This configuration option should be placed before `colorscheme everforest`.
" Available values: 'hard', 'medium'(default), 'soft'
let g:everforest_background = 'soft'
" For better performance
let g:everforest_better_performance = 1
colorscheme everforest
" plug-in autostart
"augroup nerdtree_open
" autocmd!
" autocmd VimEnter * NERDTree | wincmd p
"augroup END
" NERDTree Toggle
nmap <silent> <Leader>k :NERDTreeToggle<CR>
" CoC completion
inoremap <silent><expr> <TAB>
\ pumvisible() ? "\<C-n>" :
\ CheckBackspace() ? "\<TAB>" :
\ coc#refresh()
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
function! CheckBackspace() abort
let col = col('.') - 1
return !col || getline('.')[col - 1] =~# '\s'
endfunction