Skip to content

Instantly share code, notes, and snippets.

@paulschick
Created September 4, 2021 09:25
Show Gist options
  • Select an option

  • Save paulschick/96e3529f84e7fc2899e7503e02ea1b77 to your computer and use it in GitHub Desktop.

Select an option

Save paulschick/96e3529f84e7fc2899e7503e02ea1b77 to your computer and use it in GitHub Desktop.

Revisions

  1. paulschick created this gist Sep 4, 2021.
    58 changes: 58 additions & 0 deletions init.vim
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,58 @@
    source $HOME/.config/nvim/vim-plug/plugins.vim

    " enter normal mode with
    inoremap jk <ESC>
    " open nerd tree with ctrl + n
    nmap <C-n> :NERDTreeToggle<CR>
    vmap ++ <plug>NERDCommenterToggle
    nmap ++ <plug>NERDCommenterToggle
    let g:NERDTreeIgnore = ['^node_modules', '*.db', '*.sqlite', '*/tmp/*', '*.swp']

    " Tab width
    autocmd Filetype solidity setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4
    autocmd Filetype javascript setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2
    autocmd Filetype typescript setlocal expandtab tabstop=2 shiftwidth=2 softtabstop=2
    autocmd Filetype python setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4
    autocmd Filetype rust setlocal expandtab tabstop=4 shiftwidth=4 softtabstop=4
    " Golang stuff
    autocmd Filetype go setlocal noexpandtab tabstop=4 shiftwidth=4 softtabstop=4

    " default tab width
    set smarttab
    set cindent
    set tabstop=4
    set shiftwidth=4
    set expandtab

    " Relative line numbers
    set relativenumber
    set rnu

    " Installed theme
    colorscheme nord


    " For nord colorscheme --- fix no highlighting with select
    highlight clear CursorLine to clear the current cusorline hl
    highlight CursorLine gui=underline cterm=underline
    highlight Visual cterm=bold ctermbg=Blue ctermfg=White

    " Remove highlight after search
    " NOTE: Leader is \
    nnoremap <Leader><space> :noh<cr>
    " scroll with mouse
    :set mouse=a

    " Go Highlighting
    " Source https://hackernoon.com/my-neovim-setup-for-go-7f7b6e805876
    let g:go_highlight_build_constraints = 1
    let g:go_highlight_extra_types = 1
    let g:go_highlight_fields = 1
    let g:go_highlight_functions = 1
    let g:go_highlight_methods = 1
    let g:go_highlight_operators = 1
    let g:go_highlight_structs = 1
    let g:go_highlight_types = 1
    36 changes: 36 additions & 0 deletions plugins.vim
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    " auto-install vim-plug
    if empty(glob('~/.config/nvim/autoload/plug.vim'))
    silent !curl -fLo ~/.config/nvim/autoload/plug.vim --create-dirs
    \ https://raw.githubusercontent.com/junegunn/vim-plug/master/plug.vim
    "autocmd VimEnter * PlugInstall
    "autocmd VimEnter * PlugInstall | source $MYVIMRC
    endif

    call plug#begin('~/.config/nvim/autoload/plugged')

    Plug 'scrooloose/nerdtree'
    Plug 'Xuyuanp/nerdtree-git-plugin'
    Plug 'tiagofumo/vim-nerdtree-syntax-highlight'
    Plug 'ryanoasis/vim-devicons'
    Plug 'airblade/vim-gitgutter'
    Plug 'tomlion/vim-solidity'
    Plug 'neoclide/coc.nvim', {'branch': 'master', 'do': 'yarn install --frozen-lockfile'}
    " vim go
    Plug 'fatih/vim-go', {'do': ':GoUpdateBinaries'}

    " Rust stuff
    " https://sharksforarms.dev/posts/neovim-rust/

    " Completion Framework
    Plug 'hrsh7th/nvim-cmp'

    Plug 'hrsh7th/cmp-path'
    Plug 'hrsh7th/cmp-buffer'

    " Rust analyzer, hints
    Plug 'simrat39/rust-tools.nvim'

    " Additional color scheme
    Plug 'arcticicestudio/nord-vim'

    call plug#end()