Skip to content

Instantly share code, notes, and snippets.

@Thomascountz
Created November 22, 2019 13:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Thomascountz/c1320d59be5a1de4d8790d1fc8bc238a to your computer and use it in GitHub Desktop.
Save Thomascountz/c1320d59be5a1de4d8790d1fc8bc238a to your computer and use it in GitHub Desktop.
nvim dotfile
" ------------------------------------------------------------------
" general config
" ------------------------------------------------------------------
set number " show line numbers
let mapleader = "\\" " assign \ as leader
set showmatch " show matching brackets.
set ignorecase " case insensitive matching
set hlsearch " highlight search results
set tabstop=2 " number of columns occupied by a tab character
set softtabstop=2 " see multiple spaces as tabstops so <BS> does the right thing
set expandtab " converts tabs to white space
set shiftwidth=2 " width for autoindents
set autoindent " indent a new line the same amount as the line just typed
set wildmode=longest,list " get bash-like tab completions
filetype plugin indent on " allows auto-indenting depending on file type
syntax on " syntax highlighting
let g:python_host_prog = '/usr/bin/python'
let g:python3_host_prog = '/usr/local/bin/python3.7'
" ------------------------------------------------------------------
" keybinds
" ------------------------------------------------------------------
nmap <Leader><TAB> :tabnew<CR>
nmap <Leader><TAB>n :tabnext<CR>
nmap <Leader><TAB>p :tabNext<CR>
nmap <Leader>tsi :r! echo -n \[(date "+\%Y-\%m-\%d \%a \%H:\%M")\]<CR>
nmap <Leader>tsa :r! echo -n \<(date "+\%Y-\%m-\%d \%a \%H:\%M")\><CR>
" -----------------------------------------------------------------
" plugins
" ------------------------------------------------------------------
" Plugins will be downloaded under the specified directory.
call plug#begin('~/.config/.nvim/plugged')
Plug '/usr/local/opt/fzf'
Plug 'junegunn/fzf.vim'
Plug 'OmniSharp/omnisharp-vim'
Plug 'janko/vim-test'
Plug 'jceb/vim-orgmode' " orgmode integration for vim
" jceb/vim-orgmode requires python - https://github.com/deoplete-plugins/deoplete-jedi/wiki/Setting-up-Python-for-Neovim
Plug 'vim-scripts/utl.vim' " universal Text Linking (vim-orgmode dep)
Plug 'tpope/vim-repeat' " better command repeatment (vim-orgmode dep)
Plug 'vim-scripts/taglist.vim' " source code browsing (vim-orgmode dep)
Plug 'tpope/vim-speeddating' " date tools (vim-orgmode dep)
Plug 'chrisbra/NrrwRgn' " narrow Region feature from emacs (vim-orgmode dep)
Plug 'mattn/calendar-vim' " calendar window inside vim (vim-orgmode dep)
Plug 'vim-scripts/SyntaxRange' " syntax highlighting for code regions (vim-orgmode dep)
" List ends here. Plugins become visible to Vim after this call.
call plug#end()
" ------------------------------------------------------------------
" fzf.vim config
" ------------------------------------------------------------------
" Git files
nmap <Leader>f :GFiles<CR>
" Files
nmap <Leader>F :Files<CR>
" Buffers
nmap <Leader>b :Buffers<CR>
" Previous buffers
nmap <Leader>h :History<CR>
" ctags in current buffer
nmap <Leader>c :BTags<CR>
" ctags in project
nmap <Leader>C :Tags<CR>
" Commands
nmap <Leader><SPACE> :Commands<CR>
" Key Maps
nmap <Leader>k :Maps<CR>
" ------------------------------------------------------------------
" omnisharp-vim config
" ------------------------------------------------------------------
" Use the stdio version of OmniSharp-roslyn:
let g:OmniSharp_server_stdio = 1
augroup omnisharp_commands
autocmd!
" The following commands are contextual, based on the cursor position.
autocmd FileType cs nnoremap <buffer> <Leader>gd :OmniSharpGotoDefinition<CR>
autocmd FileType cs nnoremap <buffer> <Leader>pd :OmniSharpPreviewDefinition<CR>
autocmd FileType cs nnoremap <buffer> <Leader>fi :OmniSharpFindImplementations<CR>
autocmd FileType cs nnoremap <buffer> <Leader>fs :OmniSharpFindSymbol<CR>
autocmd FileType cs nnoremap <buffer> <Leader>fu :OmniSharpFindUsages<CR>
" Finds members in the current buffer
autocmd FileType cs nnoremap <buffer> <Leader>fm :OmniSharpFindMembers<CR>
autocmd FileType cs nnoremap <buffer> <Leader>fx :OmniSharpFixUsings<CR>
autocmd FileType cs nnoremap <buffer> <Leader>tt :OmniSharpTypeLookup<CR>
autocmd FileType cs nnoremap <buffer> <Leader>dc :OmniSharpDocumentation<CR>
" Find all code errors/warnings for the current solution and populate the quickfix window
autocmd FileType cs nnoremap <buffer> <Leader>cc :OmniSharpGlobalCodeCheck<CR>
augroup END
" ------------------------------------------------------------------
" vim-test config
" ------------------------------------------------------------------
nmap <silent> <Leader>tn :TestNearest<CR>
nmap <silent> <Leader>tt :TestFile<CR>
nmap <silent> <Leader>ta :TestSuite<CR>
nmap <silent> <Leader>tl :TestLast<CR>
nmap <silent> <Leader>tv :TestVisit<CR>
" make test commands execute using neovim terminal.
let test#strategy = "neovim"
" run csharp tests with `dotnet test` CLI
let test#csharp#runner = "dotnettest"
" run `dotnet test` with `--verbosity normal` option
let test#csharp#dotnettest#options = "--verbosity normal"
" press `C-o` to exit insert mode in test buffer
if has('nvim')
tmap <C-o> <C-\><C-n>
endif
" ------------------------------------------------------------------
" vim-orgmode config
" ------------------------------------------------------------------
" set org TODO states
" :let g:org_todo_keywords=['TODO', 'FEEDBACK', 'VERIFY', '|', 'DONE', 'DELEGATED']
" https://github.com/jceb/vim-orgmode/blob/5099025d0b632a5e56fa457f826153cd37c48d3c/doc/orgguide.txt#L669
" specify org files for agenda
let g:org_agenda_files = ['~/org/*.org']
" https://github.com/jceb/vim-orgmode/blob/5099025d0b632a5e56fa457f826153cd37c48d3c/doc/orgguide.txt#L972
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment