summaryrefslogtreecommitdiff
path: root/nvim
diff options
context:
space:
mode:
authormediocregopher <mediocregopher@gmail.com>2023-08-13 21:34:14 +0200
committermediocregopher <mediocregopher@gmail.com>2023-08-13 21:35:17 +0200
commit1957081c122fe231eb6120192489dd979d214317 (patch)
treeb8cd0812ec3c0452d54cb789ba938e6f0c0e8278 /nvim
parentef8da74f1ae38d9eceb68846fe9ef402c8e30fcf (diff)
Update branch with all changes which could be brought in from private branches
For a while I was keeping a private branch where there were a lot of non-public things included, and that became the de-facto branch while this one lagged. This one is now up-to-date, all private stuff is dealt with via config files which are not committed.
Diffstat (limited to 'nvim')
-rw-r--r--nvim/default.nix73
-rw-r--r--nvim/init.vim55
2 files changed, 36 insertions, 92 deletions
diff --git a/nvim/default.nix b/nvim/default.nix
index 83dd87c..c1b66cf 100644
--- a/nvim/default.nix
+++ b/nvim/default.nix
@@ -1,19 +1,6 @@
-{
+{}: rec {
- pkgs ? (import ../pkgs.nix) {},
-
-}: rec {
-
- goimports = pkgs.buildGoModule rec {
- pname = "goimports";
- version = "v0.1.7";
- src = builtins.fetchGit {
- url = "https://go.googlesource.com/tools";
- rev = "0df0ca0f43117120bd7cc900ebf765f9b799438a";
- };
- vendorSha256 = "1vs4vbl3kh8lbqrm4yqqn27ammlqj7jdbi0ca9s4fkja2sk45ibi";
- subPackages = [ "cmd/goimports" ];
- };
+ pkgs = (import ../pkgs.nix).stable2305 {};
misspell = pkgs.buildGoPackage rec {
pname = "misspell";
@@ -30,36 +17,10 @@
goDeps = ./misspellDeps.nix;
};
- # the gocode-gomod which comes with nixpkgs places the binary at
- # gocode-gomod, we gotta rename it
- gocode = pkgs.stdenv.mkDerivation {
- name = "gocode";
- src = pkgs.gocode-gomod;
- builder = builtins.toFile "builder.sh" ''
- source $stdenv/setup
- mkdir -p "$out"/bin/
- cp "$src"/bin/gocode-gomod "$out"/bin/gocode
- '';
- };
-
env = pkgs.buildEnv {
name = "nvim-env";
paths = [
- pkgs.vimPlugins.vim-plug
- pkgs.vimPlugins.deoplete-nvim
- pkgs.vimPlugins.deoplete-go
- pkgs.vimPlugins.nerdtree
- pkgs.vimPlugins.nerdtree-git-plugin
- pkgs.vimPlugins.vim-gitgutter
- pkgs.vimPlugins.neomake
- pkgs.vimPlugins.papercolor-theme
- pkgs.vimPlugins.vim-go
- pkgs.vimPlugins.vim-nix
-
- pkgs.golangci-lint
- pkgs.gopls
- gocode
- goimports
+ pkgs.shellcheck
misspell
];
};
@@ -67,18 +28,18 @@
envPlugins = "${env}/share/vim-plugins";
init = pkgs.writeText "nvim-init" ''
- source ${envPlugins}/vim-plug/plug.vim
-
- call plug#begin('${envPlugins}')
- Plug '${envPlugins}/deoplete-nvim'
- Plug '${envPlugins}/deoplete-go', { 'for': 'go' }
- Plug '${envPlugins}/nerdtree', { 'on': 'NERDTreeToggle' }
- Plug '${envPlugins}/nerdtree-git-plugin'
- Plug '${envPlugins}/vim-gitgutter'
- Plug '${envPlugins}/neomake'
- Plug '${envPlugins}/papercolor-theme'
- Plug '${envPlugins}/vim-go', { 'for': 'go' }
- Plug '${envPlugins}/vim-nix', { 'for': 'nix' }
+ source ${pkgs.vimPlugins.vim-plug}/plug.vim
+
+ call plug#begin()
+ Plug '${pkgs.vimPlugins.deoplete-nvim}'
+ Plug '${pkgs.vimPlugins.nerdtree}', { 'on': 'NERDTreeToggle' }
+ Plug '${pkgs.vimPlugins.nerdtree-git-plugin}'
+ Plug '${pkgs.vimPlugins.vim-gitgutter}'
+ Plug '${pkgs.vimPlugins.neomake}'
+ Plug '${pkgs.vimPlugins.papercolor-theme}'
+ Plug '${pkgs.vimPlugins.vim-go}', { 'for': 'go' }
+ Plug '${pkgs.vimPlugins.vim-nix}', { 'for': 'nix' }
+ Plug '${pkgs.vimPlugins.rust-vim}', { 'for': 'rust' }
call plug#end()
source ${./init.vim}
@@ -92,12 +53,12 @@
rplugin = pkgs.stdenv.mkDerivation {
name = "nvim-rplugin";
- buildInputs = [ pkgs.git nvimRaw ];
+ buildInputs = [ pkgs.git pkgs.tree nvimRaw ];
builder = builtins.toFile "builder.sh" ''
source $stdenv/setup
mkdir -p "$out"/
export NVIM_RPLUGIN_MANIFEST="$out"/rplugin.vim
- nvim -c ':UpdateRemotePlugins' -c ':exit' >/dev/null
+ nvim -i NONE -c ':UpdateRemotePlugins' -c ':exit' >/dev/null
'';
};
diff --git a/nvim/init.vim b/nvim/init.vim
index 630b90d..0ac7f84 100644
--- a/nvim/init.vim
+++ b/nvim/init.vim
@@ -1,16 +1,23 @@
+
+set noswapfile
+
" PaperColor ###############################################################
set background=light
colorscheme PaperColor
" Deoplete #################################################################
+
let g:deoplete#enable_at_startup = 1
" use tab to cycle
inoremap <expr><tab> pumvisible() ? "\<c-n>" : "\<tab>"
" close preview when leaving insert
autocmd InsertLeave,CompleteDone * if pumvisible() == 0 | pclose | endif
+" use omni completion for go, provided by vim-go
+call deoplete#custom#option('omni_patterns', { 'go': '[^. *\t]\.\w*' })
" NERDTree #################################################################
+
let NERDTreeMouseMode=3
let NERDTreeMinimalUI=1
let NERDTreeAutoDeleteBuffer=1
@@ -33,11 +40,16 @@ map <C-n> :NERDTreeToggle<CR>
autocmd BufEnter * if &buftype == 'terminal' | :startinsert | endif
" vim-go ###################################################################
-"
-"use goimports for formatting instead of gofmt
-let g:go_fmt_command = "goimports"
+
+let g:go_fmt_autosave = 1
+let g:go_fmt_command="goimports"
+
+" rust.vim ###################################################################
+
+let g:rustfmt_autosave = 1
" neomake ##################################################################
+
autocmd! BufWritePost * Neomake
"let g:neomake_verbose=3
"let g:neomake_logfile='/tmp/neomake.log'
@@ -49,35 +61,6 @@ autocmd! BufWritePost * Neomake
let g:neomake_open_list=0
let g:neomake_place_signs=0
-let g:neomake_go_enabled_makers = ['go', 'golangcilint']
-let g:neomake_go_golangcilint_maker = {
- \ 'exe': 'golangci-lint',
- \ 'args': [
- \ 'run',
- \ '--no-config',
- \ '--out-format=line-number',
- \ '--print-issued-lines=false',
- \ '-E=durationcheck',
- \ '-E=errorlint',
- \ '-E=exportloopref',
- \ '-E=forbidigo',
- \ '-E=gochecknoinits',
- \ '-E=godot',
- \ '-E=goimports',
- \ '-E=misspell',
- \ '-E=revive',
- \ '-E=unconvert',
- \ '-E=unparam',
- \ '.'
- \ ],
- \ 'output_stream': 'stdout',
- \ 'append_file': 0,
- \ 'cwd': '%:h',
- \ 'errorformat':
- \ '%f:%l:%c: %m,' .
- \ '%f:%l: %m'
- \ }
-
let g:neomake_markdown_enabled_makers = ['misspell']
let g:neomake_markdown_misspell_maker = {
\ 'errorformat': '%f:%l:%c:%m',
@@ -88,11 +71,7 @@ let g:neomake_markdown_misspell_maker = {
"Makes current line/column highlighted, and set text width
set tw=80
set colorcolumn=+1
-"autocmd bufenter * set cursorline cursorcolumn colorcolumn=+1
-"autocmd bufleave * set nocursorline nocursorcolumn colorcolumn=0
hi ColorColumn ctermfg=none ctermbg=grey cterm=none
-"hi CursorLine ctermfg=none ctermbg=lightgrey cterm=none
-"hi CursorColumn ctermfg=none ctermbg=lightgrey cterm=none
"Buffers scroll a bit so cursor doens't go all the way to the bottom before
"scroll begins
@@ -123,6 +102,7 @@ au FileType yaml setlocal tabstop=2 shiftwidth=2
au FileType html setlocal tabstop=2 shiftwidth=2
au FileType proto setlocal tabstop=2 shiftwidth=2
au FileType javascript setlocal tabstop=2 shiftwidth=2
+au FileType typescript setlocal tabstop=2 shiftwidth=2
"We want certain types to use tabs instead of spaces
au FileType go setlocal nolist noexpandtab
@@ -160,6 +140,9 @@ noremap <leader>tx :tabclose<CR>
" yank/paste into/from clipboard
set clipboard+=unnamedplus
+" Enable mouse in all modes
+set mouse=
+
"Clojure specific mappings
" Eval outerform
au FileType clojure nmap <buffer> cpP :Eval<cr>