@@ -1,6 +1,6 @@
1use crate::{
1use crate::{
2 clipboard::{get_clipboard_provider, ClipboardProvider},
2 clipboard::{get_clipboard_provider, ClipboardProvider},
3− document::SCRATCH_BUFFER_NAME,
3+ document::{Mode, SCRATCH_BUFFER_NAME},
4 graphics::{CursorKind, Rect},
4 graphics::{CursorKind, Rect},
5 theme::{self, Theme},
5 theme::{self, Theme},
6 tree::{self, Tree},
6 tree::{self, Tree},
@@ -9,7 +9,7 @@ use crate::{
10use futures_util::future;
10use futures_util::future;
12− collections::BTreeMap,
12+ collections::{BTreeMap, HashMap},
13 io::stdin,
13 io::stdin,
14 path::{Path, PathBuf},
14 path::{Path, PathBuf},
@@ -22,7 +22,7 @@ use anyhow::Error;
23pub use helix_core::diagnostic::Severity;
23pub use helix_core::diagnostic::Severity;
24pub use helix_core::register::Registers;
24pub use helix_core::register::Registers;
25−use helix_core::syntax;
25+use helix_core::{hashmap, syntax};
26use helix_core::{Position, Selection};
26use helix_core::{Position, Selection};
28use serde::Deserialize;
28use serde::Deserialize;
@@ -103,6 +103,30 @@ pub struct Config {
103 /// Whether to display infoboxes. Defaults to true.
103 /// Whether to display infoboxes. Defaults to true.
104 pub auto_info: bool,
104 pub auto_info: bool,
105 pub file_picker: FilePickerConfig,
105 pub file_picker: FilePickerConfig,
106+ /// Shape for cursor in each mode
107+ pub cursor_shape: CursorShapeConfig,
110+#[derive(Debug, Clone, PartialEq, Deserialize)]
111+#[serde(transparent)]
112+pub struct CursorShapeConfig(HashMap<Mode, CursorKind>);
114+impl std::ops::Deref for CursorShapeConfig {
115+ type Target = HashMap<Mode, CursorKind>;
117+ fn deref(&self) -> &Self::Target {
122+impl Default for CursorShapeConfig {
123+ fn default() -> Self {
125+ Mode::Insert => CursorKind::Bar,
126+ Mode::Normal => CursorKind::Block,
127+ Mode::Select => CursorKind::Underline,
108#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
132#[derive(Debug, Clone, PartialEq, Eq, Deserialize)]
@@ -110,7 +134,6 @@ pub struct Config {
110pub enum LineNumber {
134pub enum LineNumber {
111 /// Show absolute line number
135 /// Show absolute line number
112 Absolute,
136 Absolute,
114 /// Show relative line number to the primary cursor
137 /// Show relative line number to the primary cursor
115 Relative,
138 Relative,
@@ -135,6 +158,7 @@ impl Default for Config {
135 completion_trigger_len: 2,
158 completion_trigger_len: 2,
136 auto_info: true,
159 auto_info: true,
137 file_picker: FilePickerConfig::default(),
160 file_picker: FilePickerConfig::default(),
161+ cursor_shape: CursorShapeConfig::default(),
@@ -594,9 +618,15 @@ impl Editor {
594 let inner = view.inner_area();
618 let inner = view.inner_area();
595 pos.col += inner.x as usize;
619 pos.col += inner.x as usize;
596 pos.row += inner.y as usize;
620 pos.row += inner.y as usize;
597− (Some(pos), CursorKind::Hidden)
621+ let cursorkind = self
626+ .unwrap_or_default();
627+ (Some(pos), cursorkind)
599− (None, CursorKind::Hidden)
629+ (None, CursorKind::default())