Cleanup nvim config
This commit is contained in:
parent
a82be6a321
commit
18791ed12a
@ -1,20 +1,44 @@
|
|||||||
-- init.lua
|
require('packer').startup(function(use)
|
||||||
|
use { "williamboman/mason.nvim" }
|
||||||
|
|
||||||
-- Load custom tree-sitter grammar for org filetype
|
use {
|
||||||
require('orgmode').setup_ts_grammar()
|
'VonHeikemen/lsp-zero.nvim',
|
||||||
|
requires = {
|
||||||
|
-- LSP Support
|
||||||
|
{ 'neovim/nvim-lspconfig' },
|
||||||
|
{ 'williamboman/mason.nvim' },
|
||||||
|
{ 'williamboman/mason-lspconfig.nvim' },
|
||||||
|
|
||||||
-- Tree-sitter configuration
|
-- Autocompletion
|
||||||
require'nvim-treesitter.configs'.setup {
|
{ 'hrsh7th/nvim-cmp' },
|
||||||
-- If TS highlights are not enabled at all, or disabled via `disable` prop, highlighting will fallback to default Vim syntax highlighting
|
{ 'hrsh7th/cmp-buffer' },
|
||||||
highlight = {
|
{ 'hrsh7th/cmp-path' },
|
||||||
enable = true,
|
{ 'saadparwaiz1/cmp_luasnip' },
|
||||||
disable = {'org'}, -- Remove this to use TS highlighter for some of the highlights (Experimental)
|
{ 'hrsh7th/cmp-nvim-lsp' },
|
||||||
additional_vim_regex_highlighting = {'org'}, -- Required since TS highlighter doesn't support all syntax features (conceal)
|
{ 'hrsh7th/cmp-nvim-lua' },
|
||||||
},
|
|
||||||
ensure_installed = {'org'}, -- Or run :TSUpdate org
|
-- Snippets
|
||||||
|
{ 'L3MON4D3/LuaSnip' },
|
||||||
|
{ 'rafamadriz/friendly-snippets' },
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
require('orgmode').setup({
|
use {
|
||||||
org_agenda_files = {'~/Nextcloud/org/*'},
|
'nvim-treesitter/nvim-treesitter',
|
||||||
org_default_notes_file = '~/Nextcloud/org/refile.org',
|
run = function() require('nvim-treesitter.install').update({ with_sync = true }) end,
|
||||||
})
|
}
|
||||||
|
|
||||||
|
use { 'kien/ctrlp.vim' }
|
||||||
|
|
||||||
|
use { 'tpope/vim-commentary' }
|
||||||
|
use { 'tpope/vim-surround' }
|
||||||
|
|
||||||
|
use { 'vim-scripts/lastpos.vim' }
|
||||||
|
end)
|
||||||
|
|
||||||
|
local lsp = require('lsp-zero')
|
||||||
|
|
||||||
|
lsp.preset('recommended')
|
||||||
|
lsp.setup()
|
||||||
|
|
||||||
|
require('nvim-treesitter.configs').setup{highlight={enable=true}}
|
||||||
|
89
home/neovim/init.vim
Normal file
89
home/neovim/init.vim
Normal file
@ -0,0 +1,89 @@
|
|||||||
|
set number
|
||||||
|
set relativenumber
|
||||||
|
|
||||||
|
set expandtab
|
||||||
|
set shiftwidth=2
|
||||||
|
set tabstop=2
|
||||||
|
|
||||||
|
set ignorecase
|
||||||
|
set smartcase
|
||||||
|
|
||||||
|
" always set autoindenting on
|
||||||
|
set autoindent
|
||||||
|
" smart indent; stop indent when closing brackets etc
|
||||||
|
set smartindent
|
||||||
|
|
||||||
|
" highlight search result
|
||||||
|
set hlsearch
|
||||||
|
" incremental search
|
||||||
|
set incsearch
|
||||||
|
|
||||||
|
" yank into system clipboard
|
||||||
|
set clipboard=unnamedplus
|
||||||
|
|
||||||
|
" true color
|
||||||
|
set termguicolors
|
||||||
|
|
||||||
|
" other color for popup
|
||||||
|
highlight Pmenu ctermbg=gray guibg=gray
|
||||||
|
|
||||||
|
set signcolumn=yes
|
||||||
|
|
||||||
|
" break at last word instead of last char
|
||||||
|
set linebreak
|
||||||
|
|
||||||
|
set cursorline
|
||||||
|
|
||||||
|
" autoload file changes
|
||||||
|
set autoread
|
||||||
|
|
||||||
|
set smarttab
|
||||||
|
|
||||||
|
set shiftround
|
||||||
|
|
||||||
|
" invisible characters
|
||||||
|
set list
|
||||||
|
|
||||||
|
" keep 5 lines on the screen when scrolling
|
||||||
|
set scrolloff=5
|
||||||
|
" enhanced command line completion
|
||||||
|
set wildmenu
|
||||||
|
" Search down into subfolders
|
||||||
|
" Provides tab-completion for all file-related tasks
|
||||||
|
set path+=**
|
||||||
|
|
||||||
|
" show incomplete commands
|
||||||
|
set showcmd
|
||||||
|
|
||||||
|
" complete files like a shell
|
||||||
|
set wildmode=list:longest
|
||||||
|
|
||||||
|
" set spell langs
|
||||||
|
set spelllang=de,en
|
||||||
|
|
||||||
|
" persist undo history
|
||||||
|
set undofile
|
||||||
|
|
||||||
|
" clear highlighted search
|
||||||
|
noremap <space> :nohlsearch<cr>
|
||||||
|
|
||||||
|
" Highlight symbol under cursor on CursorHold
|
||||||
|
autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||||
|
|
||||||
|
" Append modeline after last line in buffer.
|
||||||
|
" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX files.
|
||||||
|
function! AppendModeline()
|
||||||
|
let l:modeline = printf(" vim: set filetype=%s ts=%d sw=%d tw=%d %s :",
|
||||||
|
\ &filetype, &tabstop, &shiftwidth, &textwidth, &expandtab ? 'et' : 'noet')
|
||||||
|
let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
|
||||||
|
call append(line("$"), l:modeline)
|
||||||
|
endfunction
|
||||||
|
nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
|
||||||
|
|
||||||
|
syntax enable
|
||||||
|
|
||||||
|
if executable('rg')
|
||||||
|
set grepprg=rg\ --color=never
|
||||||
|
let g:ctrlp_user_command='rg %s --files -i --color=never --glob ""'
|
||||||
|
let g:ctrlp_use_caching=0
|
||||||
|
endif
|
@ -2,436 +2,447 @@
|
|||||||
let
|
let
|
||||||
config = {
|
config = {
|
||||||
plugins = with pkgs.vimPlugins; [
|
plugins = with pkgs.vimPlugins; [
|
||||||
vim-colors-solarized
|
packer-nvim
|
||||||
|
# vim-colors-solarized
|
||||||
|
|
||||||
coc-nvim
|
# coc-nvim
|
||||||
coc-rust-analyzer
|
# coc-rust-analyzer
|
||||||
coc-pyright
|
# coc-pyright
|
||||||
coc-go
|
# coc-go
|
||||||
|
|
||||||
# orgmode-nvim
|
# # orgmode-nvim
|
||||||
# nvim-treesitter
|
# # nvim-treesitter
|
||||||
|
|
||||||
ctrlp-vim
|
# ctrlp-vim
|
||||||
editorconfig-vim
|
# editorconfig-vim
|
||||||
vim-gist
|
# vim-gist
|
||||||
goyo-vim
|
# goyo-vim
|
||||||
# gopls
|
# # gopls
|
||||||
neomake
|
# neomake
|
||||||
rust-vim
|
# rust-vim
|
||||||
solarized
|
# solarized
|
||||||
vim-commentary
|
# vim-commentary
|
||||||
vim-dispatch
|
# vim-dispatch
|
||||||
vim-fugitive
|
# vim-fugitive
|
||||||
vim-gitgutter
|
# vim-gitgutter
|
||||||
vim-lastplace
|
# vim-lastplace
|
||||||
vim-nix
|
# vim-nix
|
||||||
vim-polyglot
|
# vim-polyglot
|
||||||
vim-repeat
|
# vim-repeat
|
||||||
# vim-scala
|
# # vim-scala
|
||||||
vim-sleuth
|
# vim-sleuth
|
||||||
vim-surround
|
# vim-surround
|
||||||
vim-trailing-whitespace
|
# vim-trailing-whitespace
|
||||||
# vimtex
|
# # vimtex
|
||||||
vimux
|
# vimux
|
||||||
vimwiki
|
# vimwiki
|
||||||
];
|
];
|
||||||
enable = true;
|
enable = true;
|
||||||
extraConfig = ''
|
# extraConfig = ''
|
||||||
set background=dark
|
# set background=dark
|
||||||
" allow switching away from unsaved buffers
|
# " allow switching away from unsaved buffers
|
||||||
set hidden
|
# set hidden
|
||||||
set history=1000
|
# set history=1000
|
||||||
|
|
||||||
set updatetime=300
|
# set updatetime=300
|
||||||
|
|
||||||
set expandtab
|
# set expandtab
|
||||||
set shiftwidth=2
|
# set shiftwidth=2
|
||||||
set tabstop=2
|
# set tabstop=2
|
||||||
|
|
||||||
set ignorecase
|
# set ignorecase
|
||||||
set smartcase
|
# set smartcase
|
||||||
|
|
||||||
set number
|
# set number
|
||||||
set relativenumber
|
# set relativenumber
|
||||||
|
|
||||||
set backupdir=$HOME/.vim/backupfiles//
|
# set backupdir=$HOME/.vim/backupfiles//
|
||||||
set directory=$HOME/.vim/swapfiles//
|
# set directory=$HOME/.vim/swapfiles//
|
||||||
set undodir=$HOME/.vim/undofiles//
|
# set undodir=$HOME/.vim/undofiles//
|
||||||
set undofile
|
# set undofile
|
||||||
|
|
||||||
set nocompatible
|
# set nocompatible
|
||||||
|
|
||||||
filetype plugin indent on
|
# filetype plugin indent on
|
||||||
|
|
||||||
" always set autoindenting on
|
# " always set autoindenting on
|
||||||
set autoindent
|
# set autoindent
|
||||||
" smart indent; stop indent when closing brackets etc
|
# " smart indent; stop indent when closing brackets etc
|
||||||
set smartindent
|
# set smartindent
|
||||||
" two spaces after .?! when joining lines
|
# " two spaces after .?! when joining lines
|
||||||
set joinspaces
|
# set joinspaces
|
||||||
|
|
||||||
" highlight search result
|
# " highlight search result
|
||||||
set hlsearch
|
# set hlsearch
|
||||||
" incremental search
|
# " incremental search
|
||||||
set incsearch
|
# set incsearch
|
||||||
set nolazyredraw
|
# set nolazyredraw
|
||||||
|
|
||||||
" delete whitespace, line break and char using <BS>
|
# " delete whitespace, line break and char using <BS>
|
||||||
set backspace=indent,eol,start
|
# set backspace=indent,eol,start
|
||||||
" always show curser position
|
# " always show curser position
|
||||||
set ruler
|
# set ruler
|
||||||
|
|
||||||
" yank into system clipboard
|
# " yank into system clipboard
|
||||||
set clipboard=unnamedplus
|
# set clipboard=unnamedplus
|
||||||
|
|
||||||
colorscheme solarized
|
# colorscheme solarized
|
||||||
" true color
|
# " true color
|
||||||
set termguicolors
|
# set termguicolors
|
||||||
" make true colors work in tmux
|
# " make true colors work in tmux
|
||||||
let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
# let &t_8f = "\<Esc>[38;2;%lu;%lu;%lum"
|
||||||
let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
# let &t_8b = "\<Esc>[48;2;%lu;%lu;%lum"
|
||||||
|
|
||||||
" set textwidth=80
|
# " set textwidth=80
|
||||||
set colorcolumn=+1
|
# set colorcolumn=+1
|
||||||
set signcolumn=yes
|
# set signcolumn=yes
|
||||||
" highlight current line
|
# " highlight current line
|
||||||
set cursorline
|
# set cursorline
|
||||||
|
|
||||||
" encoding
|
# " encoding
|
||||||
set fileencoding=utf-8
|
# set fileencoding=utf-8
|
||||||
|
|
||||||
" break at last word instead of last char
|
# " break at last word instead of last char
|
||||||
set linebreak
|
# set linebreak
|
||||||
|
|
||||||
" autoload file changes
|
# " autoload file changes
|
||||||
set autoread
|
# set autoread
|
||||||
|
|
||||||
set smarttab
|
# set smarttab
|
||||||
|
|
||||||
set softtabstop=2
|
# set softtabstop=2
|
||||||
set shiftround
|
# set shiftround
|
||||||
|
|
||||||
" invisible characters
|
# " invisible characters
|
||||||
set list
|
# set list
|
||||||
" set listchars=tab:â\ ,eol:¬,trail:â,extends:â¯,precedes:â®
|
# " set listchars=tab:â\ ,eol:¬,trail:â,extends:â¯,precedes:â®
|
||||||
" set showbreak=âª
|
# " set showbreak=âª
|
||||||
|
|
||||||
" code folding settings
|
# " code folding settings
|
||||||
" fold based on syntax
|
# " fold based on syntax
|
||||||
set foldmethod=indent
|
# set foldmethod=indent
|
||||||
" don't fold by default
|
# " don't fold by default
|
||||||
set nofoldenable
|
# set nofoldenable
|
||||||
set foldlevel=1
|
# set foldlevel=1
|
||||||
|
|
||||||
" smoother redrawing
|
# " smoother redrawing
|
||||||
set ttyfast
|
# set ttyfast
|
||||||
" diff with vertical split
|
# " diff with vertical split
|
||||||
set diffopt+=vertical
|
# set diffopt+=vertical
|
||||||
" show the status line all the time
|
# " show the status line all the time
|
||||||
set laststatus=2
|
# set laststatus=2
|
||||||
" keep 5 lines on the screen when scrolling
|
# " keep 5 lines on the screen when scrolling
|
||||||
set scrolloff=5
|
# set scrolloff=5
|
||||||
" enhanced command line completion
|
# " enhanced command line completion
|
||||||
set wildmenu
|
# set wildmenu
|
||||||
" Search down into subfolders
|
# " Search down into subfolders
|
||||||
" Provides tab-completion for all file-related tasks
|
# " Provides tab-completion for all file-related tasks
|
||||||
set path+=**
|
# set path+=**
|
||||||
|
|
||||||
" show incomplete commands
|
# " show incomplete commands
|
||||||
set showcmd
|
# set showcmd
|
||||||
|
|
||||||
" complete files like a shell
|
# " complete files like a shell
|
||||||
set wildmode=list:longest
|
# set wildmode=list:longest
|
||||||
|
|
||||||
" command bar height
|
# " command bar height
|
||||||
set cmdheight=1
|
# set cmdheight=1
|
||||||
" set terminal title
|
# " set terminal title
|
||||||
set title
|
# set title
|
||||||
" set shortmess+=TOFwatc
|
# " set shortmess+=TOFwatc
|
||||||
set shortmess+=c
|
# set shortmess+=c
|
||||||
|
|
||||||
" show matching braces
|
# " show matching braces
|
||||||
set showmatch
|
# set showmatch
|
||||||
" how many tenths of a second to blink
|
# " how many tenths of a second to blink
|
||||||
set mat=2
|
# set mat=2
|
||||||
" set spell langs
|
# " set spell langs
|
||||||
set spelllang=de,en
|
# set spelllang=de,en
|
||||||
|
|
||||||
syntax enable
|
# syntax enable
|
||||||
" let g:polyglot_disabled=['latex']
|
# " let g:polyglot_disabled=['latex']
|
||||||
" highlight clear SpellBad
|
# " highlight clear SpellBad
|
||||||
" highlight SpellBad cterm=undercurl
|
# " highlight SpellBad cterm=undercurl
|
||||||
|
|
||||||
" " Only do this part when compiled with support for autocommands.
|
# " " Only do this part when compiled with support for autocommands.
|
||||||
" if has("autocmd")
|
# " if has("autocmd")
|
||||||
" " Put these in an autocmd group, so that we can delete them easily.
|
# " " Put these in an autocmd group, so that we can delete them easily.
|
||||||
" augroup vimrcEx
|
# " augroup vimrcEx
|
||||||
" au!
|
# " au!
|
||||||
" autocmd FileType text setlocal foldtext<
|
# " autocmd FileType text setlocal foldtext<
|
||||||
" augroup END
|
# " augroup END
|
||||||
" endif " has("autocmd")
|
# " endif " has("autocmd")
|
||||||
|
|
||||||
" error bells
|
# " error bells
|
||||||
set errorbells
|
# set errorbells
|
||||||
set visualbell
|
# set visualbell
|
||||||
set timeoutlen=500
|
# set timeoutlen=500
|
||||||
|
|
||||||
" turn on manpages (:Man)
|
# " turn on manpages (:Man)
|
||||||
runtime ftplugin/man.vim
|
# runtime ftplugin/man.vim
|
||||||
|
|
||||||
" set a map leader for more key combos
|
# " set a map leader for more key combos
|
||||||
let mapleader=','
|
# let mapleader=','
|
||||||
|
|
||||||
" clear highlighted search
|
# " clear highlighted search
|
||||||
noremap <space> :nohlsearch<cr>
|
# noremap <space> :nohlsearch<cr>
|
||||||
|
|
||||||
" enable . command in visual mode
|
# " enable . command in visual mode
|
||||||
vnoremap . :normal .<cr>
|
# vnoremap . :normal .<cr>
|
||||||
|
|
||||||
" make the highlighting of tabs and other non-text less annoying
|
# " make the highlighting of tabs and other non-text less annoying
|
||||||
highlight SpecialKey ctermbg=none ctermfg=8
|
# highlight SpecialKey ctermbg=none ctermfg=8
|
||||||
highlight NonText ctermbg=none ctermfg=8
|
# highlight NonText ctermbg=none ctermfg=8
|
||||||
|
|
||||||
" other color for popup
|
# " other color for popup
|
||||||
highlight Pmenu ctermbg=gray guibg=gray
|
# highlight Pmenu ctermbg=gray guibg=gray
|
||||||
|
|
||||||
" ctrlp
|
# " ctrlp
|
||||||
" order top to bottom
|
# " order top to bottom
|
||||||
let g:ctrlp_match_window='bottom,order::ttb'
|
# let g:ctrlp_match_window='bottom,order::ttb'
|
||||||
" open files in new buffer
|
# " open files in new buffer
|
||||||
let g:ctrlp_switch_buffer=0
|
# let g:ctrlp_switch_buffer=0
|
||||||
" use ripgrep if available
|
# " use ripgrep if available
|
||||||
if executable('rg')
|
# if executable('rg')
|
||||||
set grepprg=rg\ --color=never
|
# set grepprg=rg\ --color=never
|
||||||
let g:ctrlp_user_command='rg %s --files -i --color=never --glob ""'
|
# let g:ctrlp_user_command='rg %s --files -i --color=never --glob ""'
|
||||||
let g:ctrlp_use_caching=0
|
# let g:ctrlp_use_caching=0
|
||||||
endif
|
# endif
|
||||||
|
|
||||||
" set textwidth for mails
|
# " set textwidth for mails
|
||||||
autocmd FileType mail setlocal textwidth=72
|
# autocmd FileType mail setlocal textwidth=72
|
||||||
|
|
||||||
" count wraped lines as one line when doing relative jumps
|
# " count wraped lines as one line when doing relative jumps
|
||||||
noremap <silent> <expr> j (v:count == 0 ? 'gj' : 'j')
|
# noremap <silent> <expr> j (v:count == 0 ? 'gj' : 'j')
|
||||||
noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k')
|
# noremap <silent> <expr> k (v:count == 0 ? 'gk' : 'k')
|
||||||
|
|
||||||
" scroll the viewport faster
|
# " scroll the viewport faster
|
||||||
nnoremap <C-e> 3<C-e>
|
# nnoremap <C-e> 3<C-e>
|
||||||
nnoremap <C-y> 3<C-y>
|
# nnoremap <C-y> 3<C-y>
|
||||||
|
|
||||||
"" Section AutoGroups {{{
|
# "" Section AutoGroups {{{
|
||||||
"" file type specific settings
|
# "" file type specific settings
|
||||||
augroup configgroup
|
# augroup configgroup
|
||||||
autocmd!
|
# autocmd!
|
||||||
|
|
||||||
" automatically resize panes on resize
|
# " automatically resize panes on resize
|
||||||
autocmd VimResized * exe 'normal! \<c-w>='
|
# autocmd VimResized * exe 'normal! \<c-w>='
|
||||||
autocmd BufWritePost .vimrc,.vimrc.local,init.vim source %
|
# autocmd BufWritePost .vimrc,.vimrc.local,init.vim source %
|
||||||
" save all files on focus lost, ignoring warnings about untitled buffers
|
# " save all files on focus lost, ignoring warnings about untitled buffers
|
||||||
autocmd FocusLost * silent! wa
|
# autocmd FocusLost * silent! wa
|
||||||
|
|
||||||
" make quickfix windows take all the lower section of the screen
|
# " make quickfix windows take all the lower section of the screen
|
||||||
" when there are multiple windows open
|
# " when there are multiple windows open
|
||||||
autocmd FileType qf wincmd J
|
# autocmd FileType qf wincmd J
|
||||||
|
|
||||||
autocmd! BufWritePost * Neomake
|
# autocmd! BufWritePost * Neomake
|
||||||
augroup END
|
# augroup END
|
||||||
" }}}
|
# " }}}
|
||||||
|
|
||||||
" Append modeline after last line in buffer.
|
# " Append modeline after last line in buffer.
|
||||||
" Use substitute() instead of printf() to handle '%%s' modeline in LaTeX files.
|
# " Use substitute() instead of printf() to handle '%%s' modeline in LaTeX files.
|
||||||
function! AppendModeline()
|
# function! AppendModeline()
|
||||||
let l:modeline = printf(" vim: set filetype=%s ts=%d sw=%d tw=%d %s :",
|
# let l:modeline = printf(" vim: set filetype=%s ts=%d sw=%d tw=%d %s :",
|
||||||
\ &filetype, &tabstop, &shiftwidth, &textwidth, &expandtab ? 'et' : 'noet')
|
# \ &filetype, &tabstop, &shiftwidth, &textwidth, &expandtab ? 'et' : 'noet')
|
||||||
let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
|
# let l:modeline = substitute(&commentstring, "%s", l:modeline, "")
|
||||||
call append(line("$"), l:modeline)
|
# call append(line("$"), l:modeline)
|
||||||
endfunction
|
# endfunction
|
||||||
nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
|
# nnoremap <silent> <Leader>ml :call AppendModeline()<CR>
|
||||||
|
|
||||||
" netrw settings
|
# " netrw settings
|
||||||
" disable banner
|
# " disable banner
|
||||||
let g:netrw_banner=0
|
# let g:netrw_banner=0
|
||||||
" open in prior window
|
# " open in prior window
|
||||||
let g:netrw_browse_split=4
|
# let g:netrw_browse_split=4
|
||||||
" open splits to the right
|
# " open splits to the right
|
||||||
let g:netrw_altv=1
|
# let g:netrw_altv=1
|
||||||
" treeview
|
# " treeview
|
||||||
let g:netrw_liststyle=3
|
# let g:netrw_liststyle=3
|
||||||
let g:netrw_list_hide=netrw_gitignore#Hide()
|
# let g:netrw_list_hide=netrw_gitignore#Hide()
|
||||||
let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
|
# let g:netrw_list_hide.=',\(^\|\s\s\)\zs\.\S\+'
|
||||||
|
|
||||||
" vimux mappings
|
# " vimux mappings
|
||||||
" Prompt for a command
|
# " Prompt for a command
|
||||||
map <Leader>vp :VimuxPromptCommand<CR>
|
# map <Leader>vp :VimuxPromptCommand<CR>
|
||||||
" Prompt for a make command
|
# " Prompt for a make command
|
||||||
map <Leader>vm :VimuxPromptCommand("make ")<CR>
|
# map <Leader>vm :VimuxPromptCommand("make ")<CR>
|
||||||
" Inspect runner pane
|
# " Inspect runner pane
|
||||||
map <Leader>vi :VimuxInspectRunner<CR>
|
# map <Leader>vi :VimuxInspectRunner<CR>
|
||||||
" Close runner
|
# " Close runner
|
||||||
map <Leader>vq :VimuxCloseRunner<CR>
|
# map <Leader>vq :VimuxCloseRunner<CR>
|
||||||
" Rerun last command
|
# " Rerun last command
|
||||||
map <Leader>vv :VimuxRunLastCommand<CR>
|
# map <Leader>vv :VimuxRunLastCommand<CR>
|
||||||
" Stop running command
|
# " Stop running command
|
||||||
map <Leader>vs :VimuxInterruptRunner<CR>
|
# map <Leader>vs :VimuxInterruptRunner<CR>
|
||||||
|
|
||||||
" close Goyo *and* vim with :q
|
# " close Goyo *and* vim with :q
|
||||||
function! s:goyo_enter()
|
# function! s:goyo_enter()
|
||||||
let b:quitting=0
|
# let b:quitting=0
|
||||||
let b:quitting_bang=0
|
# let b:quitting_bang=0
|
||||||
autocmd QuitPre <buffer> let b:quitting=1
|
# autocmd QuitPre <buffer> let b:quitting=1
|
||||||
cabbrev <buffer> q! let b:quitting_bang=1 <bar> q!
|
# cabbrev <buffer> q! let b:quitting_bang=1 <bar> q!
|
||||||
endfunction
|
# endfunction
|
||||||
|
|
||||||
function! s:goyo_leave()
|
# function! s:goyo_leave()
|
||||||
" Quit Vim if this is the only remaining buffer
|
# " Quit Vim if this is the only remaining buffer
|
||||||
if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
|
# if b:quitting && len(filter(range(1, bufnr('$')), 'buflisted(v:val)')) == 1
|
||||||
if b:quitting_bang
|
# if b:quitting_bang
|
||||||
qa!
|
# qa!
|
||||||
else
|
# else
|
||||||
qa
|
# qa
|
||||||
endif
|
# endif
|
||||||
endif
|
# endif
|
||||||
endfunction
|
# endfunction
|
||||||
autocmd! User GoyoEnter call <SID>goyo_enter()
|
# autocmd! User GoyoEnter call <SID>goyo_enter()
|
||||||
autocmd! User GoyoLeave call <SID>goyo_leave()
|
# autocmd! User GoyoLeave call <SID>goyo_leave()
|
||||||
|
|
||||||
" run rustfmt when saving a file
|
# " run rustfmt when saving a file
|
||||||
let g:rustfmt_autosave=1
|
# let g:rustfmt_autosave=1
|
||||||
|
|
||||||
au BufRead,BufNewFile *.sbt set filetype=scala
|
# au BufRead,BufNewFile *.sbt set filetype=scala
|
||||||
|
|
||||||
" textwidth for emails
|
# " textwidth for emails
|
||||||
au BufRead /tmp/*mutt-* set tw=72
|
# au BufRead /tmp/*mutt-* set tw=72
|
||||||
augroup filetypedetect
|
# augroup filetypedetect
|
||||||
" Mail
|
# " Mail
|
||||||
autocmd BufRead,BufNewFile *mutt-* setfiletype mail
|
# autocmd BufRead,BufNewFile *mutt-* setfiletype mail
|
||||||
augroup END
|
# augroup END
|
||||||
|
|
||||||
|
|
||||||
let g:coc_global_extensions = [
|
# let g:coc_global_extensions = [
|
||||||
\ 'coc-explorer',
|
# \ 'coc-explorer',
|
||||||
\ 'coc-snippets',
|
# \ 'coc-snippets',
|
||||||
\ 'coc-pairs'
|
# \ 'coc-pairs'
|
||||||
\ ]
|
# \ ]
|
||||||
nmap ge :CocCommand explorer<CR>
|
# nmap ge :CocCommand explorer<CR>
|
||||||
" Use tab for trigger completion with characters ahead and navigate.
|
# " Use tab for trigger completion with characters ahead and navigate.
|
||||||
" Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
|
# " Use command ':verbose imap <tab>' to make sure tab is not mapped by other plugin.
|
||||||
inoremap <silent><expr> <TAB>
|
# inoremap <silent><expr> <TAB>
|
||||||
\ pumvisible() ? "\<C-n>" :
|
# \ pumvisible() ? "\<C-n>" :
|
||||||
\ <SID>check_back_space() ? "\<TAB>" :
|
# \ <SID>check_back_space() ? "\<TAB>" :
|
||||||
\ coc#refresh()
|
# \ coc#refresh()
|
||||||
inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
# inoremap <expr><S-TAB> pumvisible() ? "\<C-p>" : "\<C-h>"
|
||||||
|
|
||||||
function! s:check_back_space() abort
|
# function! s:check_back_space() abort
|
||||||
let col = col('.') - 1
|
# let col = col('.') - 1
|
||||||
return !col || getline('.')[col - 1] =~# '\s'
|
# return !col || getline('.')[col - 1] =~# '\s'
|
||||||
endfunction
|
# endfunction
|
||||||
|
|
||||||
" Use <c-space> to trigger completion.
|
# " Use <c-space> to trigger completion.
|
||||||
inoremap <silent><expr> <c-space> coc#refresh()
|
# inoremap <silent><expr> <c-space> coc#refresh()
|
||||||
|
|
||||||
" Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
|
# " Use <cr> to confirm completion, `<C-g>u` means break undo chain at current position.
|
||||||
" Coc only does snippet and additional edit on confirm.
|
# " Coc only does snippet and additional edit on confirm.
|
||||||
inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
# inoremap <expr> <cr> pumvisible() ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||||
" Or use `complete_info` if your vim support it, like:
|
# " Or use `complete_info` if your vim support it, like:
|
||||||
" inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
# " inoremap <expr> <cr> complete_info()["selected"] != "-1" ? "\<C-y>" : "\<C-g>u\<CR>"
|
||||||
|
|
||||||
" Use `[g` and `]g` to navigate diagnostics
|
# " Use `[g` and `]g` to navigate diagnostics
|
||||||
nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
# nmap <silent> [g <Plug>(coc-diagnostic-prev)
|
||||||
nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
# nmap <silent> ]g <Plug>(coc-diagnostic-next)
|
||||||
|
|
||||||
" Remap keys for gotos
|
# " Remap keys for gotos
|
||||||
nmap <silent> gd <Plug>(coc-definition)
|
# nmap <silent> gd <Plug>(coc-definition)
|
||||||
nmap <silent> gy <Plug>(coc-type-definition)
|
# nmap <silent> gy <Plug>(coc-type-definition)
|
||||||
nmap <silent> gi <Plug>(coc-implementation)
|
# nmap <silent> gi <Plug>(coc-implementation)
|
||||||
nmap <silent> gr <Plug>(coc-references)
|
# nmap <silent> gr <Plug>(coc-references)
|
||||||
|
|
||||||
" Use K to show documentation in preview window
|
# " Use K to show documentation in preview window
|
||||||
nnoremap <silent> K :call <SID>show_documentation()<CR>
|
# nnoremap <silent> K :call <SID>show_documentation()<CR>
|
||||||
|
|
||||||
function! s:show_documentation()
|
# function! s:show_documentation()
|
||||||
if (index(['vim','help'], &filetype) >= 0)
|
# if (index(['vim','help'], &filetype) >= 0)
|
||||||
execute 'h '.expand('<cword>')
|
# execute 'h '.expand('<cword>')
|
||||||
else
|
# else
|
||||||
call CocAction('doHover')
|
# call CocAction('doHover')
|
||||||
endif
|
# endif
|
||||||
endfunction
|
# endfunction
|
||||||
|
|
||||||
" Highlight symbol under cursor on CursorHold
|
# " Highlight symbol under cursor on CursorHold
|
||||||
autocmd CursorHold * silent call CocActionAsync('highlight')
|
# autocmd CursorHold * silent call CocActionAsync('highlight')
|
||||||
|
|
||||||
" Remap for rename current word
|
# " Remap for rename current word
|
||||||
nmap <leader>rn <Plug>(coc-rename)
|
# nmap <leader>rn <Plug>(coc-rename)
|
||||||
|
|
||||||
" Remap for format selected region
|
# " Remap for format selected region
|
||||||
xmap <leader>f <Plug>(coc-format-selected)
|
# xmap <leader>f <Plug>(coc-format-selected)
|
||||||
nmap <leader>f <Plug>(coc-format-selected)
|
# nmap <leader>f <Plug>(coc-format-selected)
|
||||||
|
|
||||||
augroup mygroup
|
# augroup mygroup
|
||||||
autocmd!
|
# autocmd!
|
||||||
" Setup formatexpr specified filetype(s).
|
# " Setup formatexpr specified filetype(s).
|
||||||
autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
|
# autocmd FileType typescript,json setl formatexpr=CocAction('formatSelected')
|
||||||
" Update signature help on jump placeholder
|
# " Update signature help on jump placeholder
|
||||||
autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
# autocmd User CocJumpPlaceholder call CocActionAsync('showSignatureHelp')
|
||||||
augroup end
|
# augroup end
|
||||||
|
|
||||||
" Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
|
# " Remap for do codeAction of selected region, ex: `<leader>aap` for current paragraph
|
||||||
xmap <leader>a <Plug>(coc-codeaction-selected)
|
# xmap <leader>a <Plug>(coc-codeaction-selected)
|
||||||
nmap <leader>a <Plug>(coc-codeaction-selected)
|
# nmap <leader>a <Plug>(coc-codeaction-selected)
|
||||||
|
|
||||||
" Remap for do codeAction of current line
|
# " Remap for do codeAction of current line
|
||||||
nmap <leader>ac <Plug>(coc-codeaction)
|
# nmap <leader>ac <Plug>(coc-codeaction)
|
||||||
" Fix autofix problem of current line
|
# " Fix autofix problem of current line
|
||||||
nmap <leader>qf <Plug>(coc-fix-current)
|
# nmap <leader>qf <Plug>(coc-fix-current)
|
||||||
|
|
||||||
" Create mappings for function text object, requires document symbols feature of languageserver.
|
# " Create mappings for function text object, requires document symbols feature of languageserver.
|
||||||
xmap if <Plug>(coc-funcobj-i)
|
# xmap if <Plug>(coc-funcobj-i)
|
||||||
xmap af <Plug>(coc-funcobj-a)
|
# xmap af <Plug>(coc-funcobj-a)
|
||||||
omap if <Plug>(coc-funcobj-i)
|
# omap if <Plug>(coc-funcobj-i)
|
||||||
omap af <Plug>(coc-funcobj-a)
|
# omap af <Plug>(coc-funcobj-a)
|
||||||
|
|
||||||
" Use <C-d> for select selections ranges, needs server support, like: coc-tsserver, coc-python
|
# " Use <C-d> for select selections ranges, needs server support, like: coc-tsserver, coc-python
|
||||||
nmap <silent> <C-d> <Plug>(coc-range-select)
|
# nmap <silent> <C-d> <Plug>(coc-range-select)
|
||||||
xmap <silent> <C-d> <Plug>(coc-range-select)
|
# xmap <silent> <C-d> <Plug>(coc-range-select)
|
||||||
|
|
||||||
" Use `:Format` to format current buffer
|
# " Use `:Format` to format current buffer
|
||||||
command! -nargs=0 Format :call CocAction('format')
|
# command! -nargs=0 Format :call CocAction('format')
|
||||||
|
|
||||||
" Use `:Fold` to fold current buffer
|
# " Use `:Fold` to fold current buffer
|
||||||
command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
# command! -nargs=? Fold :call CocAction('fold', <f-args>)
|
||||||
|
|
||||||
" use `:OR` for organize import of current buffer
|
# " use `:OR` for organize import of current buffer
|
||||||
command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
# command! -nargs=0 OR :call CocAction('runCommand', 'editor.action.organizeImport')
|
||||||
|
|
||||||
" Add status line support, for integration with other plugin, checkout `:h coc-status`
|
# " Add status line support, for integration with other plugin, checkout `:h coc-status`
|
||||||
" set statusline^=%{coc#status()}%{get(b:,'coc_current_function',''')}
|
# " set statusline^=%{coc#status()}%{get(b:,'coc_current_function',''')}
|
||||||
|
|
||||||
" Using CocList
|
# " Using CocList
|
||||||
" Show all diagnostics
|
# " Show all diagnostics
|
||||||
nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
|
# nnoremap <silent> <space>a :<C-u>CocList diagnostics<cr>
|
||||||
" Manage extensions
|
# " Manage extensions
|
||||||
nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
# nnoremap <silent> <space>e :<C-u>CocList extensions<cr>
|
||||||
" Show commands
|
# " Show commands
|
||||||
nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
# nnoremap <silent> <space>c :<C-u>CocList commands<cr>
|
||||||
" Find symbol of current document
|
# " Find symbol of current document
|
||||||
nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
# nnoremap <silent> <space>o :<C-u>CocList outline<cr>
|
||||||
" Search workspace symbols
|
# " Search workspace symbols
|
||||||
nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
# nnoremap <silent> <space>s :<C-u>CocList -I symbols<cr>
|
||||||
" Do default action for next item.
|
# " Do default action for next item.
|
||||||
nnoremap <silent> <space>j :<C-u>CocNext<CR>
|
# nnoremap <silent> <space>j :<C-u>CocNext<CR>
|
||||||
" Do default action for previous item.
|
# " Do default action for previous item.
|
||||||
nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
# nnoremap <silent> <space>k :<C-u>CocPrev<CR>
|
||||||
" Resume latest coc list
|
# " Resume latest coc list
|
||||||
nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
# nnoremap <silent> <space>p :<C-u>CocListResume<CR>
|
||||||
|
|
||||||
" properly find root for py projects in workspace
|
# " properly find root for py projects in workspace
|
||||||
autocmd FileType python let b:coc_root_patterns = ['.git', '.env', 'venv', '.venv', 'setup.cfg', 'setup.py', 'pyproject.toml', 'pyrightconfig.json']
|
# autocmd FileType python let b:coc_root_patterns = ['.git', '.env', 'venv', '.venv', 'setup.cfg', 'setup.py', 'pyproject.toml', 'pyrightconfig.json']
|
||||||
|
|
||||||
" let g:tex_flavor = 'latex'
|
# " let g:tex_flavor = 'latex'
|
||||||
'';
|
# '';
|
||||||
# lua << EOF
|
# lua << EOF
|
||||||
# ${builtins.readFile ./init.lua}
|
# ${builtins.readFile ./init.lua}
|
||||||
# EOF
|
# EOF
|
||||||
|
# generatedConfigs = {
|
||||||
|
# lua = builtins.readFile ./plugins.lua;
|
||||||
|
# };
|
||||||
|
extraConfig = ''
|
||||||
|
${builtins.readFile ./init.vim}
|
||||||
|
|
||||||
|
lua << EOF
|
||||||
|
${builtins.readFile ./init.lua}
|
||||||
|
EOF
|
||||||
|
'';
|
||||||
};
|
};
|
||||||
in {
|
in {
|
||||||
# Note that this doesn’t merge deeply, so you couldn’t add to plugins. For that
|
# Note that this doesn’t merge deeply, so you couldn’t add to plugins. For that
|
||||||
@ -443,10 +454,10 @@ in {
|
|||||||
viAlias = true;
|
viAlias = true;
|
||||||
coc = {
|
coc = {
|
||||||
enable = true;
|
enable = true;
|
||||||
settings = {
|
# settings = {
|
||||||
"rust-analyzer.serverPath" = "${pkgs.rust-analyzer}/bin/rust-analyzer";
|
# "rust-analyzer.serverPath" = "${pkgs.rust-analyzer}/bin/rust-analyzer";
|
||||||
"gopls.experimentalWorkspaceModule" = true;
|
# "gopls.experimentalWorkspaceModule" = true;
|
||||||
};
|
# };
|
||||||
};
|
};
|
||||||
} // config;
|
} // config;
|
||||||
# programs.vim = config;
|
# programs.vim = config;
|
||||||
|
Loading…
Reference in New Issue
Block a user