Last active
February 22, 2022 10:42
-
-
Save coreymcmahon/558643efa987d6c2982c5e9123285105 to your computer and use it in GitHub Desktop.
Neovim config
This file contains hidden or 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
let g:netrw_banner = 0 | |
" Sane defaults | |
syntax on " syntax highlighting | |
set noerrorbells " no sound effects | |
set tabstop=4 softtabstop=4 " 4 spaces | |
set shiftwidth=4 " tab adds 4 spaces | |
set expandtab " use spaces instead of tabs | |
set smartindent " try to indent | |
set number relativenumber " nice line numbers | |
set nowrap " no line wrapping | |
set smartcase " case sensitive searching | |
set noswapfile " do not create vim swap files | |
" Some servers have issues with backup files | |
set nobackup " | |
set nowritebackup | |
" Give more space for displaying messages. | |
set cmdheight=2 | |
" Cursor | |
set guicursor=a:blinkon100 | |
" Having longer updatetime (default is 4000 ms = 4 s) leads to noticeable | |
" delays and poor user experience. | |
set updatetime=300 | |
set undodir=~/.vim/undodir " | |
set undofile | |
set incsearch " show search results as you type | |
set hlsearch " highlight search results | |
" Look and feel | |
set colorcolumn=80 | |
highlight ColorColumn ctermbg=0 guibg=lightgrey | |
" Display extra whitespace | |
set list listchars=tab:»·,trail:·,nbsp:· | |
" Remaps for split navigation | |
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> | |
" Use more intuitive split positioning | |
set splitbelow | |
set splitright | |
" Netrw settings | |
let g:netrw_liststyle = 3 | |
set termguicolors | |
set runtimepath^=~/.vim runtimepath+=~/.vim/after | |
let &packpath=&runtimepath | |
source ~/.vimrc | |
set undodir=~/.nvim/undodir " | |
" neovim specific plugins below | |
call plug#begin() | |
Plug 'pangloss/vim-javascript' | |
Plug 'leafgarland/typescript-vim' | |
Plug 'editorconfig/editorconfig-vim' | |
Plug 'junegunn/fzf', { 'do': { -> fzf#install() } } | |
Plug 'arcticicestudio/nord-vim' | |
Plug 'sonph/onehalf', { 'rtp': 'vim' } | |
Plug 'neoclide/coc.nvim', {'branch': 'release'} | |
Plug 'nvim-lua/plenary.nvim' | |
Plug 'nvim-telescope/telescope.nvim' | |
Plug 'nvim-treesitter/nvim-treesitter', {'do': ':TSUpdate'} | |
Plug 'vim-airline/vim-airline' | |
Plug 'vim-airline/vim-airline-themes' | |
call plug#end() | |
let g:typescript_compiler_binary = 'tsc' | |
let g:typescript_compiler_options = '' | |
autocmd QuickFixCmdPost [^l]* nested cwindow | |
autocmd QuickFixCmdPost l* nested lwindow | |
" Always show the signcolumn, otherwise it would shift the text each time | |
set signcolumn=number | |
" Set colors | |
" colorscheme nord | |
colorscheme onehalfdark | |
let g:airline_theme='onehalfdark' | |
" CoC | |
" Use tab for trigger completion with characters ahead and navigate. | |
" NOTE: Use command ':verbose imap <tab>' to make sure tab is not mapped by | |
" other plugin before putting this into your config. | |
inoremap <silent><expr> <TAB> | |
\ pumvisible() ? "\<C-n>" : | |
\ <SID>check_back_space() ? "\<TAB>" : | |
\ coc#refresh() | |
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>" | |
" Use <c-space> to trigger completion in neovim with ctrl+space | |
inoremap <silent><expr> <c-space> coc#refresh() | |
" ...code navigation: | |
nmap <silent> gd <Plug>(coc-definition) | |
nmap <silent> gy <Plug>(coc-type-definition) | |
nmap <silent> gi <Plug>(coc-implementation) | |
nmap <silent> gr <Plug>(coc-references) | |
" Telescope | |
" 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> | |
" After installing: | |
" - Install plug `https://github.com/junegunn/vim-plug` | |
" - Run :PlugInstall | |
" - Enable language service(s) for Coc | |
" - Install telescope dependencies (https://github.com/sharkdp/fd, https://github.com/BurntSushi/ripgrep) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment